Question
Resetting a Timer
Posted on July 22, 2011 at 09:04
Hi,
I have the following problem. I have a RFID-Reader Chips from Melexis (90109) connected to two GPIO Pins (Clock and Data). I process the incoming data with an EXTI handler that is triggert on the falling edge of the clock pin. This works fine. To detect if a transponder has left the field I must detect if the clock line is no longer atcive for a certain amount of time. My current approach is that I set up TIM2 as normal Timebase counter with an TIM_UPDATE IRQ-Handler as sort of watch dog for the clock line. In the EXTI handler I tried to reset TIM2 with TIM_SetCounter(TIM2, 0); so that as long as I receive clock pulses shorter than the timer period, the TIM2 Handler should not be called at all. If the clock stops, TIM2 handler should set a flag to signals the main loop that the transponder was removed. So far the idea, but reality shows that although I reset the TIM2 counter regulary I always get the TIM2 IRQ in it's normal period. Do I have to reset/restart a timer in a different way? Best Tom