DS3231 on BeagleBone Black with FreeBSD 13-CURRENT exactly 20 h off backwards
Dr. Rolf Jansen
freebsd-rj at obsigna.com
Wed Jul 15 12:53:03 UTC 2020
I added a DS3231 module to the i2c2 bus of the BBB running 13-CURRENT. Everything work fine, except that when I set a time in the range of 20:00 to 24:00 UTC, then on starting up the RTC reports a date/time of exactly 20 hours off backwards. While, when I set a time in the range from 0:00 to 19:59 UTC, it would be correctly stored by the RTC.
Looking at the Maxim DS3231 datasheet (https://datasheets.maximintegrated.com/en/ds/DS3231.pdf#page=11), it might be that something gets mixed-up when setting bits 5 and 6 of the hours register. In the history of ds3231.c, I saw that 24 hour mode is not more forced anymore. Perhaps an unresolved ambiguity was introduced by this change.
BTW: the following looks strange:
https://github.com/freebsd/freebsd/blob/b2d136be8c26e5efaf82b7bb25432207a682e250/sys/dev/iicbus/ds3231.c#L526 <https://github.com/freebsd/freebsd/blob/b2d136be8c26e5efaf82b7bb25432207a682e250/sys/dev/iicbus/ds3231.c#L526>
This would add 256 instead of 100 when rolling over the century, really? On real world systems this will let to a Year-2100 problem, better we solve this quickly, since the time is running, and 80 years compares to nothing on the geologic time scale :-D
Best regards
Rolf
More information about the freebsd-arm
mailing list