DRAgon715205
Posts: 118
Joined: Wed Apr 02, 2014 11:46 am

PI2 RTC can't work PCF8563

Sat Feb 14, 2015 10:20 am

Hi People
I get a Pi2 . my RTC is pcf8563. it can work fine at my B+ . but can't work fine at my PI2

MY CODE:
root@raspberrypi:/home/pi# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

root@raspberrypi:/home/pi# modprobe i2c-dev
root@raspberrypi:/home/pi# echo pcf8563 0x51 > /sys/class/i2c-adapter/i2c-1/new_device
root@raspberrypi:/home/pi# hwclock -r
hwclock: select() to /dev/rtc0 to wait for clock tick timed out: No such file or directory

who can tell me Why I can find "/dev/rtc0 " at B+ But can't find it at PI2?

User avatar
mikronauts
Posts: 2823
Joined: Sat Jan 05, 2013 7:28 pm

Re: PI2 RTC can't work PCF8563

Sat Feb 14, 2015 2:45 pm

I ran into this problem too, without a resolution. I was pointed at the new device tree documentation.

My best guess is that the source for hwclock has not been updated.

I wrote some python code to read/set the RTC, I'll post it on my site once I clean it up.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
Paul Webster
Posts: 860
Joined: Sat Jul 30, 2011 4:49 am
Location: London, UK

Re: PI2 RTC can't work PCF8563

Sat Feb 14, 2015 4:04 pm

You could try disabling Device Tree ... with device_tree= in config.txt
However, RPF states this this work around might not be kept for the future ... so proper solution may well be to ensure that the correct DT is loaded and then take a look to see which devices appear

https://github.com/raspberrypi/document ... ce-tree.md

User avatar
mikronauts
Posts: 2823
Joined: Sat Jan 05, 2013 7:28 pm

Re: PI2 RTC can't work PCF8563

Sat Feb 14, 2015 4:17 pm

Thank you, I'll take a look.

On my previous try, I found /dev/rtc0 without issues, but even specifying /dev/rtc0 to hwclock it still hung.

I ended up writing Python code to set the RTC from the system time, and another script to read it back.

Now I just have to finish the part that sets the system time from what I read back from the RTC :)
Paul Webster wrote:You could try disabling Device Tree ... with device_tree= in config.txt
However, RPF states this this work around might not be kept for the future ... so proper solution may well be to ensure that the correct DT is loaded and then take a look to see which devices appear

https://github.com/raspberrypi/document ... ce-tree.md
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

DRAgon715205
Posts: 118
Joined: Wed Apr 02, 2014 11:46 am

Re: PI2 RTC can't work PCF8563

Sat Feb 14, 2015 4:47 pm

Changing the Device Tree seem to don't change anything!!

I think I just can wait it to update the hwclock

DRAgon715205
Posts: 118
Joined: Wed Apr 02, 2014 11:46 am

Re: PI2 RTC can't work PCF8563

Sat Feb 14, 2015 4:48 pm

I hope someone to update the hwclock to work at the PI2

apelizza
Posts: 1
Joined: Fri Feb 27, 2015 3:37 pm

Re: PI2 RTC can't work PCF8563

Fri Feb 27, 2015 3:40 pm

Does someone have found a solution to this problem? I've got a pcf8563 and I don't know how to keep it working with the new pi2 with raspbian.

MrBool
Posts: 145
Joined: Sat Jul 05, 2014 9:51 am

Re: PI2 RTC can't work PCF8563

Sat Mar 28, 2015 2:46 pm

I have the some problem with Raspberry Compute Module. Does someone have found a solution?

pykoon
Posts: 2
Joined: Sat Mar 28, 2015 8:08 pm

Re: PI2 RTC can't work PCF8563

Sat Mar 28, 2015 8:11 pm

I have the same problem since my last update in march.

As saw there is no solution... So bad. :cry: :cry: :cry: :cry:

DirkS
Posts: 10867
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: PI2 RTC can't work PCF8563

Sun Mar 29, 2015 10:27 am

pykoon wrote:I have the same problem since my last update in march.

As saw there is no solution... So bad. :cry: :cry: :cry: :cry:
Exactly what is not working? Did you set up the RTC by adding

Code: Select all

dtparam=i2c
dtoverlay=i2c-rtc,pcf8563
to /boot/config.txt.
You may also have to add

Code: Select all

i2c-dev
to /etc/modules

MrBool
Posts: 145
Joined: Sat Jul 05, 2014 9:51 am

