Hello,
I have TI-RTOS application with 4 PWMs, each of them using separate PWM Generator (outputs PWM0, PWM3, PWM5 and PWM6).
- Upon start it calls:
void EK_TM4C129EXL_initPWM(void)
{
/* Enable PWM peripherals */
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
/*
* Enable PWM output on GPIO pins. PWM output is connected to an Ethernet
* LED on the development board (D4). The PWM configuration
* below will disable Ethernet functionality.
*/
//
// Configure the GPIO Pin Mux for PF3
// for M0PWM3
//
GPIOPinConfigure(GPIO_PF3_M0PWM3);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_3);
#ifndef PWM_TEST
//
// Configure the GPIO Pin Mux for PG0
// for M0PWM0
//
GPIOPinConfigure(GPIO_PF0_M0PWM0);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0);
#endif
//
// Configure the GPIO Pin Mux for PG1
// for M0PWM5
//
GPIOPinConfigure(GPIO_PG1_M0PWM5);
GPIOPinTypePWM(GPIO_PORTG_BASE, GPIO_PIN_1);
// Configure the GPIO Pin Mux for PK4
// for M0PWM6
//
GPIOPinConfigure(GPIO_PK4_M0PWM6);
GPIOPinTypePWM(GPIO_PORTK_BASE, GPIO_PIN_4);
PWM_init();
}
- Then starts the PWMs individually, e.g.:
PWM_Params_init(&Output1PWMparams);
Output1PWMparams.period = 100;// Period in microseconds
Output1PWMparams.dutyMode = PWM_DUTY_TIME;
Output1PWMhandle = PWM_open(Board_PWM5, &Output1PWMparams);
if (Output1PWMhandle == NULL)
{
System_abort("Error initializing PWM 5\n");
}
PWM_setDuty(Output1PWMhandle, 10);
I can use any combination of periods (50, 100, 300 us), however when trying slower periods (2000 and 40000 us) the PWM_open fails, not able to set the pre-scaler.
How can I accomplish to slow down the period for some PWMs, and be able to concurrently have fast and slow periods on different outputs?
Please advise. Thank you,
Dalibor