DESK-MP1-L/Peripherals/RTC

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2023/08/02 DESK-MP1-L-1.0.0 release


Pheripheral RTC[edit | edit source]

On SBC ETRA there are two rtc one on ETRA SOM and one on carrier board.

root@desk-mp1:~# ls -la /dev/rtc*
lrwxrwxrwx 1 root root      4 Aug  2 10:45 /dev/rtc -> rtc0
crw------- 1 root root 253, 0 Aug  2 10:45 /dev/rtc0
crw------- 1 root root 253, 1 Aug  2 10:45 /dev/rtc1

Device tree configuration[edit | edit source]

...
...
&i2c4{
    ...
    ...
    ds3232: rtc@68 {
        compatible = "dallas,ds3232";
        reg = <0x68>;
        interrupt-parent = <&gpiod>;
        interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
        status = "okay";
    };
    ...
    ...
};
...
...
&rtc{
	status = "okay";

	/* USER CODE BEGIN rtc */
	/* USER CODE END rtc */
};
...
...

Linux messages at boot time[edit | edit source]

...
[    2.006753] stm32_rtc 5c004000.rtc: registered as rtc0
[    2.010619] stm32_rtc 5c004000.rtc: setting system clock to 2023-08-02T10:45:30 UTC (1690973130)
[    2.019926] stm32_rtc 5c004000.rtc: registered rev:1.2
...
[    2.177792] rtc-ds3232 1-0068: registered as rtc1
...

Usage with hwclock[edit | edit source]

root@desk-mp1:~# hwclock -f /dev/rtc1 -v
hwclock from util-linux 2.37.4
System Time: 1690975162.373458
Using the rtc interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2023/08/02 11:19:24
Hw clock time : 2023/08/02 11:19:24 = 1690975164 seconds since 1969
Time since last adjustment is 1690975164 seconds
Calculated Hardware Clock drift is 0.000000 seconds
2023-08-02 11:19:23.549038+00:00