Open main menu

DAVE Developer's Wiki β

Difference between revisions of "DESK-MP1-L/Peripherals/RTC"

< DESK-MP1-L
(Created page with "== On-board RTC == An on-board Maxim Integrated DS3232 device provides a very accurate, temperature-compensated real-time clock (RTC) resource with: * Temperature-compensated...")
 
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== On-board RTC ==
+
<section begin=History/>
An on-board Maxim Integrated DS3232 device provides a very accurate, temperature-compensated real-time clock (RTC) resource with:
+
{| style="border-collapse:collapse; "
 +
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
 +
|-  
 +
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
 +
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 +
|-
 +
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|2023/08/02
 +
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|DESK-MP1-L-1.0.0 release
 +
|-
 +
|}
 +
<section end=History/>
 +
<section begin=Body/>
  
* Temperature-compensated crystal oscillator
+
== Pheripheral RTC ==
* Date, time and calendar
 
* Alarm capability
 
* Backup power from external battery
 
* ±3.5ppm accuracy from -40°C to +85°C
 
* 236 Bytes of Battery-Backed SRAM
 
* I²C Interface
 
  
Backup power is provided through the RTC_VBAT. If not used, RTC_VBAT must be externally connected to VCC.
+
On [[ETRA_SBC | SBC ETRA]] there are two rtc one on [[ETRA_SOM | ETRA SOM]] and one on carrier board.
  
For a detailed description of RTC characteristics, please refer to the DS3232 datasheet.
+
<pre class="workstation-terminal">
 +
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
 +
</pre>
 +
 
 +
=== Device tree configuration ===
 +
 
 +
<pre>
 +
...
 +
...
 +
&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 */
 +
};
 +
...
 +
...
 +
</pre>
 +
 
 +
=== Linux messages at boot time ===
 +
 
 +
<pre class="workstation-terminal">
 +
...
 +
[    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
 +
...
 +
</pre>
 +
 
 +
=== Usage with ''hwclock'' ===
 +
 
 +
<pre class="workstation-terminal">
 +
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
 +
</pre>
 +
 
 +
----
 +
 
 +
[[Category:ETRA]] [[Category:ETRA_SBC]]

Latest revision as of 11:13, 8 January 2024

History
Issue Date Notes
2023/08/02 DESK-MP1-L-1.0.0 release


Contents

Pheripheral RTCEdit

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 configurationEdit

...
...
&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 timeEdit

...
[    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 hwclockEdit

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