delay when detecting edge with ic_pal

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

delay when detecting edge with ic_pal

Jump to solution
998 Views
chenk
Contributor II

Hello Everyone,

I am trying to use the ic_pal module to trigger an interrupt when detecting a falling edge. To check my work, I am toggling an output pin in the ISR handling the interrupt and using a logic analyzer to visualize the captured event. This way I can estimate how accurately I can react to such event. Most of the time, this works sufficiently fast, but often there are delays that are significant for my application.

The minimum expected timespan between two falling edges is 4 microseconds. I can see consistent delay (averaging ~2.3 microseconds) when reacting to a falling edge after a long run of no edges. When edges are more frequent (and rather fixed) the delay is very small and stable (a few hundreds of nanoseconds). Attached are screenshots from the logical analyzer that illustrate both cases (purple is the digital input and blue is the output pin).

I would appreciate help understanding what could cause this behavior. I assumed there would be an overhead of the interrupt handler, but it seems small and insignificant some of the time. Could this be due to some other abstraction of the ic_pal? Could I use the eMIOS driver directly to trigger an interrupt on edge?

Platform is DEVKIT-MPC5748G

ic_pal is configured over eMIOS for falling edge detection.

Thanks and best regards, Chen

0 Kudos
1 Solution
990 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

on "nodelay" picture you measure delay from rising edge, from falling edge it will be about 2us again, i think.
Typical interrupt latency (event till isr routine) will be around 1us min, so the delay you see is most probably due to further SW overhead. The EMIOS driver can be used directly, there should be also emios_ic demo example you can refer to.

BR, Petr

View solution in original post

0 Kudos
2 Replies
991 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

on "nodelay" picture you measure delay from rising edge, from falling edge it will be about 2us again, i think.
Typical interrupt latency (event till isr routine) will be around 1us min, so the delay you see is most probably due to further SW overhead. The EMIOS driver can be used directly, there should be also emios_ic demo example you can refer to.

BR, Petr

0 Kudos
986 Views
chenk
Contributor II

Hi Petr,

I shouldn't work so late You're of course right, I have misinterpreted the logic analyzer output. 

Thank you for your help.

Chen

0 Kudos