PWM with Ixora/T30 under WinCE

Can’t get PWM working on a Ixora/T30 under WinCE 1.4 final. Used the C# example for PWM and changed the MXM pins to:

public const Int32 PWM_A = 2; //59;                         //PWM_A at SODIMM pin 59
public const Int32 PWM_B = 4; //28;                         //PWM_B at SODIMM pin 28
public const Int32 PWM_C = 6; //30;                         //PWM_C at SODIMM pin 30
public const Int32 PWM_D = 8; //67;                         //PWM_D at SODIMM pin 67

Connected pin X27.33 to an Oscilloscope and set all PWM outputs to 50Hz/50 duty cycle. But nothing changes. When I use the Toradex GPIO Config V2.4 and change pullstate from MXM3.2 to pullup or pulldone I see changes on my Oscilloscope.

Any suggestion or ideas?

With we have an init Function with the following function calls:
(GPIO Lib was initialised previously)
(getSODIMMPin returns the same as your public constants)

Function initPWMEasy(ByVal pwm As Integer) As Boolean
        Dim prescale As Integer = 64
        Dim period As Integer = 256
        Dim altFn As Integer = 0 ' 0 = PWM -1 = GPIO

        GPIO.SetPinAltFn(getSODIMMPin(pwm), altFn, GPIO.DIR_OUT)   'Set SODIMM Pin xx as Output'
        GPIO.SetPinLevel(getSODIMMPin(pwm), True)              'Set default level LOW'
        GPIO.SetPinDir(getSODIMMPin(pwm), True)

        'MsgBox("Init PWM" & pwm.ToString & " = " & getSODIMMPin(pwm))
        InitPWM(pwm, prescale, period)
        SetPWMDutyPercentage(pwm, 0)

        PWMEngine = pwm
    End Function

It works fine, but have not tried with 50Hz only. If i would have programmed todas, the PWMChannel would be an enum :wink: I use it with the Apalis T30, WINCE7 1.4 and IXORA Board.

I think the altFN could be wrong.

I hope it could help you a bit, Have a nice Weekend, Best Regards, Stefan

Now it works. Problem was altFunctionA was set to 1 instead of 0 in the PWM example of Toradex.

So I had to change the following part (additionaly to the MXM numbers):

 else if (procID == Constant.TYPE_TEGRA3)    ///< T30
                channelA = 0;
                channelB = 1;
                channelC = 2;
                channelD = 3;
                altFunctionA = 0;  //<-- Original Toradex example set to 1
                altFunctionB = 0;  //<-- Original Toradex example set to 1
                altFunctionC = 0;  //<-- Original Toradex example set to 1
                altFunctionD = 0;  //<-- Original Toradex example set to 1
                prescale_1 = Constant.TEGRA3_PRESCALE_50Hz;
                prescale_2 = Constant.TEGRA3_PRESCALE_100Hz;
                prescale_3 = Constant.TEGRA3_PRESCALE_500Hz;
                prescale_4 = Constant.TEGRA3_PRESCALE_1kHz;
                prescale_5 = Constant.TEGRA3_PRESCALE_2kHz;
                prescale_6 = Constant.TEGRA3_PRESCALE_5kHz;

Thank you Stefan.P for the example that pointed me to the correct direction.