Hi, I need to measure the time between external interrupts on a pin however I am having problems setting up the timer. I require trigger on Both edges. As I understand i can do this in 2 ways, the first with a gpio interupt that starts a periodic or one shot timer and then check the count on the second interrupt. The second method is to use input-edge time mode and have the interrupt trigger the timer directly and then compute the count difference between interrupts. I have tried both methods but i can't seem to configure the timer properly. Using the periodic timer method, it seems to count in the opposite direction that i set with TIMER_CFG_PERIODIC_UP. Using the edge time mode, it seems to count down regardless. To configure edge-time I use TIMER_CFG_A_CAP_TIME_UP. Is there something else I need to configure for count direction?
For periodic I configure the timer with:
// Configuring the timers
Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_PERIODIC_UP, TIMER_BOTH, 0);
MAP_GPIOIntTypeSet(GPIOA1_BASE,GPIO_INT_PIN_5,GPIO_BOTH_EDGES);
For edge-time I configure the timer with:
// Configure the timer in edge count mode
MAP_TimerConfigure(TIMERA2_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME_UP));
// Set the detection edge
MAP_TimerControlEvent(TIMERA2_BASE,TIMER_A,TIMER_EVENT_BOTH_EDGES);
Am I required to set a reload value of zero for count-up or is this set automatically?