Hi,
I am trying to synchronize two wide timers on a Tiva (TM4C123BE6PM) in PWM mode. The functions used to initialize and synchronize the two timers are shown below (the functions are also called in the order given below):
void init50KHzPWM_Wide(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinConfigure(GPIO_PC6_WT1CCP0);
GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_6);
TimerConfigure(WTIMER1_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
TimerLoadSet(WTIMER1_BASE, TIMER_A, 1600); //Count for 50KHz at 80MHz clock.
TimerMatchSet(WTIMER1_BASE, TIMER_A, 800); //50% duty cycle at init
TimerEnable(WTIMER1_BASE, TIMER_A);
}
void init25KHzPWM_Wide(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
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); //Count for 25KHz at 80MHz clock.
TimerMatchSet(WTIMER0_BASE, TIMER_A, 1600); //50% duty cycle at init
TimerEnable(WTIMER0_BASE, TIMER_A);
}
void syncTimers(void)
{
TimerSynchronize(WTIMER0_BASE, WTIMER_0A_SYNC | WTIMER_1A_SYNC);
}
This seems to be what the manual suggests (section 11.3.4). I have tried a quiet a few other things, (for example to make a HWREG write to the GPTMSYNC register) in the syncTimers function, but I just can't get the two timers to synchronize.
Any help is appreciated.
Regards,
Anand