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 = "nxp,pcf85263".
The corresponding kernel driver is CONFIG_RTC_DRV_PCF85363.
For VAR-SMARC-MX8M-PLUS on EchoCustomBoard, the device tree configures the
RTC interrupt through the GPIO expander 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: