How to connect a RTC backup battery

Started by rinni, November 22, 2021, 08:23:59 PM

Previous topic - Next topic



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?



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.
Technical support and documentation manager at Olimex


I can't find anything like that in the schematic nor do I see any pinholes (besides the UEXT ones) near the UART0 (three pinholes on the lower right):


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?


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.
Technical support and documentation manager at Olimex


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 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.


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

(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