This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PWM on EKS-LM4F232

Hello everybody. I am trying to set up a PWM using the M4, but unfortunetally I couldn't find any example to see how it is done.

 

So far this is what I have, a couple of ideas taken from some application notes, but I still can't have any output, can somebody help me? Is there anything missing?

 

 

SysCtlPWMClockSet(SYSCTL_PWMDIV_1);

SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);

GPIOPinTypePWM(GPIO_PORTH_BASE, GPIO_PIN_0);

ulPeriod =

SysCtlClockGet() / 440;

PWMGenConfigure(PWM_BASE, PWM_GEN_0,

PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);

PWMGenPeriodSet(PWM_BASE, PWM_GEN_0, 400);

PWMPulseWidthSet(PWM_BASE, PWM_OUT_0, 100);

PWMGenEnable(PWM_BASE, PWM_GEN_0);

PWMOutputState(PWM_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT), true);

  • The PWM module is similar enough to the the LM3Sxxxx devices that you should be able to cut and paste code from one of the Stellarisware code examples into a LM4Fxxx project.  There is also examples loaded in the example file for LM4Fxxx Stellarisware on the CD.  I recommend downloading (if you have not already, Stellarisware SW-LM3S at http://www.ti.com/tool/sw-lm3s) and use the example below to cut and paste from:

    C:\StellarisWare_public\boards\ek-lm3s9b92\pwmgen

    Lela