0

UPD: with another chip of the same model RTC works just fine, presumably that the chip was broken/damaged.

I installed DS3231 RTC clock ( which is detected as DS1307 for some reason). My config.txt looks like

gpu_mem=64
dtoverlay=dwc2
dtoverlay=i2c-rtc,ds3231
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=1000000
dtparam=spi=on
enable_uart=1

The clock is detected by i2cdetect and I can see that /dev/rtc0 exists.

dmesg | grep rtc shows

dmesg | grep rtc
[    4.021947] rtc-ds1307 1-0068: registered as rtc0

The problem is - hwclock -r always returns the same time. I can set it with hwclock -w and it will keep that very time for weeks.

Am I missing something there? Isn't it supposed to tick?

  • it is probably a DS1307 – jsotola Jun 30 at 1:25
2

The ONLY thing you have to do is include in /boot/config.txt:

dtoverlay=i2c-rtc,ds3231

All the RTC supported by the Pi kernel use the same rtc-ds1307 driver, but you NEED to tell the driver which chip you actually have. (The different chips have similar instruction sets and registers.)

NOTE you NEED to use a separate dtoverlay line for each overlay. Putting dwc2,i2c-rtc will not work.

There is no need to set time - it all happens AUTOMATICALLY, although you can set the RTC initially (if NTP not available) using hwclock --set see man hwclock for details.

See https://raspberrypi.stackexchange.com/a/51782/8697

  • okay, easy - looks like the chip is buggy itself, tried with another one - worked just fine. – jdevelop Jun 30 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.