Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jul 2020 18:12:48 -0300
From:      "Dr. Rolf Jansen" <freebsd-rj@obsigna.com>
To:        Ian Lepore <ian@freebsd.org>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: DS3231 on BeagleBone Black with FreeBSD 13-CURRENT exactly 20 h off  backwards
Message-ID:  <E777491D-C98F-49A8-AE1D-776D2C8DBC31@obsigna.com>
In-Reply-To: <4ede9edaf4638ba5d8e8bcb75662bf9c096e5e39.camel@freebsd.org>
References:  <3BE2A8B4-AD53-4DFE-8C38-D5BB4063CFE9@obsigna.com> <CECBFBC7-6C63-4762-9A55-BE84DA53BBD2@obsigna.com> <4ede9edaf4638ba5d8e8bcb75662bf9c096e5e39.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> Am 19.07.2020 um 15:57 schrieb Ian Lepore <ian@freebsd.org>:
>=20
> On Wed, 2020-07-15 at 12:15 -0300, Dr. Rolf Jansen wrote:
>>> BTW: the following looks strange:
>>>=20
>>>=20
> =
https://github.com/freebsd/freebsd/blob/b2d136be8c26e5efaf82b7bb25432207a6=
82e250/sys/dev/iicbus/ds3231.c#L526
>>> 6 <https://github.com/freebsd/freebsd/blob/b2d136be8c26e5efaf82b7bb
>>> 25432207a682e250/sys/dev/iicbus/ds3231.c#L526>
>>>=20
>>> 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
>=20
> I overlooked this part of your message previously.  Actually, the =
value
> 0x100 is correct because the numbers here are expressed in bcd.  So 99
> years is 0x099 and 100 years is 0x100.  In practice, all this century
> rollover stuff is moot, because the next century rollover is =
2099->2100=20
> and the datasheet says they only handle leap years correctly through
> 2099.
>=20
>> DS3231_HOUR_MASK_24HR is definitely wrong, since this prevents the
>> setting of times above 20 h. Reading said data sheet, I am almost
>> sure, that DS3231_HOUR_MASK_24HR must be the same as
>> DS3231_HOUR_MASK_12HR =3D 0x3f.
>=20
> Actually, it looks like the entire problem is that I simply swapped =
the
> values for DS3231_HOUR_MASK_12HR and DS3231_HOUR_MASK_24HR when I =
added
> those constants.  Fixed in r363330.

It does work now. Thank you very much for fixing it that quickly.

I didn't recognize that the century rollover was done in BCD. You are =
correct of course. Sorry for the false alarm.

Stay healthy!

Best regards

Rolf=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E777491D-C98F-49A8-AE1D-776D2C8DBC31>