Skip to main content
justin239955_st
Associate III
August 12, 2013
Question

Sample a timer on EXTI interrupt

  • August 12, 2013
  • 6 replies
  • 1937 views
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
This topic has been closed for replies.

6 replies

Tesla DeLorean
Guru
August 12, 2013
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
justin239955_st
Associate III
August 12, 2013
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
August 12, 2013
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...

Tesla DeLorean
Guru
August 12, 2013
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
justin239955_st
Associate III
August 12, 2013
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?

Tesla DeLorean
Guru
August 12, 2013
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..