Power & Source of Big Ideas

RTC doesn't work!

Moderators: chensy, FATechsupport

I found significant issues with RTC on NanoPi R5C.

1.) When attaching the battery connector, the board is NOT fitting in the CNC housing anymore.
2.) In spite of attaching the battery (and measured 3.0V polarity-correct), RTC is not keeping the date and it always resets to 2017.

Here are a few logs:

Code: Select all

$ dmesg | grep rtc
[    2.992713] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    2.992838] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    3.212985] rk808-rtc rk808-rtc: registered as rtc0
[    3.213495] rk808-rtc rk808-rtc: setting system clock to 2017-08-04T09:00:03 UTC (1501837203)
[    5.968490] rtc-hym8563 5-0051: rtc information is valid
[    5.973021] rtc-hym8563 5-0051: registered as rtc1

$ timedatectl status
               Local time: Sun 2023-07-09 23:18:53 CEST
           Universal time: Sun 2023-07-09 21:18:53 UTC
                 RTC time: Sun 2023-07-09 21:18:53
                Time zone: Europe/Budapest (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no


Now HALT, then remove the power cord, then reattach the power cord, then log back in:

Code: Select all

$ dmesg | grep rtc
[    2.992325] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    2.992442] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    3.213450] rk808-rtc rk808-rtc: registered as rtc0
!!! [    3.213953] rk808-rtc rk808-rtc: setting system clock to 2017-08-04T09:00:03 UTC (1501837203)
[    5.900733] rtc-hym8563 5-0051: rtc information is valid
[    5.907632] rtc-hym8563 5-0051: registered as rtc1


As you can see, RTC doesn't remember the correct date!

I'm using "Debian 11(Bullseye) Core, no desktop environment, command line only, kernel version 5.10.y "

Any clue/idea on how can I make this working?
One small addition. RTC seems partially working now with an udev rule to make "rtc1" as default RTC (instead of rtc0).

However, in spite I have these below lines in my udev rule:

Code: Select all

KERNEL=="rtc1", SUBSYSTEM=="rtc", DRIVER=="", ATTR{name}=="rtc-hym8563 5-0051", SYMLINK="rtc", MODE="0666"


And it also works:

Code: Select all

# ls -la /dev/rtc*
lrwxrwxrwx 1 root root      4 Dec 22  2022 /dev/rtc -> rtc1
crw------- 1 root root 250, 0 Dec 22  2022 /dev/rtc0
crw-rw-rw- 1 root root 250, 1 Dec 22  2022 /dev/rtc1


RTC is NOT synced back to system time:

Code: Select all

# timedatectl 
               Local time: Mon 2023-07-10 00:15:10 CEST
           Universal time: Sun 2023-07-09 22:15:10 UTC
                 RTC time: Mon 2023-07-10 06:28:22
                Time zone: Europe/*** (CEST, +0200)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no


BUT! timedatectl reports correct RTC date and time.

So I'm guessing udev rules are not enough to use rtc1 as default.
RTC0 and RTC1 are different addresses.
You want the one that starts with H as the one you use, the other Rockchip specific RTC is the 2017 one.
Re the battery, you might want to find a smaller battery or wiggle it well. Be very careful to not make a short circuit on the underside of the board, my R5C is RIP now due to a short on the case while running it outside of it's case.
Some people advise drilling a hole in the case big enough to fit the connector and then taping the battery to the exterior of the case.
Thanks, I disabled rtc0 in kernel config, rebuilt the kernel and now it's working as intended. Note: smaller battery simply doesn't exists, but it's not the battery causing the "not-fit" issue, but the connector. The connector can't be any higher than it's without its other half: hence I had to solder the wires directly onto the connector without any height increase:

https://imgur.com/a/hiX9Ozm

Who is online

In total there are 23 users online :: 0 registered, 0 hidden and 23 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 23 guests