This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timer not stopping through PPI

I am having a very strange problem with timers and the PPI channels.

I am trying to take a fixed number of ADC samples at 1 ms intervals starting at a fixed offset in time from the occurrence of an interrupt.  I set a PPI channel to start Timer 1 when the interrupt pin goes high.  There is a second PPI channel tying Timer 1 compare event 1 to the start task of Timer 2.

Timer 2 has a compare event at 1 ms with a PPI channel tied to the ADC start task and a short to clear the timer and thus reset.

This all works fine, and I get my samples.  The problem is that I am not able to stop Timer 2.  I tried using a PPI channel to another compare event on Timer 1 set to the end time for the samples and tying this to the Stop task for Timer 2, this is how I would like it to work.  I also tried using the ADC End event for this PPI channel.  I know I am getting the events, I have an interrupt handler with some debug messages to validate this but Timer 2 never stops.

Could the clear short on the Timer 2 event be preventing this timer from being stopped?  That doesn't make a lot of sense to me but I can't think of any other explanation.

If needed I could post some code but I would have to simplify it to show just this sequence of events.

Thanks,

Ted.

Parents
  • Maybe another Timer 1 compare Event 1 triggers again after a Timer 1 wrap-around; perhaps also try issuing a Stop and Clear  to timer 1 so that a wrap does not occur and Timer 1 then waits for a new interrupt transition of the trigger pin. This also assumes that the trigger pin does not issue repeated triggers; most interrupts on the nRF52 are level-sensitive not edge-sensitive, and if the trigger pin interrupt event is not cleared correctly in the handler it will re-trigger Timer 1 and hence Timer 2 for as long as the trigger pin stays high.

Reply
  • Maybe another Timer 1 compare Event 1 triggers again after a Timer 1 wrap-around; perhaps also try issuing a Stop and Clear  to timer 1 so that a wrap does not occur and Timer 1 then waits for a new interrupt transition of the trigger pin. This also assumes that the trigger pin does not issue repeated triggers; most interrupts on the nRF52 are level-sensitive not edge-sensitive, and if the trigger pin interrupt event is not cleared correctly in the handler it will re-trigger Timer 1 and hence Timer 2 for as long as the trigger pin stays high.

Children
No Data
Related