IMX RTC: Difference between revisions

From Variscite Wiki
No edit summary
Line 1: Line 1:
{{PageHeader|Real Time Clock (RTC)}} {{DocImage|category1=Yocto|category2=VAR-SOM-MX6}}[[Category:DART-6UL]][[Category:VAR-SOM-MX7]] __toc__
<!-- Set release according to "release" parameter in URL and use RELEASE_THUD_V1.1_DART-6UL as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release|RELEASE_THUD_V1.1_DART-6UL}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Real Time Clock (RTC)}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__
= Setting the RTC =
= Setting the RTC =
First set the system date & time:
First set the system date & time:
Line 5: Line 9:
Then set the HW RTC using the system date & time:
Then set the HW RTC using the system date & time:
  # hwclock --systohc --utc
  # hwclock --systohc --utc
<br>
 
Power down your board, wait 5 minutes and power up again, then check you system date & time and verify it is correct:
Power down your board, wait 5 minutes and power up again, then check you system date & time and verify it is correct:
  # date
  # date


= Wakeup using the RTC =
= Wakeup using the RTC =
Wakeup using the RTC requires hardware connection of ISL12057 IRQ2# pin to a SoC GPIO (in this example GPIO1_01).<br>
All Variscite EVKs mount RTC ISL12057, however wakeup using the RTC requires hardware connection of ISL12057 IRQ2# pin to a SoC GPIO.<br>
Configure your kernel and add Intersil ISL12057 driver. Device Drivers -> Real Time Clock  -> <*> Intersil ISL12057.<br>
By default, the defconfig of latest kernels already enable the Intersil ISL12057 driver.<br>
For VAR-SOM-MX6, edit arch/arm/boot/dts/imx6qdl-var-som.dtsi<br>
The kernel configuration item is available in Device Drivers -> Real Time Clock  -> <*> Intersil ISL12057.<br>
For DART-MX6, edit arch/arm/boot/dts/imx6qdl-var-dart.dtsi
{{#ifeq: {{#var:SOC}} | mx6 |
<pre>
For VAR-SOM-SOLO/VAR-SOM-DUAL/VAR-SOM-MX6 on MX6CustomBoard, SoloCustomBoard and SymphonyBoard, RTC IRQ#2 pin is not available: RTC has no wakeup capabilities.<br>
rtc@0x68 {
For DART-MX6 on DT6CustomBoard, RTC IRQ#2 pin is not available: RTC has no wakeup capabilities.
compatible = "isil,isl12057";
|}}
reg = <0x68>;
{{#ifeq: {{#var:SOC}} | mx6ul |
interrupt-parent = <&gpio1>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
};
</pre>
For DART-6UL, the file arch/arm/boot/dts/imx6ul-imx6ull-var-dart-6ulcustomboard.dtsi already propose
For DART-6UL, the file arch/arm/boot/dts/imx6ul-imx6ull-var-dart-6ulcustomboard.dtsi already propose
<pre>
<pre>
Line 33: Line 33:
};
};
</pre>
</pre>
For VAR-SOM-6UL on ConcertoBoard, connect pins J14.8 & J14.10 and edit arch/arm/boot/dts/imx6ul-imx6ull-var-som-concerto-board.dtsi
For VAR-SOM-6UL on ConcertoBoard, connect pins J14.8 & J14.10 and edit arch/arm/boot/dts/imx6ul-imx6ull-var-som-concerto-board.dtsi to declare GPIO1_IO10 as IRQ#2 pin.
<pre>
<pre>
rtc@0x68 {
rtc@0x68 {
Line 44: Line 44:
};
};
</pre>
</pre>
On Symphony board, RTC IRQ#2 pin is not available: RTC has no wakeup capabilities.
For VAR-SOM-6UL on SymphonyBoard, RTC IRQ#2 pin is not available: RTC has no wakeup capabilities.
|}}
{{#ifeq: {{#var:SOC}} | mx7 |
For VAR-SOM-MX7 on MX7CustomBoard, RTC IRQ#2 pin is not available: RTC has no wakeup capabilities.
|}}
{{#ifeq: {{#var:SOC_SERIES}} | imx8 |
For {{#var:HARDWARE_NAME}} on SymphonyBoard, RTC IRQ#2 pin is not available: RTC has no wakeup capabilities.<br>
|}}


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.<br>
== Using rtcwake command ==
For example, to set the RTC to wakeup after 10 seconds type:
Assuming the your board has wakeup capabilities, to set the RTC to wakeup after 10 seconds type:
  # echo enabled > /sys/class/rtc/rtc0/device/power/wakeup
  # echo enabled > /sys/class/rtc/rtc0/device/power/wakeup
  # rtcwake -m mem -d rtc0 -s 10
  # rtcwake -m mem -d rtc0 -s 10
For more options, like waking up at a specific time, run:
For more options, like waking up at a specific time, run:
  # rtcwake --help
  # rtcwake --help

Revision as of 17:39, 28 March 2021

DART-6UL - 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

All Variscite EVKs mount RTC ISL12057, however wakeup using the RTC requires hardware connection of ISL12057 IRQ2# pin to a SoC GPIO.
By default, the defconfig of latest kernels already enable the Intersil ISL12057 driver.
The kernel configuration item is available in Device Drivers -> Real Time Clock -> <*> Intersil ISL12057.

For DART-6UL, the file arch/arm/boot/dts/imx6ul-imx6ull-var-dart-6ulcustomboard.dtsi already propose

rtc@0x68 {
	compatible = "dallas,ds1337";
	reg = <0x68>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_rtc>;
	interrupt-parent = <&gpio5>;
	interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
};

For VAR-SOM-6UL on ConcertoBoard, connect pins J14.8 & J14.10 and edit arch/arm/boot/dts/imx6ul-imx6ull-var-som-concerto-board.dtsi to declare GPIO1_IO10 as IRQ#2 pin.

rtc@0x68 {
	compatible = "dallas,ds1337";
	reg = <0x68>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_rtc>;
	interrupt-parent = <&gpio1>;
	interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
};

For VAR-SOM-6UL on SymphonyBoard, RTC IRQ#2 pin is not available: RTC has no wakeup capabilities.


Using rtcwake command

Assuming the your board has wakeup capabilities, 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