whowantspi
Posts: 39
Joined: Mon Feb 11, 2013 12:00 am
Location: USA Alabama

RTC on Stretch

Fri Mar 16, 2018 2:24 am

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

User avatar
DougieLawson
Posts: 36312
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RTC on Stretch

Fri Mar 16, 2018 10:08 am

Have you added

Code: Select all

dtoverlay=i2c-rtc,ds3231
to /boot/config.txt?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

whowantspi
Posts: 39
Joined: Mon Feb 11, 2013 12:00 am
Location: USA Alabama

Re: RTC on Stretch

Fri Mar 16, 2018 12:40 pm

Yes. That's step one in the Adafruit instructions.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: RTC on Stretch

Fri Mar 16, 2018 12:57 pm

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.

pcmanbob
Posts: 7073
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RTC on Stretch

Fri Mar 16, 2018 3:36 pm

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
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

whowantspi
Posts: 39
Joined: Mon Feb 11, 2013 12:00 am
Location: USA Alabama

Re: RTC on Stretch

Wed Mar 21, 2018 2:46 pm

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

Return to “Troubleshooting”