Re: PI2 RTC can't work PCF8563

Sun Mar 29, 2015 7:29 pm

The reason is hwclock from util-linux.
I download, compile and install latest version of util-linux and hwclock works fine, but after reboot I can't login.
So solution will be new util-linux package.

pykoon
Posts: 2
Joined: Sat Mar 28, 2015 8:08 pm

Re: PI2 RTC can't work PCF8563

Sat Apr 04, 2015 9:03 pm

MrBool, Could you explain how do you rebuilt util-linux on raspberry?
It seem to be hard no?

Tx,

MrBool
Posts: 145
Joined: Sat Jul 05, 2014 9:51 am

Re: PI2 RTC can't work PCF8563

Thu Apr 09, 2015 7:06 am

Build util-linux on raspberry is easy. Here is build procedure for hwclock. If you want build all util-linux change "make hwclock" to "make".

Code: Select all


wget https://www.kernel.org/pub/linux/utils/util-linux/v2.26/util-linux-2.26.1.tar.gz

tar zxvf util-linux-2.26.1.tar.gz

cd util-linux-2.26.1

apt-get install gcc

./configure --without-python --without-systemd --without-ncurses 

make hwclock

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6400
Joined: Fri Jul 29, 2011 5:36 pm

Re: PI2 RTC can't work PCF8563

Thu Apr 16, 2015 5:58 pm

Upgrading hwclock does not fix the issue, it just hides it:

Code: Select all

pi@test-pi ~/temp $ tar zxf util-linux-2.26.1.tar.gz
pi@test-pi ~/temp $ cd util-linux-2.26.1/
pi@test-pi ~/temp/util-linux-2.26.1 $ ./configure --without-python --without-systemd --without-ncurses  > /dev/null
configure: WARNING: ncurses or slang library not found; not building cfdisk
configure: WARNING: libcap-ng library not found; not building setpriv
configure: WARNING: PAM header file not found; not building chfn_chsh
configure: WARNING: PAM header file not found; not building login
configure: WARNING: PAM header file not found; not building su
configure: WARNING: PAM header file not found; not building runuser
configure: WARNING: ncurses or ncursesw library not found; not building pg
configure: WARNING: ncurses library not found; not building setterm
configure: WARNING: libpython not found; not building pylibmount
pi@test-pi ~/temp/util-linux-2.26.1 $ make hwclock > /dev/null
pi@test-pi ~/temp/util-linux-2.26.1 $ sudo ./hwclock -r
Thu 16 Apr 2015 17:57:07 UTC  .983229 seconds
pi@test-pi ~/temp/util-linux-2.26.1 $ sudo ./hwclock -r -D
hwclock from util-linux 2.26.1
Using the /dev interface to the clock.
Last drift adjustment done at 1429205484 seconds after 1969
Last calibration done at 1429205484 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
select() to /dev/rtc0 to wait for clock tick timed out...synchronization failed
pi@test-pi ~/temp/util-linux-2.26.1 $ 
Edit: actually, the warning is a red herring. viewtopic.php?f=28&t=97257&start=25#p730378

I'll keep digging.

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6400
Joined: Fri Jul 29, 2011 5:36 pm

Re: PI2 RTC can't work PCF8563

Thu Apr 16, 2015 6:51 pm

...there it is!

hwclock-rtc.c:311

Code: Select all

			rc = select(rtc_fd + 1, &rfds, NULL, NULL, &tv);
			ret = 1;
			if (rc == -1)
				warn(_("select() to %s to wait for clock tick failed"),
				     rtc_dev_name);
			else if (rc == 0 && debug)
				printf(_("select() to %s to wait for clock tick timed out"),
				     rtc_dev_name);
			else
				ret = 0;
In both cases, select times out and returns 0. When you run it without -D, the 'else' path is taken and the function returns success. If you run with -D, the else if (rc == 0 && debug) condition is met and the 'else' doesn't run, leaving ret == 1!

Edit: let's see what happens https://bugs.debian.org/cgi-bin/bugrepo ... bug=782726
Edit 2: http://thread.gmane.org/gmane.linux.uti ... x-ng/11187
https://git.kernel.org/cgit/utils/util- ... bd5c5a51dc

j03r6
Posts: 1
Joined: Tue May 26, 2015 11:19 pm

Re: PI2 RTC can't work PCF8563

Tue May 26, 2015 11:32 pm

