RTC time issue

Hi Team,

We have RTC in custom boards. And updating time using NTP mechanism. After that we turned off custom boards for 2 days. On 3rd day while seeing time on our 3 custom boards with out connecting to network, observed the following.

BDNO.1—>1min 15 sec fast when compared with UTC
BDNO.2—> 1min 50 sec slow when compared with UTC
BDNO.3—> hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument

Please provide any suggestions to avoid those time differences.

Thanks,
Kartheek

What RTC are you using? Depending on the RTC, and crystal they can have various settings that must be tuned specific to the implementation. From a configuration side under Linux how are you specifically setting the date / time via NTP? Most NTP mechanisms when a clock skew is too big it will slowly start adjusting the system time to be correct rather than making a big jump, after that the RTC will need to be updated before power-down.

If there is an invalid time/date that means that the date was never properly set on the RTC, or the battery backup failed and the registers were reset. First check the power of your battery, and make sure if your RTC has the functionality the charge circuit is configured properly.

Part numbers used on board.
RTC: AM1805AQ
Crystal: STDMUA8-32.768K.
Coin cell battery voltage: 2.76V

For fresh board we are setting RTC like below:

  1. To set RTC time: “hwclock -w”
  2. To set to NTP mechanism: “timedatectl set-ntp 1” (Connected to network)
  3. To read RTC: “hwclock -r”

Below is the circuit image for RTC.