AnsweredAssumed Answered

Problem with simultaneous QTMR interrupts

Question asked by Seimon Williams on Feb 28, 2019
Latest reply on Mar 5, 2019 by Seimon Williams

I'm using a QTMR to capture an input. But I've noticed that if I have both the Compare and Edge interrupts enabled then, if both interrupts happen very close together, sometimes one of them isn't processed in my ISR.


I've attached a sample code. I started with the MCUXpresso i.MX RT1050 qtmr_timer sample.

TMR3.Timer0 is the primary timer that is used to capture the input.

TMR3.Timer1 is simulating my external hardware that is generating interrupts approx every 100us. It's output pin is fed back into Timer0's input capture pin.

TMR3.Timer2 has the same period as Timer0, but has the output enabled for debug on the oscilloscope.


In the ISR, if the Compare flag is set then for debug I also toggle a GPIO pin - this should follow the Timer2 output pin.

I've noticed that this GPIO pin sometimes doesn't toggle, this always seems to be when the Edge and Compare happen very close together.


The attached png file shows the scope waveform. Overview at the top and zoomed-in in the main area.

Blue is the Input Trigger / Timer1 output.

Yellow is Timer2 output. At this point the Purple should have gone high, but didn't until the next Compare interrupt.


Is there something not right with my ISR, or is this a known behaviour of the QTMR interrupts / status flags?