ShiftPlusOne, I think that's more a problem of hwclock-rtc.c:269 which should fail with the pcf 8563, because it's an i2c and has no interrupts.
But I have no idea how or where to fix that.

For a quick and dirty test hack I just changed 271 to make the condition always true:

Code: Select all

if (1 || rc == -1 && (errno == ENOTTY || errno == EINVAL)) {
And succeeded:

Code: Select all

pi@raspi ~/util-linux-2.26.1 $ sudo ./hwclock -Dr
hwclock from util-linux 2.26.1
Using the /dev interface to the clock.
Last drift adjustment done at 1432675502 seconds after 1969
Last calibration done at 1432675502 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
/dev/rtc0 does not have interrupt functions. Waiting in loop for time from /dev/rtc0 to change
...got clock tick
Time read from Hardware Clock: 2015/05/26 23:29:37
Hw clock time : 2015/05/26 23:29:37 = 1432682977 seconds since 1969
Time since last adjustment is 7475 seconds
Calculated Hardware Clock drift is 0.000000 seconds
Mit 27 Mai 2015 01:29:36 CEST  .864657 seconds

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6400
Joined: Fri Jul 29, 2011 5:36 pm

Re: PI2 RTC can't work PCF8563

Wed May 27, 2015 1:25 pm

I think there are multiple problems and the fact that hwclock failed to report an error was one of them. The next is why it doesn't work in the first place. I don't think that problem is in hwclock, I think it's in the driver, since it works properly with other devices. Looking into it is at the bottom of a long todo list.

uxc
Posts: 5
Joined: Thu Jul 31, 2014 12:01 pm

Re: PI2 RTC can't work PCF8563

Mon Jun 15, 2015 5:34 pm

It looks like the problem has been resolved.

Code: Select all

sudo apt-get update 
sudo apt-get install util-linux
hwclock from util-linux 2.25.2 works fine with pcf8563.

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6400
Joined: Fri Jul 29, 2011 5:36 pm

Re: PI2 RTC can't work PCF8563

Mon Jun 15, 2015 5:49 pm

uxc wrote:It looks like the problem has been resolved.

Code: Select all

sudo apt-get update 
sudo apt-get install util-linux
hwclock from util-linux 2.25.2 works fine with pcf8563.
No, it hasn't.

User avatar
mikronauts
Posts: 2823
Joined: Sat Jan 05, 2013 7:28 pm

Re: PI2 RTC can't work PCF8563

Sun Jul 05, 2015 4:22 am

Is there any news on this?

In case there is not, I have written (and I am now testing)

setrtc.py - sets PCF8563 to current system time
getrtc.py - sets current system time from PCF8563

As soon as I am satisfied that there are no multi-legged creatures left in my code I'll upload it to my Pi Rtc Dio product page (which has a PCF8563 and two MCP23017's on it, thus my interest in this thread)

http://www.mikronauts.com/raspberry-pi/pi-rtc-dio/
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6400
Joined: Fri Jul 29, 2011 5:36 pm

Re: PI2 RTC can't work PCF8563

Sun Jul 05, 2015 4:59 am

I haven't looked at it in a while, but I doubt anything has changed.

Houtkamp
Posts: 8
Joined: Wed Dec 18, 2013 6:50 pm

Re: PI2 RTC can't work PCF8563

Mon Jul 06, 2015 6:06 pm

Has anyone found a way to make the RTC work? Mine says no such file or directory.

sudo i2cdetect -y 1
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

Is somebody working on it, or is it just another lost cause?

THANKS

Bill

User avatar
DougieLawson
Posts: 42483
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: PI2 RTC can't work PCF8563

Mon Jul 06, 2015 6:24 pm

You'd not enabled the i2c overlay or a specific RTC overlay in /boot/config.txt. Take a look at /boot/overlays/README.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6400
Joined: Fri Jul 29, 2011 5:36 pm

Re: PI2 RTC can't work PCF8563

Tue Jul 07, 2015 6:29 am

That particular error is a result of not having i2c-dev loaded.

jackbrux
Posts: 3
Joined: Mon Jun 08, 2015 6:46 pm

Re: PI2 RTC can't work PCF8563

Wed Jul 29, 2015 1:54 pm

Any update on this? I tried everything online to get my pcf8563 to work with my B+, keep getting this error using hwclock --debug:

Code: Select all

Waiting for clock tick...
hwclock: select() to /dev/rtc0 to wait for clock tick timed out: No such file or directory
...synchronisation failed

Return to “Troubleshooting”