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.

Getting SDK's PWM examples to work on EK-TM4C1294XL Tiva Launchpad

Other Parts Discussed in Thread: EK-TM4C1294XL

Task

Working PWM examples provided in the TivaWare_C_Series v2.1.3.156 SDK on the EK-TM4C1294XL Tiva Launchpad

Issue

TivaWare uses M0PWM0(PB6) & M0PWM1(PB7), which are not broken out for the EK-TM4C1294XL Launchpad for inspection or use

Attempted Resolution


Switch to GPIO which are broken out to EK-TM4C1294XL header pins. These are M0PWM2(PF2) & M0PWM3(PF3) which are broken out to X9. See the attached ZIP file for a project doing this

Status

No PWM output is observed on these pins PF2 or PF3. To note the wiring is validated, see and use deadband_debug_gpio_on() provided for confirmation

Question


What the heck is wrong here? I quite literally changed the pins, and that's it! :(

Code (extracted for illustration)

 

    SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);				//(orig)SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

    GPIOPinConfigure(GPIO_PF2_M0PWM2);							//(orig)GPIOPinConfigure(GPIO_PB6_M0PWM0);
    GPIOPinConfigure(GPIO_PF3_M0PWM3);							//(orig)GPIOPinConfigure(GPIO_PB7_M0PWM1);

    GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2);				//(orig)GPIOPinTypePWM(GPIO_PORTB_BASE, GPIO_PIN_6);
    GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_3);				//(orig)GPIOPinTypePWM(GPIO_PORTB_BASE, GPIO_PIN_7);

    PWMGenConfigure(PWM0_BASE, PWM_GEN_2, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);	//(orig)PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);

    PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, 64000);				//(orig)PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, 64000);

    PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, PWMGenPeriodGet(PWM0_BASE, PWM_GEN_0) / 4);	//(orig)PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, PWMGenPeriodGet(PWM0_BASE, PWM_GEN_0) / 4);

    PWMDeadBandEnable(PWM0_BASE, PWM_GEN_2, 160, 160);			//(orig)PWMDeadBandEnable(PWM0_BASE, PWM_GEN_0, 160, 160);

    PWMOutputState(PWM0_BASE, PWM_OUT_2_BIT | PWM_OUT_3_BIT, true);						//(orig)PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT | PWM_OUT_0_BIT, true);

    PWMGenEnable(PWM0_BASE, PWM_GEN_2);							//(orig)PWMGenEnable(PWM0_BASE, PWM_GEN_0);


 

 

 

ti_pwm_dead_band.zip

  • Justin Reina89 said:
    What the heck is wrong here?

    Perhaps your selection of "PWM_GEN_2" rather than "PWM_GEN_1" requires review.

    GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2);                

    GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_3);

    If it's true that "PWM_GEN_0" targets "M0PWM0 & M0PWM1" it is hard to justify your selection of, "PWM_GEN_2."

    There (may) be other code defects - that one simply "jumps out."

  • minus the bleak sarcasm, thank you!! Using PWM_GEN_1 corrected the firmware, and is now operational!! I've attached the corrected code below (ti_pwm_dead_band-working.zip).

    Thank you!! :)!

    ti_pwm_dead_band-working.zip