Problem with PCF8563 RTC on Raspberry

Bernd Walter ticso at cicely7.cicely.de
Mon Feb 4 11:02:34 UTC 2019


On Mon, Feb 04, 2019 at 11:38:13AM +0100, Bernd Walter wrote:
> On Mon, Feb 04, 2019 at 11:28:25AM +0100, Bernd Walter wrote:
> > On Mon, Feb 04, 2019 at 10:44:34AM +0100, Emmanuel Vadot wrote:
> > > On Mon, 4 Feb 2019 10:08:54 +0100
> > > Bernd Walter <ticso at cicely7.cicely.de> wrote:
> > > 
> > > > I'm trying to get the RTC on a Waveshare ARPI600 module running on a
> > > > Raspberry Pi B.
> > > > This is the Overlay I'm using:
> > > > /dts-v1/;
> > > > /plugin/;
> > > > 
> > > > &i2c0 {
> > > > 	 status = "okay";
> > > > 	  
> > > > 	  rtc: rtc at 51 {
> > > > 		  compatible = "nxp,pcf8563";
> > > > 		  reg = <0x51>;
> > > > 	  };
> > > > };
> > > > 
> > > > IICbus gets probed during boot:
> > > > iicbus0: <OFW I2C bus> on iichb0
> > > > iic0: <I2C generic I/O> on iicbus0
> > > > iicbus0: <unknown card> at addr 0xa2
> > > > 
> > > > When I load the nxprtc moduele I get the following error:
> > > > nxprtc0: <NXP PCF8563 RTC> at addr 0xa2 on iicbus0
> > > > nxprtc0: cannot set up timer
> > > > 
> > > > I wonder if I miss something, e.g. setting GPIO.
> > > > However, for spi0 no GPIO setup was required and the overlay looks
> > > > quite similar.
> > > 
> > >  Looking at the code it means that the driver didn't managed to talked
> > > to the chip via i2c, the start_timer function is the first time that
> > > i2c transfer is happening.
> > 
> > That's my understanding of the situation as well.
> > 
> > >  Could be either pinmux problems or frequency (default is 100khz so it
> > > should work ok). 
> > >  What pin are you using to connect to the module ?
> > 
> > Good point.
> > It is connected to Pin3/5.
> > Signals scoped turn out that they stay high.
> > Pinout diagram show that the Pins are named SDA1/SCL1, so probably I'm
> > just using the wrong controller.
> > Will give it a test on i2c1 instead.
> 
> Yes, that was exactly the problem:
> nxprtc0: <NXP PCF8563 RTC> at addr 0xa2 on iicbus0
> nxprtc0: WARNING: RTC battery failed; time is invalid
> nxprtc0: registered as a time-of-day clock, resolution 0.015625s
> 
> And, after putting it into loader.conf to be active on kernel start:
> Setting date via ntp.
>  4 Feb 11:34:31 ntpdate[727]: step time server 94.130.184.193 offset -0.120565 sec
> Excellent, it kept time during reboot.
> 
> But not after power loss.
> Mmmm.
> Have to check if the battery is good.

Wow - this is unbelieveable and unexpected.
They use 1N4148 diodes to drive the IC (RTC_VDD) from either the battery
or the main supply.
However, they use the supply rail to drive 1k IIC pull ups, so the battery
gets drained into the Raspberry via the resistors.
At 3V this would be 6mA current.
That poor little CR1220 drops below 1V.
Even if the volatge would stay high enough, the battery has 40mAh and would
be empty in less then a day.
The DVK512 board has the same issue.

> > >  Also it seems that the overlay i2c-rtc.dtbo from the Rpi fundation
> > > list this module but I'm unsure how to use this overlay. It is
> > > installed via the rpi-firmware package.

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.


More information about the freebsd-arm mailing list