Jump to content

Where is the current clock being stored on a RTC-less system


Anderson Lima

Recommended Posts

Armbianmonitor:

Hi all, everytime I turn on my Nano Pi it will sync the clock using NTP. When network is not enabled it will rewind the time to something that I still can't comprehend. I found lots of topics about people talking about how to add a RTC to the system, but none talking about the current RTC that is recognized by the kernel. Currently when the system is powered off and on (10 seconds distance) without network the time will rewind between 5 and 15 minutes. I understand that this happens because there is no RTC to write the current clock and battery to keep it. But there is obviously a RTC somewhere because removing power from the device and putting it back will keep a wrong but close time. I didn't leave it a long time off to check what happens yet.

 

[ 4.381725] sun6i-rtc 1f00000.rtc: registered as rtc0

[ 4.381738] sun6i-rtc 1f00000.rtc: RTC enabled

 

My question is: is it possible to sync the time more often so in a restart scenario the clock is "less wrong" ?

Link to comment
Share on other sites

Thanks for the reply. The device is installed in an place where there are power outages that affect also the network infrastructure, it can take several minutes before it goes back online. I will check if forcing ntp before a reboot makes the clock come back with the same date from the NTP.

Link to comment
Share on other sites

A bit of HW details. H3 and most of AW SoCs for that matter have RTC integrated in which can be clocked from internal or external clock. Internal clock is sadly inaccurate, so it's borderline useable for keeping time, but some boards, like NanoPi NEO still omit external clock (price consideration, I guess). So, main issue about RTC to keep time is if it has separate power supply which is still enabled when main power supply is disconnected. On schematic, this is VCC_RTC. As you can see on NanoPi NEO schematic, RTC and main power supply are connected together, so RTC will lost power and with that time every time main power supply is disconnected.

Link to comment
Share on other sites

On 6/16/2020 at 2:01 AM, Anderson Lima said:
Armbianmonitor:

Hi all, everytime I turn on my Nano Pi it will sync the clock using NTP. When network is not enabled it will rewind the time to something that I still can't comprehend. I found lots of topics about people talking about how to add a RTC to the system, but none talking about the current RTC that is recognized by the kernel. Currently when the system is powered off and on (10 seconds distance) without network the time will rewind between 5 and 15 minutes. I understand that this happens because there is no RTC to write the current clock and battery to keep it. But there is obviously a RTC somewhere because removing power from the device and putting it back will keep a wrong but close time. I didn't leave it a long time off to check what happens yet.

 

[ 4.381725] sun6i-rtc 1f00000.rtc: registered as rtc0

[ 4.381738] sun6i-rtc 1f00000.rtc: RTC enabled

 

My question is: is it possible to sync the time more often so in a restart scenario the clock is "less wrong" ?

Do a fake-hwclock save as /etc/cron.daily/fake-hwclock at your requested interval. Chrony enables kernel mode (11 minute sync) by default (rtcsync). In a proper restart scenario fake-hwclock should handle stuff properly. (see /etc/fake-hwclock.data)

Edited by xwiggen
Link to comment
Share on other sites

22 hours ago, jernej said:

A bit of HW details. H3 and most of AW SoCs for that matter have RTC integrated in which can be clocked from internal or external clock. Internal clock is sadly inaccurate, so it's borderline useable for keeping time, but some boards, like NanoPi NEO still omit external clock (price consideration, I guess). So, main issue about RTC to keep time is if it has separate power supply which is still enabled when main power supply is disconnected. On schematic, this is VCC_RTC. As you can see on NanoPi NEO schematic, RTC and main power supply are connected together, so RTC will lost power and with that time every time main power supply is disconnected.

 

Thanks a lot, this was really useful.

 

3 hours ago, xwiggen said:

Do a fake-hwclock save as /etc/cron.daily/fake-hwclock at your requested interval. Chrony enables kernel mode (11 minute sync) by default (rtcsync). In a proper restart scenario fake-hwclock should handle stuff properly. (see /etc/fake-hwclock.data)

Thanks too, I'm trying that.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines