Skip to content

machine.RTC.datetime() seconds change out of sync with subseconds rollover #10122

Discussion options

You must be logged in to vote

Thank you for the observation. The problem is by design and cannot be fixed. The MIMXRT10xx RTC module does not have a subsecond counter. It is emulated in the software, by taking the ticks_us64() counter with an offset. The offset is remembered when the time is set with datetime(). So there are two inherent problems:

  • the clock sources for RTC and ticks_us64() are different. Even with both being crystal based there will be a drift over time.
  • the values of the counters are taken at different times. The action not atomic. So there is a skew between the two, which is best about 1 ms, as you can see in your report.

The only alternative to the actual approach is not providing a subsecond rea…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@JuhaS2
Comment options

@robert-hh
Comment options

Answer selected by JuhaS2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants