Page 1 of 1

RTC on Stretch

Posted: Fri Mar 16, 2018 2:24 am
by whowantspi
I have had DS3231 RTC's on my Pi's running Wheezy, Jessie and now Stretch. Everything worked as expected on Wheezy and Jessie but Stretch has a problem I haven't been able to figure out.

I followed the instructions here for Jessie and Stretch. https://learn.adafruit.com/adding-a-rea ... t-rtc-time
and also installed NTP using DougieLawson post in this thread viewtopic.php?t=194468
which is ...

sudo apt install ntp
sudo systemctl enable ntp
sudo timedatectl set-ntp 1

When the pi is first booted the RTC time always shows Thu 2016-11-03 17:17:15 (give or take a few seconds)

timedatectl
Local time: Thu 2018-03-15 16:29:38 CDT
Universal time: Thu 2018-03-15 21:29:38 UTC
RTC time: Thu 2016-11-03 17:17:15
Time zone: America/Chicago (CDT, -0500)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no

After a few minutes the RTCs will get their time set correctly, but it's always wrong at boot.
Since I have 9 raspberry pi's of different versions that all do the exact same thing, it has to be software.

Thanks for any help, Max

Re: RTC on Stretch

Posted: Fri Mar 16, 2018 10:08 am
by DougieLawson
Have you added

Code: Select all

dtoverlay=i2c-rtc,ds3231
to /boot/config.txt?

Re: RTC on Stretch

Posted: Fri Mar 16, 2018 12:40 pm
by whowantspi
Yes. That's step one in the Adafruit instructions.

Re: RTC on Stretch

Posted: Fri Mar 16, 2018 12:57 pm
by gregeric
Is your RTC's backup cell healthy?

Edit: failed to notice that this afflicts 9 raspberries so unlikely to be that.

Checked my DS3231 RTC & with network disconnected it's booting back up with the current time. That's Stretch / kernel 4.9.

Re: RTC on Stretch

Posted: Fri Mar 16, 2018 3:36 pm
by pcmanbob
Did you remember to write the correct time/date to the RTC using

Code: Select all

sudo hwclock -w 
then check it with

Code: Select all

sudo hwclock -r

Re: RTC on Stretch

Posted: Wed Mar 21, 2018 2:46 pm
by whowantspi
After trying everything I could find on the net I finally gave up and downloaded the latest release of Stretch. Following my same notes it appears to be working correctly now. I just wish I could have figured out how to fix my orginal problem. Now I have to rebuild 9, make that 10 (just bought a new 3B+) systems. What a pain.

Max