PROBLEM WITH TIME IN STM32F2 SERIES
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 9:25 AM
Hey guys.
I'm working with an ultra sound piece for measuring the distance.
When i set the timer1 to count every 1 ms it works(i set PSC 59999 and ARR 1000 to get 1 second with 120M cpu clock.).
But when i set the PSC 11 and ARR 1 to get a 0.1 us interrupt its not correct and it doesn't count correctly.
Do you know what is the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-22 4:58 AM
ARR defaults to its max value. So if you don't do anything to it, the counter and roll to ffff and then 0.
Those mcus may have different constructs but the basic principles are the same, as long as you stay away from the libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-22 8:31 AM
But when i set the ARR 0 the CNT does not count anymore!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-22 8:37 AM
No doubt, because the range of CNT is 0 to ARR inclusive
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-22 9:03 AM
Yes but that requires arr to be explicitly set to 0. If you do so, there must be a valid reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-22 1:43 PM
] I use cube mx so in the TIM_init the ARR is set to 0.
Thanks guys for help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-22 2:11 PM
That would seem to be a bug on the part of cube.

- « Previous
-
- 1
- 2
- Next »