Timing Between Events - Guaranteeing Catching the CNT Register
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-28 06:02 AM
Posted on October 28, 2013 at 14:02
Using an STM32F407
I am using a timer to capture the time between two TRGI events. It is set to reset every trigger in event. In my current code, the ISR for the TRGI event reads the CNT value to determine this value.This seems like it will be a race condition. Is there a better way to guarantee that I will get this value every time? #trigger #stm32f4 #timer
Labels:
- Labels:
-
STM32F4 Series
-
TIM
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-28 06:21 AM
Posted on October 28, 2013 at 14:21
Generally you'd want to latch values in CCRx registers, as CNT keeps ticking, and interrupt latency can be somewhat variable.
There are other gated modes to control the timer, and you could perhaps read the CNT via DMA.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-28 09:58 AM
Posted on October 28, 2013 at 17:58
Thanks Clive,
I ended up using CC1 in IC mode set up to use TRC as the trigger. I am checking the value in an ISR. This seems to be working well initially.