Real Time Clock (RTC)¶
Setting the RTC¶
Please note that starting from kernel 5.x the RTC node in the device tree must not include the IRQ pin declaration if it is not actually connected. If a wrong declaration is present the hwclock command will fail.
First set the system date & time:
Then set the HW RTC using the system date & time:
Power down your board, wait 5 minutes and power up again, then check you system date & time and verify it is correct:
Wakeup using the RTC¶
The RTC node uses compatible = "dallas,ds1337".
The kernel configuration enables the RTC_DRV_DS1307 driver, which supports
this device. The kernel configuration option is CONFIG_RTC_DRV_DS1307.
For DART-MX8M-MINI on the carrier board, the device tree configures the
RTC interrupt and enables wakeup-source.
Using rtcwake command¶
Assuming the your board implement RTC wakeup capabilities, ensure RTC and system time are synchronized
Then set the RTC to wake up after 10 seconds:
echo enabled > /sys/class/rtc/rtc0/device/power/wakeup
echo `date "+%s" -d "+ 10 seconds"` > /sys/class/rtc/rtc0/wakealarm
And immediately suspend the machine: