1. introduction
2. installation
vi /boot/config.txt
///
dtoverlay=i2c-rtc,pcf8523
vi /etc/modules-load.d/rtc.conf
i2c-bcm2708
i2c-dev
rtc-pcf8523
reboot
3. testing
yum install i2c-tools
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: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
![]() |
if UU → 68, check kernel module rtc_pcf8523 |
cat /proc/driver/rtc
24hr : yes
4. configuration
ntpdate ntp.belnet.be
date -s "$(date '+%Y%m%d %T')"
cat /proc/driver/rtc
rtc_time : 17:16:20
rtc_date : 2017-03-16
24hr : yes
hwclock -s
5. debugging
i2cdetect -l
i2c-1 i2c bcm2835 (i2c@7e804000) I2C adapter
cat /etc/adjtime
hwclock -r
hwclock -w
i2cdump -y -f -r 0-6 1 0x68 c
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 80 00 08 53 14 14 23 ?.?S??#
The command i2cdump -y -f -r 0-6 1 0x68 c can be used to dump the first 7 registers of the ds1307 which contain the time
(the -f is needed only if you have the rtc driver installed; it overrides the reservation).