Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A64 => Topic started by: rinni on November 22, 2021, 08:23:59 PM

Title: How to connect a RTC backup battery
Post by: rinni on November 22, 2021, 08:23:59 PM
Hi,

I need connect a RTC backup battery to the board (2Ge8G-IND, Rev. E) and I'm kind of lost ... Should it be connected to GPIO1 pin4 (+) and pin2 (-) or how is it supposed to work?

Thanks!
Title: Re: How to connect a RTC backup battery
Post by: LubOlimex on November 24, 2021, 08:28:33 AM
No. Backup battery is on separate pads named "BACKUP". These are two pinholes available near the UART0 (serial debug) pins. Refer to the schematic.

The battery should be 3V. Check on the AXP209 datasheet for the requirements and properties of the backup RTC battery.


Edit: this comment is not applicable for A64 boards, it applies for A20 board. I misunderstood.
Title: Re: How to connect a RTC backup battery
Post by: rinni on November 28, 2021, 06:08:20 PM
I can't find anything like that in the schematic (https://raw.githubusercontent.com/OLIMEX/OLINUXINO/master/HARDWARE/A64-OLinuXino/1.%20Latest%20hardware%20revision/A64-OLinuXino%20hardware%20revision%20E/A64-OlinuXino_Rev_E.pdf) nor do I see any pinholes (besides the UEXT ones) near the UART0 (three pinholes on the lower right):
Title: Re: How to connect a RTC backup battery
Post by: Bala on December 04, 2021, 12:43:34 PM
Hi,
I also need RTC, how do i connect the battery, there is neither a "BACKUP" pad nor pin holes near Debug UART, can you please help with proper reference?
Title: Re: How to connect a RTC backup battery
Post by: LubOlimex on December 06, 2021, 09:14:53 AM
Sorry, as you can see my previous comment was about AXP209 and A20 boards.

For A64 boards and AXP803 there is only a pad for the RTC battery, it is located under the USB host connector ("big" USB) at the bottom of the board, and the pad is called "3.0V_RTC1".

The battery should be 3V. Check on the AXP803 datasheet for the requirements and properties of the backup RTC battery.
Title: Re: How to connect a RTC backup battery
Post by: Bala on December 08, 2021, 03:12:17 PM
Thank you
Title: Re: How to connect a RTC backup battery
Post by: ilario on February 05, 2024, 04:04:21 PM
Hello, I just wanted to share my experience with this (connecting a battery for using the RTC clock).
In short: it works!

In order to solder the +3V cable from the coin battery holder to the board, I had to apply some flux (did not succeed trying without the flux).
The other cable, I connected it to one of the connectors of the USB port case, which is connected to GND. Also in this case I had to apply some flux. Surely, using a piece of the USB port case for the ground connection is not the most elegant option, but it was the first ground point I spotted.



As you can see from the picture, with my poor soldering skills I did not manage to solder the wire only to the 3.0V_RTC1 pad, but I also connected one terminal of a neighboring resistor.
Good thing of open hardware is that I could check in the schematics that the resistor was connected to the 3.0V_RTC1 pad anyway, so it is ok!

I used this coin battery holder (https://www.adafruit.com/product/4856) and its cable is thin enough to fit between the A64-Olinuxino and its black box. The battery is a random brand CR2032 coin battery.





Finally, I checked that the fake-hwclock package did not create any trouble, and it does not (it realizes that the system clock is more updated than the fake clock from fake-hwclock). The RTC clock gets updated by systemd-timedated when internet is present. If no internet connection is available, systemd-timedated will not update the RTC, so one should run
hwclock -w at least once. This is explained here (https://developer.toradex.com/software/linux-resources/linux-features/real-time-clock-rtc-linux/).
Title: Re: How to connect a RTC backup battery
Post by: ilario on February 05, 2024, 05:04:35 PM
PS the reasons why I wanted the RTC to work are:
1) understanding the boot logs is much easier if the clock makes sense;
2) Prometheus gets seriously upset when the clock suddenly gets updated and the time changes of several hours. It fails with a flood of messages like these:

msg="Error on ingesting samples that are too old or are too far into the future"

msg="Error on ingesting out-of-order samples" num_dropped=385

msg="Append failed" err="out of bounds"

msg="Appending scrape report failed" err="out of bounds"

And the temporary solution I did found was to edit the Prometheus systemd unit with

systemctl edit prometheus.service
adding, in a new [Service] section:
ExecStartPre=sleep 120
TimeoutStartSec=300

(basically it waits 2 minutes so that I can be sure that NTP is not going to do anything once Prometheus is running)

But now, with a working RTC, this is not needed anymore :D