I have a breakout board with the MCP7940N RTC on the Pi 3B+. How do I get this to work. I've been following this guide but don't seem to be getting anywhere. In my /boot/config.txt
I have added dtoverlay=i2c-rtc,mcp7940x
. When I run i2cdetect -y 1
I see this:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
70: -- -- -- -- -- -- -- --
I have also removed the fake-hwclock
. Now when I try sudo hwclock --systohc
that seems to work and I can read the right clock back too but I'm not sure if that's setting the Pi's hardware clock or the RTC on the breakout board.
When I run sudo hwclock --debug
I see this:
hwclock from util-linux 2.29.2
Using the /dev interface to the clock.
Last drift adjustment done at 1561692828 seconds after 1969
Last calibration done at 1561692828 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: 2019/06/28 03:42:51
Hw clock time : 2019/06/28 03:42:51 = 1561693371 seconds since 1969
Time since last adjustment is 543 seconds
Calculated Hardware Clock drift is 0.000000 seconds
2019-06-28 09:12:50.698309+0530
Any help would be appreciated!
EDIT:
timedatectl
shows this:
Local time: Fri 2019-06-28 09:35:19 IST
Universal time: Fri 2019-06-28 04:05:19 UTC
RTC time: Fri 2019-06-28 04:05:20
Time zone: Asia/Kolkata (IST, +0530)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
timedatectl
show?timedatectl
. I want to know if hwclock is the way to access the RTC on the breakout board and whether the date and time I see is from the RTC on the breakout board or the Pi's hardware.