RTC & hwclock Issues, Won't read from --show but the time is set via --debug. Help!
-
Hello,
I have been following the various online guides for getting the RTC module to work. I can see that the time is set via sudo hwclock --debug AND it is remaining via the battery as it has been off over multiple nights and the time in --debug has remained (and updated) correctly. I should also mention that the Pi is offline and has no internet connection.
The issue I am having is when I use sudo hwclock --show or any of the systohc / hctosys options the time wont show or set. The command just executes with no output.
Snippet from my /boot/config.txt file:
dtparam=i2c_arm=on dtparam=i2c_baudrate=400000 # Enable UniPi RTC chip dtoverlay=i2c-rtc,mcp7941x
My /etc/modules file:
i2c-dev i2c-bcm2708 mcp7941x
The appropriate lines are commented out in /lib/udev/hwclock-set
#if [ -e /run/systemd/system ] ; then # exit 0 #fi
The clock is detected and used via i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- UU 70: -- -- -- -- -- -- -- --
Output from dmesg | grep rtc:
[ 3.466915] rtc-ds1307 1-006f: rtc core: registered mcp7941x as rtc0 [ 3.466961] rtc-ds1307 1-006f: 64 bytes nvram
Finally, the output from sudo hwclock --debug:
hwclock from util-linux 2.25.2 Using the /dev interface to the clock. Last drift adjustment done at 1370473200 seconds after 1969 Last calibration done at 1370473200 seconds after 1969 Hardware clock is on UTC time Assuming hardware clock is kept in UTC time. Waiting for clock tick... /dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change ...got clock tick Time read from Hardware Clock: 2017/10/18 10:34:28
As you can see, it is storing the time! It's clearly reading from the hwclock on the UniPi. But for the life of me I can't get it to read via the normal method sudo hwclock --show :(
Any help would be appreciated as I am totally at the end of all possibilities that I've tried and I cannot find any issues relating to this online.
Thanks guys.
-
Hello @Nick-Cullen,
does the /dev/rtc device exists? Is is used by any user / process?
-
Hi Tomas,
Thanks for the reply!
Yes there is two devices I can see there
/dev/rtc /dev/rtc0
How can I check if it is used by another process?
-
@Nick-Cullen You can try to stop the timesync daemon (systemctl stop timesyncd) and issue the command again