Hello,
I'm trying to get M1PWM2-5 working on a LM4F232H5QD (EK-LM4F232 Keil). I can get PA6, PA7 and PF1
working but can't get any signal from PF0. I have tried everything I could think of and still no luck.
Can anyone please go through this and tell me if there is something wrong with this code? Thanks!
// set pwm system clock
SysCtlPWMClockSet(SYSCTL_PWMDIV_1);
// enable peripherals
SysCtlPeripheralEnable(SYSCTL_PERIPH2_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH2_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1);
// enable alternate function
GPIOPinConfigure(GPIO_PA6_M1PWM2);
GPIOPinConfigure(GPIO_PA7_M1PWM3);
GPIOPinConfigure(GPIO_PF0_M1PWM4);
GPIOPinConfigure(GPIO_PF1_M1PWM5);
// configure pads
GPIOPinTypePWM(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1);
// configure PWM generators
PWMGenConfigure(PWM1_BASE, PWM_GEN_1, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
PWMGenConfigure(PWM1_BASE, PWM_GEN_2, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
// set PWM generators periods
PWMGenPeriodSet(PWM1_BASE, PWM_GEN_1, 1666);
PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, 1666);
// set pulse width
PWMPulseWidthSet(PWM1_BASE, PWM_OUT_2, 1666 / 2);
PWMPulseWidthSet(PWM1_BASE, PWM_OUT_4, 1666 / 2);
// enable deadband
PWMDeadBandEnable(PWM1_BASE, PWM_GEN_1, 10, 10);
PWMDeadBandEnable(PWM1_BASE, PWM_GEN_2, 10, 10);
// enable PWM bits
PWMOutputState(PWM1_BASE, PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT, true);
// enable the generators
PWMGenEnable(PWM1_BASE, PWM_GEN_1);
PWMGenEnable(PWM1_BASE, PWM_GEN_2);
// sync the time base (execute after enabling generators)
PWMSyncTimeBase(PWM1_BASE, PWM_GEN_1_BIT | PWM_GEN_2_BIT);