Date: Wed, 15 Jul 2020 09:52:52 -0300 From: Dr. Rolf Jansen <freebsd-rj@obsigna.com> To: freebsd-arm@freebsd.org Subject: DS3231 on BeagleBone Black with FreeBSD 13-CURRENT exactly 20 h off backwards Message-ID: <3BE2A8B4-AD53-4DFE-8C38-D5BB4063CFE9@obsigna.com>
next in thread | raw e-mail | index | archive | help
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=3D11), 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/b2d136be8c26e5efaf82b7bb25432207a6= 82e250/sys/dev/iicbus/ds3231.c#L526 = <https://github.com/freebsd/freebsd/blob/b2d136be8c26e5efaf82b7bb25432207a= 682e250/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=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BE2A8B4-AD53-4DFE-8C38-D5BB4063CFE9>