How to set up i2c for rtc?
Posted: Fri Feb 15, 2019 11:31 pm
I have used adafruit RTC pcf8523 with raspberry pi. Now I am trying to get it to work on CM3+.
I tried to edit the config.txt to set it on pins 22/23 or 23/24 (as appeared default in i2c-gpio)
The device was detected as an i2c, but doesn't appear to be recognized.
shows 68 at location 68, but probe return error
failed to access rtc
Finally it doesn't seem the gpios were changed after all.
How to fix it? Thanks!
I tried to edit the config.txt to set it on pins 22/23 or 23/24 (as appeared default in i2c-gpio)
Code: Select all
# Add new I2C
#dtoverlay=i2c-gpio,i2c_gpio_sda=22,i2c_gpio_scl=23
#dtoverlay=i2c1-bcm2708,sda1_pin=22,scl1_pin=23,pin_func=6
dtoverlay=i2c-gpio
dtoverlay=i2c-rtc,pcf8523
The device was detected as an i2c, but doesn't appear to be recognized.
Code: Select all
$ i2cdetect -y 3
shows 68 at location 68, but probe return error
Code: Select all
$ dmesg | grep pcf8523
rtc-pcf8523: probe of 1-0068 failed with error -121
Code: Select all
$ sudo hwclock -D -r
hwclock from util-linux 2.29.2
hwclock: cannot open /dev/rtc: No such file or directory
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.
Code: Select all
$ sudo raspi-gpio get
GPIO 0: level=1 fsel=0 func=INPUT
GPIO 1: level=1 fsel=0 func=INPUT
GPIO 2: level=1 fsel=4 alt=0 func=SDA1
GPIO 3: level=1 fsel=4 alt=0 func=SCL1
GPIO 4: level=1 fsel=0 func=INPUT
......
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=1 fsel=0 func=INPUT
GPIO 24: level=1 fsel=0 func=INPUT