The other source of the inaccuracy can be in clock frequency. I use 32 kHz
clock source, but this value cannot be properly represented by CONFIG_USEC_
PER_TICK, which I set to 31 (which is aproximately 32.25 kHz). But 32 kHz
clock source seems to be the only possible in iMXRT as others are to hight
(tens or hundreds of MHz) and can´t be represended by the timer prescaler
divider. Did anyone have similar problems when implementing tickless mode
for some platforms?

I ran into this same issue with some Atmel SAM parts (I forget which) and I think that there is some discussion in the README files somewhere.

I never really found a great solution.  Options that I though of:

- Change CONFIG_USEC_PER_TICK to CONFIG_TICK_FREQUENCY.  A frequency can be represented with an integer more accurately that can a time period.  32768Hz is exact where as 1/32768 sec = 0.000030517578125...  sec cannot be represented exactly in microseconds.

- Use some kind of internal, higher precision, accurate version of event time that is converted to and from the hardware clock time.

I didn't like either of these because the first would affect a lot of code and the second could be computationally expensive.


Reply via email to