DART-6UL WakeableGPIO: Difference between revisions

From Variscite Wiki
No edit summary
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{PageHeader|DART-6UL - Wakeable GPIO}} {{DocImage|category1=DART-6UL|category2=Yocto}} __toc__
{{PageHeader|DART-6UL - Wakeable GPIO}} {{DocImage|category1=Yocto|category2=Debian}}[[category:DART-6UL]] __toc__
\The power domains of all pins of the SOM are switched off in memory retention mode.\ => All GPIOs lose their state.<br>
In Suspend mode, The power domains of all pins of the SOM are switched off in memory retention mode => All GPIOs lose their state.<br>
The only domain that remains alive is RTC domain (SNVS) and the only pins that still accessible are bank 5 of the GPIO.<br>
The only domain that remains alive is RTC domain (SNVS) and the only pins that still accessible are bank 5 of the GPIO.<br>
The DART-6UL provides 4 external GPIO pins that are a part of bank 5, and can be used for waking the system up and for controlling external peripherals in sleep mode.<br>
The DART-6UL provides 4 external GPIO pins that are a part of bank 5, and can be used for waking the system up and for controlling external peripherals in sleep mode.<br>
<br>
In the below example we will use GPIO5_1 to wake up the system. This pin is exposed on J2.64 of the SOM and on pin J6.6 of the EVK.<br>


In teh below example we will use GPIO5_1 to wake up the system. This pin is exposed on J2.64 of the SOM and on pin J6.6 of the EVK.<br>
= Device tree adjustments =
Follow either the "Build the Linux kernel from source code" or "Customizing the Linux kernel" wiki pages and edit the the appropriate device tree for your board (arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi in the kernel source tree) according to the following instruction.<br>
If you build the kernel manually from source code, you should build only the device trees and copy them to your SD card.<br>


= Define GPIO as a key pad =
== Define GPIO as a key pad ==
Add the following section to the '''imx6ul-var-dart.dtsi''' file, right after leds section:
Add the following right after the leds section:
<pre>
<pre>
gpio_keys {
gpio_keys {
Line 15: Line 19:
autorepeat;
autorepeat;
button@21 {
button@21 {
label = "GPIO Key UP";
label = "GPIO Key UP";
linux,code = <103>;
linux,code = <103>;
gpios = <&gpio5 1 1>;
gpios = <&gpio5 1 1>;
gpio-key,wakeup;
gpio-key,wakeup;
};
};
};
};
</pre>
</pre>
= Add GPIO pad configuration =
 
Add the following section to the '''imx6ul-var-dart.dtsi''' file, into pinctrl_hog_1 group:
== Add GPIO pad configuration ==
Add the following in the pinctrl_hog_1 group for iMX6UL based SoMs:
<pre>
<pre>
MX6UL_PAD_SNVS_TAMPER1__GPIO5_IO01 0x1b0b0 /* WAKE gpio */
MX6UL_PAD_SNVS_TAMPER1__GPIO5_IO01 0x1b0b0 /* WAKE gpio */
</pre>
</pre>
= Compile and update the system =
If your SoM is based on iMX6ULL or iMX6ULZ, add instead
Follow [http://variwiki.com/index.php?title=DART-6UL_Yocto_Fido_R1_Build_Linux_out_of_tree#Build_Linux_out_of_Yocto_tree this section] to compile the updated files.<br>
If you are using NAND version SOM than follow [http://variwiki.com/index.php?title=DART-6UL_NAND_Flash_Burning#Flash_Linux_Kernel this section] to update the system. <br>
If you are using eMMC version SOM than use:
<pre>
<pre>
Copy files to Yocto BOOT partition:
MX6ULL_PAD_SNVS_TAMPER1__GPIO5_IO01 0x1b0b0 /* WAKE gpio */
$ mount /dev/mmcblk1p2  /tmp/media/mmcblk1p2
$ cp zImage-imx6ul-var-dart-emmc_wifi.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-emmc_wifi.dtb
$ cp zImage-imx6ul-var-dart-nand_wifi.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-nand_wifi.dtb
$ cp zImage-imx6ul-var-dart-sd_emmc.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-sd_emmc.dtb
$ cp zImage-imx6ul-var-dart-sd_nand.dtb /tmp/media/mmcblk1p1/imx6ul-var-dart-sd_nand.dtb
$ cp zImage /tmp/media/mmcblk1p1/zImage
$ sync
$ umount /tmp/media/mmcblk1p2
</pre>
= Reboot the system =
Reboot the system and wait for a login prompt
<pre>
$ reboot
</pre>
= Enter memory retension =
After this command the system will enter memory retension mode.<br>
The serial console will stop responding, all not needed power supplies will be shut down.
You can see that LEDs D30, D27 will turn off on the EVK.
<pre>
$ echo mem > /sys/power/state
</pre>
</pre>
= Enter memory retention mode =
On the target, if pm-utils is installed, run:
# pm-suspend
else run
# echo mem > /sys/power/state
= Wake up the system =
= Wake up the system =
Connect pins J6.6 and J6,8 with a jumper. It will wake the system up.<br>
Connect pins J6.6 and J6,8 with a jumper. It will wake the system up.<br>
You can also press PWR button to wake up the system.
<br>
You can also press the PWR button to wake up the system.

Latest revision as of 20:08, 30 October 2023

DART-6UL - Wakeable GPIO

In Suspend mode, The power domains of all pins of the SOM are switched off in memory retention mode => All GPIOs lose their state.
The only domain that remains alive is RTC domain (SNVS) and the only pins that still accessible are bank 5 of the GPIO.
The DART-6UL provides 4 external GPIO pins that are a part of bank 5, and can be used for waking the system up and for controlling external peripherals in sleep mode.

In the below example we will use GPIO5_1 to wake up the system. This pin is exposed on J2.64 of the SOM and on pin J6.6 of the EVK.

Device tree adjustments

Follow either the "Build the Linux kernel from source code" or "Customizing the Linux kernel" wiki pages and edit the the appropriate device tree for your board (arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi in the kernel source tree) according to the following instruction.
If you build the kernel manually from source code, you should build only the device trees and copy them to your SD card.

Define GPIO as a key pad

Add the following right after the leds section:

	gpio_keys {
		compatible = "gpio-keys";
		#address-cells = <1>;
		#size-cells = <0>;
		autorepeat;
		button@21 {
			label = "GPIO Key UP";
			linux,code = <103>;
			gpios = <&gpio5 1 1>;
			gpio-key,wakeup;
		};
	};

Add GPIO pad configuration

Add the following in the pinctrl_hog_1 group for iMX6UL based SoMs:

MX6UL_PAD_SNVS_TAMPER1__GPIO5_IO01	0x1b0b0 /* WAKE gpio */

If your SoM is based on iMX6ULL or iMX6ULZ, add instead

MX6ULL_PAD_SNVS_TAMPER1__GPIO5_IO01	0x1b0b0 /* WAKE gpio */

Enter memory retention mode

On the target, if pm-utils is installed, run:

# pm-suspend

else run

# echo mem > /sys/power/state

Wake up the system

Connect pins J6.6 and J6,8 with a jumper. It will wake the system up.

You can also press the PWR button to wake up the system.