How to enable internal RTC in Apalis imx6 with Torizon?

I have Alapis imx6, there is no external RTC in my system. After power on system time restores to power off time.

I try to create /etc/udev/rules.d/99-rtc1.rules with
KERNEL=="rtc1", SUBSYSTEM=="rtc", DRIVER=="", ATTR{name}=="20cc034.snvs-rtc-lp", SYMLINK="rtc", MODE="0666"

But result is the same.

$ timedatectl
               Local time: Thu 2021-11-25 11:12:15 UTC
           Universal time: Thu 2021-11-25 11:12:15 UTC
                 RTC time: n/a
                Time zone: Universal (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
$ sudo hwclock -r
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --verbose option to see the details of our search for an access method.

In boot log I see

...
Jan 01 00:00:08 apalis-imx6-10652210 kernel: snvs_rtc 20cc000.snvs:snvs-rtc-lp: registered as rtc1
...

Greetings @Juzujka,

What version of TorizonCore are you running on your device?

When I flash our latest Quarterly Release (TorizonCore Upstream 5.4.0+build.10). The RTC seems to work out of the box:

apalis-imx6-05228985:~$ timedatectl
               Local time: Mon 2021-11-29 21:33:26 UTC
           Universal time: Mon 2021-11-29 21:33:26 UTC
                 RTC time: Mon 2021-11-29 21:33:26
                Time zone: Universal (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
apalis-imx6-05228985:~$ sudo hwclock -r
2021-11-29 21:33:32.256411+00:00

This was a freshly flashed image with no changes. I didn’t need to create a udev rule or anything like that.

As a side note /dev/rtc0 will be automatically set by the network clock on boot. However this rtc is the one that is on Toradex carrier boards. For SoC internal rtc which is /dev/rtc1 you’ll need to set this rtc as it won’t be set automatically on boot.

Best Regards,
Jeremias

Hello, Jeremias!
Thank you for your reply!
My version is torizon-core-docker-apalis-imx6-Tezi_5.1.0+build.1 + custom splash screen.
My device should work without the network.

In that case then you just need to set the RTC time manually if there’s no network. The process is described in this article here: Real-Time Clock / RTC (Linux)

Best Regards,
Jeremias