I have a Beaglebone black with a custom cape which includes DS1307ZN+ RTC on i2c 1.
I have enabled i2c1 and the DS1307 as RTC1 in the device tree overlay.
debian@apc:~$ i2cdetect -y -r 1
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: -- -- -- -- -- -- -- --
debian@apc:~$
debian@apc:~$ ls -al /dev/rtc*
lrwxrwxrwx 1 root root 4 Sep 4 13:31 /dev/rtc -> rtc1
crw------- 1 root root 252, 0 Sep 4 13:31 /dev/rtc0
crw------- 1 root root 252, 1 Sep 4 13:31 /dev/rtc1
debian@apc:~$ sudo nano /etc/udev/rules.d/55-i2c-rtc.rules
debian@apc:~$
I can sync RTC1 to my system date and time and then read back both clocks as follows:
debian@apc:~$ sudo hwclock --rtc=/dev/rtc1 --systohc
debian@apc:~$ date && sudo /sbin/hwclock -r -f /dev/rtc1
Sun 04 Sep 2022 01:39:41 PM NZST
2022-09-04 13:39:42.253227+12:00
debian@apc:~$
The RTC1 clock ticks matching system clock, so I think this means my i2c and RTC oscillator are all working ok.
But after I power cycle the system, the RTC always reverts to: 2000-01-01 13:00:50.963254+13:00
debian@apc:~$ date && sudo /sbin/hwclock -r -f /dev/rtc1
Sun 04 Sep 2022 01:41:59 PM NZST
[sudo] password for debian:
2000-01-01 13:00:50.963254+13:00
debian@apc:~$
Here is my circuit extract. I have a 3V coin cell on vBat and have checked the voltage.
Can anyone help me with this?