IMX RTC

From Variscite Wiki
Revision as of 18:44, 17 March 2019 by Eran (talk | contribs)
Real Time Clock (RTC)

Setting the RTC

First set the system date & time:

# date --set="20171231 23:59"

Then set the HW RTC using the system date & time:

# hwclock --systohc --utc


Power down your board, wait 5 minutes and power up again, then check you system date & time and verify it is correct:

# date

Wakeup using the RTC

Wakeup using the RTC requires hardware connection of ISL12057 IRQ2# pin to a SoC GPIO (in this example GPIO1_01).
Configure your kernel and add Intersil ISL12057 driver. Device Drivers -> Real Time Clock -> <*> Intersil ISL12057.
For VAR-SOM-MX6, edit arch/arm/boot/dts/imx6qdl-var-som.dtsi
For DART-MX6, edit arch/arm/boot/dts/imx6qdl-var-dart.dtsi

rtc@0x68 {
	compatible = "isil,isl12057";
	reg = <0x68>;
	interrupt-parent = <&gpio1>;
	interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
};

Follow the "Build Linux from source code" guide to build the kernel and device trees and to copy them to your SD card. Don't forget to also build and install the kernel modules.
For example, to set the RTC to wakeup after 10 seconds type:

# echo enabled > /sys/class/rtc/rtc0/device/power/wakeup
# rtcwake -m mem -d rtc0 -s 10

For more options, like waking up at a specific time, run:

# rtcwake --help