EDIT: Yes the connector’s seated correctly, and I’ve unplugged and re-plugged it to no avail.
Am I doing something wrong or fundamentally misunderstanding the role the Pi 5 RTC backup battery is meant to be performing?
I have a Pi 5 that has no network connectivity: it’s a standalone Wi-Fi AP to which clients can connect. An accurate RTC that survives and keeps ticking when the Pi is powered off (e.g. in a padded bag on its way to a site) is crucial, so I’ve added one of these:
Alas, no deal. I can set the time (sudo date -s '2024-12-18 07:56:00 AEDT'), turn the pi off, turn it back on later and the time was frozen whilst off, resuming now power’s on.
Just to let you know, I have a Pi 5 with the RTC battery and the clock keeps running when powered off and no internet access. So it does work.
I followed the Pi documentation page to set it up. If you have done the same it should work.
“The RTC is equipped with a constant-current (3mA) constant-voltage charger.” Not a fast charge. When I connected it I left it powered up for a few hours before testing to see if the RTC clock kept running. You could leave it powered for a while and then check the battery voltage, if it is not around 4.2V then the battery could be the problem.
I can second what Jim is saying. Ensuring that your battery is working as expected and outputting an acceptable voltage is a good idea to make sure it’s not contributing to any issues.
hwclock won’t account for daylight saving adjustments automatically which looks to me like the reason behind this 1 hour time difference.
when you run sudo hwclock --systohc do the outputs from date and sudo hwclock sync up?
I’ve just powered it back up again and the time reported by date is “accurate” - in so far as it’s been clocking whilst powered down - but alas, it’s gone back an hour to the GMT+10 time, so the two clocks align:
pi@captureKNX:~ $ date
Wed 18 Dec 12:21:38 AEDT 2024
pi@captureKNX:~ $ sudo hwclock
2024-12-18 12:21:45.009177+11:00
I’ll let it run the rest of the afternoon, just in case it’s some weird battery voltage thing, although that doesn’t explain how the hwclock is telling me it’s GMT+11 when it’s displaying GMT+10, and then (presumably?) copying that into the system clock on bootup.
Or did I maybe originally just have a flat battery, and by running sudo hwclock --systohc I’ve since given myself a different problem?
Looks like the battery is doing okay then, that’s great.
I would try to set the date again but have a play around with the timezone, trying both AEDT and AEST. I’m not sure exactly whats going on but it does seem like some daylight savings adjustment is happening in the background when you don’t want it to.
Maybe setting the time initially to the correct time with the timezone as AEST before using sudo hwclock --systohc will give you a different outcome?
So i think the hwclock command I first tried was the wrong way 'round, copying system to hardware, where in the snippet above I’m setting the HW clock, THEN copying it to sys.
I subsequently gave the Pi a 15 minute snooze and it came up with the right time, so I think my issue is resolved.
I have a spare battery and I’ll pay more attention next time I build a Pi 5 and deploy it, making sure I first enable the on-board charger and give the battery time to charge up before I start relying on it to maintain the time when it’s powered off.