so, ive added an rtc ds1307 (with removed pullups) to i2c0 (I2C_SDA0=pin3,I2C_SCL0=pin5, 5v=pin4,gnd=pin6)
modprobe i2c-dev
“i2cdetect -y 0” shows only address 0x50 (eeprom), not the 0x68 from the clock, i tried the connections on the other side (first 7pol, then the 5pol-connector), same behaviour. Tried with another module (had 2), also the same.
now i tried to add the rtc and ignoring that it was not found:
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
cat /sys/class/i2c-dev/i2c-0/device/0-0068/rtc/rtc0/time
00:00:10
hwclock -w
cat /sys/class/i2c-dev/i2c-0/device/0-0068/rtc/rtc0/time
17:13:05
the shown time is in UTC (my local time is UTC+1)
i2cdetect shows now address 0x68 as UU like expected…i assume that the lir2032 on my boards was discharged, try to load it
i can read the rtc also via
hwclock -r
then the time is shown with timezone-setting (in CET=UTC+1)
tried reboot, but here bpi-r2 do not loose clock (disconnected lan of course so that ntp will fail) so i have to completely switch it off
created a script:
#!/bin/bash
modprobe i2c-dev
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
#cat /sys/class/i2c-dev/i2c-0/device/0-0068/rtc/rtc0/time
#read rtc
hwclock -r
#set system-clock to rtc-value
#hwclock -s
and still loading the battery
after a while i have powered down the r2 some minutes, these are now missing in the clock (clock is now ~5minutes behind)
[20:27] root@bpi-r2:~# ./rtc.sh
Fri 09 Mar 2018 08:32:15 PM CET -0.559925 seconds
[20:27] root@bpi-r2:~# date
Fri Mar 9 20:27:52 CET 2018
[20:27] root@bpi-r2:~# hwclock -s
[20:32] root@bpi-r2:~#
as you see i have set the clock of bpi-r2 to the value of external rtc