Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 2019 15:57:14 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Stefan Parvu <sparvu@kronometrix.org>, freebsd-arm@freebsd.org
Subject:   Re: Rasclock (PCF2127 ) Hardware Clock FreeBSD 12.0
Message-ID:  <790afcb5f0809a89b45982958a85f1539fec05c7.camel@freebsd.org>
In-Reply-To: <74E3E782-8481-4B5B-A0AF-A04590C27D6D@kronometrix.org>
References:  <41A4CA5C-B487-490F-8A19-2D51F43E1004@kronometrix.org> <95616620-bbaf-dbc3-49eb-3e2562638d49@bunyatech.com.au> <AB510253-52D9-469C-B06E-5EC73C5F188E@kronometrix.org> <fd9991c4e6aaccb812a59ff86c9c8564ebd1d767.camel@freebsd.org> <74E3E782-8481-4B5B-A0AF-A04590C27D6D@kronometrix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2019-07-15 at 18:46 +0300, Stefan Parvu wrote:
> Another comment: these 3 Rasclocks are ver 4.0, they been used on Raspbian
> for some time back but they have been off for some good months, except one. I 
> changed the batteries on all of them. All of them behave the same on FBSD 12.0.
> 
> Stefan Parvu
> sparvu@kronometrix.org
> 

Okay, this should be fixed as of r350016.

It turns out the PCF2129 chip isn't fully compliant with the i2c
spec... an obscure footnote in the datasheet mentions that it doesn't
support i2c repeat-start operations.  Back when I originally wrote and
tested the driver I was using an rpi for testing, and the rpi i2c
driver didn't support repeated-start, it just silently turned them into
a stop-then-start.

Some time last year, I fixed the rpi i2c driver to handle repeat-start
properly, and at that point the nxprtc driver would have stopped
working because I had missed that footnote when I first wrote it.  Now
the nxprtc driver doesn't try to do repeat-start transactions, and it
should work right on all boards.

Another thing I noticed is that the rpi dtbo file activates a PCF2127
chip, so the driver was trying to treat that 2129 as if it were a 2127.
The major difference between the models is that the 2129 doesn't have a
sub-second countdown timer for better resolution.  So that should have
made the 2129 fail on an rpi after I fixed the repeat-start thing, but
it didn't fail, it just worked fine.  It turns out the 2129 chip has
the countdown timer hardware too, even though the datasheet says it
doesn't.  You just can't use it to toggle an output pin or trigger an
interrupt.  But our driver only uses it to read the sub-second time.

So I made that less accidental; the driver now treats the 2127 and 2129
the same, and gets .015 second resolution on both of them.

-- Ian





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