0

Configuring the DS3231 Real Time Clock
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Configuring the DS3231 Real Time Clock

by styx1 on Sat Jul 27, 2019 2:14 pm

I was planning on using this "as needed" for digital ham radio applications (WSJT-X: FT8, FT4, etc) where time sync is critical. The majority of the time when internet is available I was not going to have it installed. If I was portable and out in the middle of nowhere without internet my plan (once the time had been set on the DS3231) was to be able to plug it in and have the correct time on the RPI. After reading the installation/configuration instructions, particularly removing the "fake" hardware clock I began to wonder if after the installation the device would have to remain installed permanently for the RPI time to be accurate. If I remove the clock would the RPI still sync correct time directly via the internet. I am using a RPI4B/Buster with the Pimoroni FanShim….. which leads to my second question. Will the FanShim attachment interfere with i2c connections. I know it interfers with BCM18 but can find no mention of i2c.

Thanks!
Joel

styx1
 
Posts: 4
Joined: Sat Apr 14, 2018 10:10 pm

Re: Configuring the DS3231 Real Time Clock

by adafruit_support_mike on Sun Jul 28, 2019 1:28 pm

The RTC will keep running when disconnected from the RasPi if you have a battery in the coin cell holder. It should be able to run for several months that way.

The Fan Shim doesn’t use the I2C pins, but you’ll need to find a way to make the connections. A short chunk of stacking header would work.

adafruit_support_mike
 
Posts: 58856
Joined: Thu Feb 11, 2010 2:51 pm

Re: Configuring the DS3231 Real Time Clock

by styx1 on Sun Jul 28, 2019 2:15 pm

Thanks for the reply..... I did the installation - the only difference I came across was that after initiating i2c in the rpi config that a second screen (to load i2c kernel support at boot) did not appear. Otherwise everything was as it should be. I have removed the RTC and found that the RPI still syncs with NPS time even after removal of the fake hardware clock.... so I am not exactly certain what that was supposed to do (even after reading online explanations). Anyway, all is well.

Thanks for the answer!

styx1
 
Posts: 4
Joined: Sat Apr 14, 2018 10:10 pm

Re: Configuring the DS3231 Real Time Clock

by adafruit_support_mike on Mon Jul 29, 2019 1:45 pm

The fake hardware clock exists to keep the system logs getting screwy.

There are several low-level parts of ‘nix-based systems that assume the existence of a clock that always increases. The RasPi doesn’t have a hardware clock though, so without an NTP connection it would start at T=0 every time it boots. That plays hell with things like cron jobs, but also with the creation and modification dates for files, expiration times for lockfiles, and so on. There’s no guarantee that the system will behave sensibly when it discovers an item that says it’s from the future, so it helps to at least pretend the system has a clock.

The fake hardware clock just counts ticks of the CPU clock, saves the clock’s value at shutdown, and reloads it at startup, so the system thinks all shutdown and reboot activity took zero time to occur. Each boot still occurs at a higher clock value than any previous one, so the illusion of a monotonically increasing clock remains true enough to keep the system running.

adafruit_support_mike
 
Posts: 58856
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.