cancel
Showing results for 
Search instead for 
Did you mean: 

Sample a timer on EXTI interrupt

justin239955_st
Associate III
Posted on August 12, 2013 at 20:35

Hi,

I want to sample a fast timer (125ns) when an EXTI interrupt occurs, before the interrupt is handled. Later when the interrupt is handled i want to be able to compare the actual value of the same timer and measure the interrupt latency.

How do i setup the capture of the timer after the exti is fired?

Should I use DMA?

I don't need code, only the general concept...

Thanks to all helper on this forum 🙂

#interrupt #stm32 #timer #exti
6 REPLIES 6
Posted on August 12, 2013 at 21:21

Use a timer in input capture mode, it will latch the timebase into the channel register. ie CCR2 = CNT, then read CNT in the interrupt handler for the pin configured in EXTI mode.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
justin239955_st
Associate III
Posted on August 12, 2013 at 22:26

Yes thanks.

Then i don't need to use the exti interrupt, i could just use the interrupt of the input capture...

justin239955_st
Associate III
Posted on August 12, 2013 at 22:27

Yes thanks.

Then i don't need to use the exti interrupt, i could just use the interrupt of the input capture...

Posted on August 12, 2013 at 22:34

Would likely work either way. Not sure if the filtering/synchronization would change the latency.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
justin239955_st
Associate III
Posted on August 12, 2013 at 22:38

Another question since you're there 🙂

Can a pin, says B6 be configured as an input for both an input capture and an exti interrupt at the same time?

Posted on August 12, 2013 at 22:47

On which part?

I haven't tried it myself, but given the way such structures can be built I'm apt to believe the output from the input pad's schmitt trigger is available to the EXTI mux regardless of what other peripheral it's attached too.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..