I am trying to configure 2 simple periodic timer but the more I read and the more I try different configuration, the more I get confused.
I tried 2 timers, 0 and 1 but get time intervals that do not correspond to the timer load values. I now have tried the WTIMER0 configuration haphazardly because the documentation is scattered over a few chapters in DRIVER_LIB. Here is the code:
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ); SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER0); // Configure the 32-bit periodic timers TimerConfigure(WTIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PERIODIC | TIMER_CFG_B_PERIODIC); //PWMPeriod2 = SysCtlClockGet() / 100; PWMPeriod2=160000; // Setup the interrupts for the timer timeout. IntEnable(INT_WTIMER0A); TimerIntEnable(WTIMER0_BASE, TIMER_TIMA_TIMEOUT); TimerIntRegister(WTIMER0_BASE, TIMER_A,TimerA_IntHandler); TimerIntRegister(WTIMER0_BASE, TIMER_B,TimerB_IntHandler); IntEnable(INT_WTIMER0B); TimerIntEnable(WTIMER0_BASE, TIMER_TIMB_TIMEOUT); TimerEnable(WTIMER0_BASE, TIMER_A); TimerEnable(WTIMER0_BASE, TIMER_B); TimerLoadSet(WTIMER0_BASE, TIMER_B, 8000000); // 0.5 SEC TimerLoadSet(WTIMER0_BASE, TIMER_A, 160000);
Time A interrupts at 1.305 seconds What am I missing? Is there a pre-scaler? Do I have to set the clock source?
thanks
Claude