External RTC IMX8DX Toradex (Colibri Evaluation Board)

Hi,

Followed below article to configure external RTC to be used for system time
Real-Time Clock / RTC (Linux) | Toradex Developer Center

applied udev like below and used below commands
sudo udevadm control --reload-rules && sudo udevadm trigger

Change Default RTC

To change the default RTC as e.g. used by hwclock create a file called /etc/udev/rules.d/99-rtc1.rules with e.g. the following contents:

KERNEL==“rtc1”, SUBSYSTEM==“rtc”, DRIVER==“”, ATTR{name}==“m41t0”, SYMLINK=“rtc”, MODE=“0666”

issue: but it does not reflect in dev

torizon@colibri-imx8x-07202984:~$ ls -ltr /dev/rtc*
crw------- 1 root root 253, 0 Jan 25 00:57 /dev/rtc0
lrwxrwxrwx 1 root root 4 Jan 25 00:57 /dev/rtc → rtc0
crw------- 1 root root 253, 1 Jan 25 00:57 /dev/rtc1

Thank you

Ensure that the rule is written correctly. The rule you’ve provided seems to have smart quotes (“ ”) instead of straight quotes (" "). Udev rules need to use straight quotes.
Correct rule:

KERNEL==“rtc1”, SUBSYSTEM==“rtc”, DRIVER==“”, ATTR{name}==“m41t0”, SYMLINK=“rtc”, MODE=“0666”

@alex.tx
I have used straight quotes. (above happened while copy paste from above link)

As per below log from my board
is rtc1 → internal RTC ?
rtc0 → external RTC ?

dmesg | grep rtc
[ 1.792282] imx-sc-rtc scu:rtc: registered as rtc1
[ 1.979973] rtc-ds1307 16-0068: registered as rtc0
[ 1.994672] imx-drm display-subsystem: bound imx-dpu-crtc.0 (ops dpu_crtc_ops)
[ 1.995259] imx-drm display-subsystem: bound imx-dpu-crtc.1 (ops dpu_crtc_ops)
[ 2.083107] imx-drm display-subsystem: bound imx-dpu-crtc.0 (ops dpu_crtc_ops)
[ 2.083388] imx-drm display-subsystem: bound imx-dpu-crtc.1 (ops dpu_crtc_ops)
[ 2.146140] rtc-ds1307 16-0068: setting system clock to 2024-01-28T22:26:52 UTC (1706480812)

so please let me know how to select external RTC from udev, is below correct rtc1 or rtc0 ?

KERNEL==“rtc1”, SUBSYSTEM==“rtc”, DRIVER==“”, ATTR{name}==“m41t0”, SYMLINK=“rtc”, MODE=“0666”

Hi @Shreejit,

Can you please confirm one more time, are you trying to use external rtc as system clock, if yes then then same is already being used. checking from the log shared " [ 2.146140] rtc-ds1307 16-0068: setting system clock to 2024-01-28T22:26:52 UTC (1706480812)"

Best Regrads
Ritesh Kumar

Yes I want to use external rtc as system clock.
Yes I understood this point → then same is already being used
but what if internal is enabled instead of external

Then please let me know how to select external RTC from udev, is below correct ?
Real-Time Clock / RTC (Linux) | Toradex Developer Center
is it rtc1 or rtc0 (rtc1 is internal and rtc0 is external, but in article it is mentioned rtc1 for external)

KERNEL==“rtc1”, SUBSYSTEM==“rtc”, DRIVER==“”, ATTR{name}==“m41t0”, SYMLINK=“rtc”, MODE=“0666”

Hi @Shreejit,

To use internal you will need to change ATTR accordingly. You can get detail using below command, select one which is unique to rtc1.

udevadm info -a -n /dev/rtc1

Best Regards
Ritesh Kumar

1 Like