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

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2020-07-15 at 12:15 -0300, Dr. Rolf Jansen wrote:
> > BTW: the following looks strange:
> > 
> > 
https://github.com/freebsd/freebsd/blob/b2d136be8c26e5efaf82b7bb25432207a682e250/sys/dev/iicbus/ds3231.c#L526
> > 6 <https://github.com/freebsd/freebsd/blob/b2d136be8c26e5efaf82b7bb
> > 25432207a682e250/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

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 
and the datasheet says they only handle leap years correctly through
2099.

> 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 = 0x3f.

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.

-- Ian




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ede9edaf4638ba5d8e8bcb75662bf9c096e5e39.camel>