cancel
Showing results for 
Search instead for 
Did you mean: 

Noob doubt: Is a timer clock frequency relevant for input edge detection?

BrMel10
Associate

Hi everyone,

I am trying to implement a system that counts pulses that can be as narrow as 20 nanoseconds using an STM32F746 MCU clocked at its max 216MHz.

The first thought was: "Can such narrow pulse even be detected by the MCU?"

To confirm, and inspired by this query: "minimum-pulse-width-sensed-by-the-gpio-of-the-stm32", I grabbed the datasheet and looked for "tEXTIpw" which for the STM32F746 is 10ns. So, looks we are fine here.

 

Then the implementation approach: Use a timer to count the rising edges of each pulse. "But which Timer?" Since the STM32f746 has two APB buses with different max clock frequencies, I thought: "Lets use a timer hanging on the APB with the higher frequency so that the timer can sample the pulse line at a higher rate"

 

But then the real noob doubt kicked in: "Is a timer clock frequency even relevant for input edge detection?"

I can imagine two possible answers:

  • Yes, the timer clock freq. is relevant. And for the timer is clocked at 216MHz one can fail to detect pulses narrower than 4.6 ns [4.6 ns = 1/216MHz] (not considering the 10ns minimum pulse width)
  • No, the timer clock freq. is not relevant. The edge detection works in a kind of analog way. There is no sampling rate involved and as soon as the pulse goes above a certain amplitude, the rising edge is detected.

Regardless of whether any of the previous two options is correct I could not find the confirmation in the STM32F746 datasheet and Ref. Manual.

So, could someone please clarify this noob doubt? And, if possible, point me in the direction of the documentation where the answer can be found? (What to look for? And which doc?)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello @BrMel10 

You can check AN4776 from 2.3 to 2.6 sections  

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Bob S
Principal

Minimum EXTI pulse width and timer operation have nothing to do with each other.  The timers are all synchronous circuitry.  You would be using your signal as an "external clock" for the timer.  That external clock needs to be synchronized with the timer's internal clock.  So that limits the minimum pulse you can detect to the timer's frequency (not the BUS frequency, the timer freq).

Sarra.S
ST Employee

Hello @BrMel10 

You can check AN4776 from 2.3 to 2.6 sections  

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

BrMel10
Associate

Both previous answers were useful and would mark both as "Accept as Solution" if I could.
Thank you!