-
- Posts: 118
- Joined: Wed Apr 02, 2014 11:46 am
PI2 RTC can't work PCF8563
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?
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?
- mikronauts
- Posts: 2823
- Joined: Sat Jan 05, 2013 7:28 pm
Re: PI2 RTC can't work PCF8563
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.
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
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi
- Paul Webster
- Posts: 860
- Joined: Sat Jul 30, 2011 4:49 am
- Location: London, UK
Re: PI2 RTC can't work PCF8563
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
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
- mikronauts
- Posts: 2823
- Joined: Sat Jan 05, 2013 7:28 pm
Re: PI2 RTC can't work PCF8563
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
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
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi
-
- Posts: 118
- Joined: Wed Apr 02, 2014 11:46 am
Re: PI2 RTC can't work PCF8563
Changing the Device Tree seem to don't change anything!!
I think I just can wait it to update the hwclock
I think I just can wait it to update the hwclock
-
- Posts: 118
- Joined: Wed Apr 02, 2014 11:46 am
Re: PI2 RTC can't work PCF8563
I hope someone to update the hwclock to work at the PI2
Re: PI2 RTC can't work PCF8563
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.
Re: PI2 RTC can't work PCF8563
I have the some problem with Raspberry Compute Module. Does someone have found a solution?
Re: PI2 RTC can't work PCF8563
I have the same problem since my last update in march.
As saw there is no solution... So bad.

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




Re: PI2 RTC can't work PCF8563
Exactly what is not working? Did you set up the RTC by addingpykoon wrote:I have the same problem since my last update in march.
As saw there is no solution... So bad.![]()
![]()
![]()
Code: Select all
dtparam=i2c
dtoverlay=i2c-rtc,pcf8563
You may also have to add
Code: Select all
i2c-dev
Re: PI2 RTC can't work PCF8563
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.
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.
Re: PI2 RTC can't work PCF8563
MrBool, Could you explain how do you rebuilt util-linux on raspberry?
It seem to be hard no?
Tx,
It seem to be hard no?
Tx,
Re: PI2 RTC can't work PCF8563
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
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6400
- Joined: Fri Jul 29, 2011 5:36 pm
Re: PI2 RTC can't work PCF8563
Upgrading hwclock does not fix the issue, it just hides it:
Edit: actually, the warning is a red herring. viewtopic.php?f=28&t=97257&start=25#p730378
I'll keep digging.
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 $
I'll keep digging.
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6400
- Joined: Fri Jul 29, 2011 5:36 pm
Re: PI2 RTC can't work PCF8563
...there it is!
hwclock-rtc.c:311
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
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;
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
Re: PI2 RTC can't work PCF8563
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:
And succeeded:
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)) {
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
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6400
- Joined: Fri Jul 29, 2011 5:36 pm
Re: PI2 RTC can't work PCF8563
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.
Re: PI2 RTC can't work PCF8563
It looks like the problem has been resolved.
hwclock from util-linux 2.25.2 works fine with pcf8563.
Code: Select all
sudo apt-get update
sudo apt-get install util-linux
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6400
- Joined: Fri Jul 29, 2011 5:36 pm
Re: PI2 RTC can't work PCF8563
No, it hasn't.uxc wrote:It looks like the problem has been resolved.
hwclock from util-linux 2.25.2 works fine with pcf8563.Code: Select all
sudo apt-get update sudo apt-get install util-linux
- mikronauts
- Posts: 2823
- Joined: Sat Jan 05, 2013 7:28 pm
Re: PI2 RTC can't work PCF8563
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/
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
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6400
- Joined: Fri Jul 29, 2011 5:36 pm
Re: PI2 RTC can't work PCF8563
I haven't looked at it in a while, but I doubt anything has changed.
Re: PI2 RTC can't work PCF8563
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
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
- 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
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.
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.
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6400
- Joined: Fri Jul 29, 2011 5:36 pm
Re: PI2 RTC can't work PCF8563
That particular error is a result of not having i2c-dev loaded.
Re: PI2 RTC can't work PCF8563
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