Why is my timer getting disabled?
I'm trying to use the Timer driver to implement a regular periodic timer using the PIC32 TMR2 in 32-bit mode and I've configured the driver like this:
tmr2_handle = DRV_TMR_Open(DRV_TMR_INDEX_0, DRV_IO_INTENT_EXCLUSIVE);
if (DRV_HANDLE_INVALID == tmr2_handle)
printf("TIMER 2 Driver can't be opened!!");
DRV_TMR_AlarmRegister(tmr2_handle, 1, true, 0, timer2_tick);
printf("TIMER 2 Driver can't be Started!!");
static void timer2_tick( uintptr_t context, uint32_t alarmCount )
If I single-step through the code I can see the timer enabled and counting. But if I hit "run" the execution never gets to the "timer2_tick" callback and when I pause the execution I see in the TMR2 registers that the timer is disabled.
What else do I need to do to make this work? I just need a periodic timer that executes the callback every time the counter reaches the period and the documentation does not contain an example of clear explanation about how to achieve this.