cancel
Showing results for 
Search instead for 
Did you mean: 

losing some isr

papageno
Associate III

Hello dear experts,

I am using the TIMER2 on stm32F446Re with TI1_ED as reset mode input and TIM2_CH4 as timer value capture input. I inserted code to toggle a gpio in the HAL_TIM_IC_callback. On the scope I am capturating the TIM2_IC4 signal and the ISR (callback) generated toggled signal. Between two TI1_ED event , I should have around 100 IC captured signal but I can see that not all input signals produce an ISR. Looks like I am missing some ISR. The reset mode input is a video frequency (let's say 24fps) and the capture TIM2_IC4 (channel4) is 2.4Khz. I dont understand why I am losing some ISR ? What could explain that behavior ? 2400hz is not such a high frequency. The ISR checks the timer and the channel number and send a 32bits on the uart using DMA. All the involved timings do not appear so difficult to process especially for a 90Mhz timer and proc.

Any suggestion for anybody ? Weakness of the signal (needs pull-ups ?? ), level of priority and preemption for signal ?

Thanks in advance.

Pap

2 REPLIES 2
Ozone
Lead

Interrupts get delayed by running interrupts of equal priority, oar arriving interrupts of higher priority.

Cube is (in-)famous for busy-waits and convoluted interrupt code. Especially check callbacks, they are executed in interrupt context.

Consider rasing the priority of the timer interrupt.

> I dont understand why I am losing some ISR ? What could explain that behavior ? 2400hz is not such a high frequency. The ISR checks the timer and the channel number and send a 32bits on the uart using DMA. All the involved timings do not appear so difficult to process especially for a 90Mhz timer and proc.

You could do a simple verification. Apply a known number of input pulses, and count them in the handler.

If your troubles are caused by coincidental interrupt overlapping, you might need a larger number of test pulses.

And, as usual, with toggling different GPIO lines in differernt interrupts, you could visualize the timing behavior, using a scope or logic analyzer.

papageno
Associate III

thanks Ozone,

I tried all the things you proposed but i still miss some IRQ . I put a gpio low and up in the root of the TIM IRQ (TIM2_IRQHandler) to try to bypass the HAL extra code but I do not even enter that ISR.... very strange. i still miss 10ù of the IRQ. I also ried to put the TIM2 to a highest sub priority but it is the same. It s very amazing... the most disturbing is that I do not understand why I miss those irq. From the scope the IC signal looks good (11µs negative pulse level 3.3v at 2.4Khz).

i will dig a little more that problem, tickling my curiosity now.

Paps