2018-02-21 09: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?
2018-02-22 04: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.
2018-02-22 08:31 AM
But when i set the ARR 0 the CNT does not count anymore!
2018-02-22 08:37 AM
No doubt, because the range of CNT is 0 to ARR inclusive
2018-02-22 09:03 AM
Yes but that requires arr to be explicitly set to 0. If you do so, there must be a valid reason.
2018-02-22 01:43 PM
] I use cube mx so in the TIM_init the ARR is set to 0.
Thanks guys for help.
2018-02-22 02:11 PM
That would seem to be a bug on the part of cube.