RTC clock issue on on NX devkit JP5.0.2

I have the NX DevKit running the latest JP5.0.2. My RTC clock battery is good at 3.4VDC, however the RTC clock is loosing its date/time, please see below for details…

root@nx:/home/michael# hwclock --show
2000-01-06 07:32:57.008373-05:00
root@nx:/home/michael# date
Fri 25 Nov 2022 01:59:25 PM EST
root@nx:/home/michael# hwclock -w
root@nx:/home/michael# date
Fri 25 Nov 2022 01:59:33 PM EST
root@nx:/home/michael# hwclock --show
2022-11-25 13:59:36.047038-05:00
root@nx:/home/michael# reboot

root@nx:/home/michael# dmesg --ctime | grep -i clock
[Fri Nov 25 14:00:41 2022] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xe6a171046, max_idle_ns: 881590405314 ns
[Fri Nov 25 14:00:41 2022] sched_clock: 56 bits at 31MHz, resolution 32ns, wraps every 4398046511088ns
[Fri Nov 25 14:00:41 2022] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[Fri Nov 25 14:00:41 2022] PTP clock support registered
[Fri Nov 25 14:00:41 2022] clocksource: Switched to clocksource arch_sys_counter
[Fri Nov 25 14:00:42 2022] tegra186-dpaux-pinctrl 155f0000.dpaux: can not get clock
[Fri Nov 25 14:00:44 2022] tegra_rtc c2a0000.rtc: setting system clock to 1970-01-01T00:00:29 UTC (29)
[Fri Nov 25 14:00:44 2022] tegra_rtc c2a0000.rtc: Tegra internal Real Time Clock
[Fri Nov 25 14:00:46 2022] tegra_cec 3960000.tegra_cec: Enable clock result: 0.
[Fri Nov 25 14:01:49 2022] systemd[1]: System time before build time, advancing clock.
root@nx:/home/michael# timedatectl
Local time: Fri 2022-11-25 14:04:31 EST
Universal time: Fri 2022-11-25 19:04:31 UTC
RTC time: Fri 2022-11-25 19:04:31
Time zone: America/New_York (EST, -0500)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
root@nx:/home/michael#

root@nx:/home/michael# ls -la /dev/rtc
lrwxrwxrwx 1 root root 4 Nov 25 14:00 /dev/rtc → rtc1
crw------- 1 root root 250, 0 Nov 25 14:00 /dev/rtc0
crw------- 1 root root 250, 1 Nov 25 14:00 /dev/rtc1

Can someone shed some light on the devices above? Which one has a backup battery? Or they are both linked to the same clock counter?

Thanks,
-albertr

please check RTC can't hold time the after system rebooted in L4T 35.1 - #17 by barryhung

Thanks, that is very helpful thread! So I did change the /dev/rtc link to /dev/rtc0 by editing the UDEV rule as it was suggested in that thread. Now /dev/rtc0 keeps the time, but kernel still uses /dev/rtc1. I will rebuilt the kernel with CONFIG_RTC_HCTOSYS_DEVICE=“rtc0” option instead of “rtc1” and I hope that should fix the problem for me as it did for others.
Thanks,
-albertr

Just wanted to follow-up… I’ve changed “rtc1” to “rtc0” in both of the following kernel options and rebuild my kernel:

michael@nx:~/src/xone$ zcat /proc/config.gz | grep rtc0
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"

Now with rtc0 is used by both the kernel and userland, everything seems to keep time as expected.

– albertr

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.