DART-MX8M RTC: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use RELEASE_SUMO_V1.0_DART-MX8M as default
<!-- Set release according to "release" parameter in URL and use RELEASE_SUMO_V1.0_DART-MX8M as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release|RELEASE_SUMO_V1.0_DART-MX8M}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_SUMO_V1.0_DART-MX8M}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Real Time Clock (RTC)}} {{DocImage|category1=Yocto|category2=DART-MX8M}}[[Category:DART-MX8M-MINI]][[Category:Debian]] __toc__
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Real Time Clock (RTC)}} {{DocImage|category1=Yocto|category2=Debian}}[[Category:DART-MX8M]][[Category:DART-MX8M-MINI]][[Category:DART-MX8M-PLUS]] __toc__
= Setting the RTC =
= Setting the RTC =
First set the system date & time:
First set the system date & time:
Line 14: Line 15:
= Wake-up using the RTC =
= Wake-up using the RTC =
Wake-up using the RTC requires hardware connection of RTC IRQ pin to a SoC GPIO.<br>
Wake-up using the RTC requires hardware connection of RTC IRQ pin to a SoC GPIO.<br>
On DART-MX8M and DART-MX8M-MINI carrier boards RTC IRQ pin is connected to GPIO1_15.<br>
On DART-MX8M, DART-MX8M-MINI and DART-MX8M-PLUS carrier boards RTC IRQ pin is connected to GPIO1_15.<br>
On VAR-SOM-MX8M-MINI and VAR-SOM-MX8M-NANO carrier boards RTC IRQ pin is not connected.<br>
On VAR-SOM-MX8M-MINI, VAR-SOM-MX8M-NANO VAR-SOM-MX8M-PLUS carrier boards RTC IRQ pin is not connected.<br>
 
== Kernel configuration ==
Configure your kernel and add relevant RTC driver.<br>
For all Variscite i.MX8 carrier baards this is Device Drivers -> Real Time Clock  -> <*> Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025, ISL12057.<br>
 
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |
Edit arch/arm64/boot/dts/{{#ifeq: {{#var:YOCTO_NAME}}|Morty|variscite/imx8m-var-dart-common.dtsi|freescale/fsl-imx8mq-var-dart-common.dtsi}} under Linux kernel source directory:
<pre>
&i2c2 {
...
rtc@0x68 {
status = "okay";
compatible = "dallas,ds1337";
reg = <0x68>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_rtc>;
interrupt-parent = <&gpio1>;
interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
        };
        ...
};
 
&iomuxc {
...
imx8m-var-dart {
                ...
pinctrl_rtc: rtcgrp {
fsl,pins = <
MX8MQ_IOMUXC_GPIO1_IO15_GPIO1_IO15 0xc1
>;
};
                ...
};
</pre>
|
Edit arch/arm64/boot/dts/freescale/fsl-imx8mm-var-dart.dts under Linux kernel source directory:
<pre>
&i2c2 {
...
rtc@0x68 {
status = "okay";
compatible = "dallas,ds1337";
reg = <0x68>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_rtc>;
interrupt-parent = <&gpio1>;
interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
        };
        ...
};
 
&iomuxc {
...
imx8mm-var-dart {
                ...
pinctrl_rtc: rtcgrp {
fsl,pins = <
MX8MM_IOMUXC_GPIO1_IO15_GPIO1_IO15 0x1c1
>;
};
                ...
};
</pre>
}}
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 ==
== Using rtcwake command ==

Revision as of 02:58, 2 March 2021

DART-MX8M - 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

Wake-up using the RTC

Wake-up using the RTC requires hardware connection of RTC IRQ pin to a SoC GPIO.
On DART-MX8M, DART-MX8M-MINI and DART-MX8M-PLUS carrier boards RTC IRQ pin is connected to GPIO1_15.
On VAR-SOM-MX8M-MINI, VAR-SOM-MX8M-NANO VAR-SOM-MX8M-PLUS carrier boards RTC IRQ pin is not connected.

Using rtcwake command

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