Hello,
I am trying to split GPTM timers to get two independent PWMs as shown below:
void initPWM_PB(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
//TIMER_B Conf
GPIOPinConfigure(GPIO_PB1_T2CCP1);
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_1);
TimerConfigure(TIMER2_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PWM);
TimerLoadSet(TIMER2_BASE, TIMER_B, 3200);
TimerMatchSet(TIMER2_BASE, TIMER_B, 1600);
TimerEnable(TIMER2_BASE, TIMER_B);
//TIMER_A Conf
GPIOPinConfigure(GPIO_PB0_T2CCP0);
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_0);
TimerConfigure(TIMER2_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
TimerLoadSet(TIMER2_BASE, TIMER_A, 1600);
TimerMatchSet(TIMER2_BASE, TIMER_A, 800);
TimerEnable(TIMER2_BASE, TIMER_A);
}
void initPWM_Wide(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
//TIMER_A Conf
GPIOPinConfigure(GPIO_PC4_WT0CCP0);
GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_4);
TimerConfigure(WTIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
TimerLoadSet(WTIMER0_BASE, TIMER_A, 3200);
TimerMatchSet(WTIMER0_BASE, TIMER_A, 1600);
TimerEnable(WTIMER0_BASE, TIMER_A);
//TIMER_B conf
GPIOPinConfigure(GPIO_PC5_WT0CCP1);
GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_5);
TimerConfigure(WTIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PWM);
TimerLoadSet(WTIMER0_BASE, TIMER_B, 1600);
TimerMatchSet(WTIMER0_BASE, TIMER_B, 800);
TimerEnable(WTIMER0_BASE, TIMER_B);
}
I am able to see one of them working at a time (if I comment the relevant code). However, I am unable to get both the timers (TIMER_A and TIMER_B) to work simultaneously. This behaviour of either the TIMER_A or the TIMER_B working at a time (and never simultaneously) is seen across the normal-width as well as the wide timer.
For your reference, this is on the Tiva TM4C123BE6PM.
Any help is appreciated. Thanks in advance.
Regards,
Anand