0

I am interfacing a Raspberry PI4 with RTC DS1307 IC.

The conditions that I checked are mentioned below:

  1. First install i2c-detect library in Pi4 and check whether my RTC interfaces properly or not with cmd: sudo i2c-detect -y 1
  2. It shows the address of RTC(68)
  3. Then I will go to /etc/modules and in the last line I added rtc-ds1307
  4. After this, I reboot the PI, and then I will check for sudo i2c-detect -y 1 and the address of RTC will changed from '68' to 'UU'
  5. Then I will check for sudo timedatectl status command, and it will shows the following output:
                   Local time: Mon 2022-08-01 13:32:14 IST
               Universal time: Mon 2022-08-01 08:02:14 UTC
                     RTC time: Mon 2022-08-01 08:02:14
                    Time zone: Asia/Kolkata (IST, +0530)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
    
  6. Now using sudo hwclock -w, I wrote the current timing in RTC and using sudo hwclock -r I checked the RTC Time and it shows proper timing.
  7. Also in /boot/config.txt, I also added dtoverlay=i2c-rtc,ds1307 to enable RTC, and in /etc/rc.local I added sudo hwclock -s to enable synchronisation of RTC at booting of RPi.

Now my problem is following

When I shutdown my RPi4, and power off the switch for approximately one day, then after restart the RPi without internet, it will gives the delay of 10 to 12 sec. The RTC was running on 32.768 kHz and its battery source was fine. What is the issue for this delay...???

2
  • 1
    What OS? If you are fiddling with modules you are doing the wrong thing. There are RTC settings in Device Tree. Just use dtoverlay to configure.
    – Milliways
    Aug 1 at 9:52
  • I am using, Rasbian OS: PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" And this RTC was Works fine on Raspberry Pi 3 with same settings and same OS Version.... But on RPi4 it wasn't Aug 1 at 10:30

1 Answer 1

0

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

except add the following line to /boot/config.txt

dtoverlay=i2c-rtc,ds1307

DO NOT do ANYTHING else.

Run dtoverlay -h i2c-rtc for documentation.

The DS1307 is not the best for Pi as it runs from 5V so you NEED to ensure no pullup to 5V or use level converter (the Pi has internal pullup to 3.3V).

It works on all Pi & all OS with DT support.

3
  • We have designed a base board that works fine with raspi 3b+, now we are trying to use the same for pi4. While doing so we have encountered a delay of about 10-12 secs / day in rtc timing. This is where we are stuck. Is there any reason this happens with pi4 and not with pi3. Let me know if you need any other details. Aug 1 at 10:47
  • NOTE if you run hwclock -w you defeat the whole point of RTC as this syncs RTC to system clock! The default does everything needed to synchronise & update RTC.
    – Milliways
    Aug 1 at 10:53
  • sudo hwclock -w once when we setup the RTC Time. Only once Aug 1 at 12:49

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.