Somewhere between Raspbian Stretch and Buster something changed in the Linux RTC Driver; some Bright Spark decided to add battery low detection into the driver : *thanks*. In Stretch you didn’t have to have a battery backing up the RTC, but Buster is NOT happy unless you do. It’s all down to the Battery Low Flag (BLF) being set when there is no battery. The driver now insists that you have a battery, else in thinks everything is not ok. Sleepy Pi’s can operate quite happily without a battery as they are always powered by the main supply. However, thanks to said Bright Spark, you now can’t read the time as the OS will squawk at you about “unreliable” time. The workaround seems to be to add a battery to the RTC. The rest of the note gives some background information.
TLDR: Add a battery to the RTC.
Symptoms include an error when requesting the time:
If you look at the logs with a:
dmesg | grep rtc
you see that as far as Buster is concerned, it’s not going to read the RTC as the time is “unreliable” as seen in the screenshot above. The workaround is to you a battery in the RTC battery holder, something like a CR1620 or CR1632. The best way to check that the battery is installed correctly is to use a multimeter and measure on the points shown below:
With the battery installed everything shown be happy and if you repeat the commands you should see:
You can further check the BLF by dumping the RTC’s registers with:
sudo 12cdump -f -y -r 0x00-0x13 1 0x68 c
The value under ‘2” should be ’00” showing the BLF has been cleared. If it is ’04’ then the BLF is still set, try reseating the battery and / or upgrade to the latest version of Raspbian.
If I come across any other “fixes” (aside from rolling back the driver) I’ll add them to this note.