Tool/software: Code Composer Studio
I have used the PWM before but for some reason I can't get it to output a pulse.
pinout.c configuration:
// // Configure the GPIO Pin Mux for PF0 // for M0PWM0 // MAP_GPIOPinConfigure(GPIO_PF0_M0PWM0); MAP_GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0); // // Configure the GPIO Pin Mux for PG0 // for M0PWM4 // MAP_GPIOPinConfigure(GPIO_PG0_M0PWM4); MAP_GPIOPinTypePWM(GPIO_PORTG_BASE, GPIO_PIN_0); // // Configure the GPIO Pin Mux for PF2 // for M0PWM2 // MAP_GPIOPinConfigure(GPIO_PF2_M0PWM2); MAP_GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2);
My code is:
// Enable PWM0
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
while (!SysCtlPeripheralReady(SYSCTL_PERIPH_PWM0))
{}
// Configure the PWM0
PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, 4096);
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0_BIT, 2048);
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2_BIT, 2048);
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_4_BIT, 2048);
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_2_BIT | PWM_OUT_4_BIT), true);