Noob doubt: Is a timer clock frequency relevant for input edge detection?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-14 7:56 AM
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?)
Solved! Go to Solution.
- Labels:
-
Documentation
-
STM32F7 Series
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-15 12:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-14 11:03 AM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-15 12:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 12:51 PM
Both previous answers were useful and would mark both as "Accept as Solution" if I could.
Thank you!
