DART-MX8M RTC: Difference between revisions
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- | --> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- | ||
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-MX8M}}}} <!-- | --> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-MX8M}}}} <!-- | ||
-->{{PageHeader|RTC}} {{DocImage|category1=Yocto|category2=VAR-SOM-MX6}}[[Category:DART- | --> {{PageHeader|{{#var:HARDWARE_NAME}} RTC}} {{DocImage|category1=Yocto|category2=VAR-SOM-MX6}}[[Category:DART-MX8M]][[Category:DART-MX8M-MINI]] __toc__ | ||
= Setting the RTC = | = Setting the RTC = | ||
To set the RTC first set the date from Linux shell, type:<br> | To set the RTC first set the date from Linux shell, type:<br> | ||
Line 13: | Line 13: | ||
= 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 (on | Wake-up using the RTC requires hardware connection of RTC IRQ pin to a SoC GPIO (on {{#var:HARDWARE_NAME}} carrier board this is GPIO1_15).<br> | ||
Configure your kernel and add relevant RTC driver. For | Configure your kernel and add relevant RTC driver. For {{#var:HARDWARE_NAME}} carrier this is Device Drivers -> Real Time Clock -> <*> Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025, ISL12057.<br> | ||
Edit {{#ifeq: {{#var:YOCTO_NAME}} | Morty |variscite/imx8m-var-dart-common.dtsi|freescale/fsl-imx8mq-var-dart-common.dtsi}} under Linux kernel source directory <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 <br> | |||
<pre> | <pre> | ||
Line 34: | Line 35: | ||
&iomuxc { | &iomuxc { | ||
... | ... | ||
imx8m-var-dart { | |||
... | ... | ||
pinctrl_rtc: rtcgrp { | pinctrl_rtc: rtcgrp { | ||
Line 44: | Line 45: | ||
}; | }; | ||
</pre> | </pre> | ||
| | |||
Edit arch/arm64/boot/dts/freescale/fsl-imx8mm-var-dart.dts under Linux kernel source directory <br> | |||
<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> | 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> | ||
For example, to set the RTC to wakeup after 10 seconds type: | For example, to set the RTC to wakeup after 10 seconds type: |
Revision as of 08:26, 28 February 2019
Setting the RTC
To set the RTC first set the date from Linux shell, type:
$ date --set="20171231 23:59"
Then set the real time clock from Linux shell, type:
$ hwclock --systohc --utc
Power down your board wait 5 minutes and power up. Check your system with date and the time should be up to date.
Wake-up using the RTC
Wake-up using the RTC requires hardware connection of RTC IRQ pin to a SoC GPIO (on carrier board this is GPIO1_15).
Configure your kernel and add relevant RTC driver. For carrier this is Device Drivers -> Real Time Clock -> <*> Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025, ISL12057.
Edit arch/arm64/boot/dts/freescale/fsl-imx8mm-var-dart.dts under Linux kernel source directory
&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 >; }; ... };
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