How to trigger wake event through Jetson AGX Xavier GPIO

Hi everyone,

I recently bought a jetson AGX Xavier for a robotic project. The jetson will be in charge of all the robotic features such as navigation and object detection which is connected to a custom electronic card containing a STM32 microcontroller which is in charge of the control of all the sensors and actuators.

My first goal is currently to put the jetson in sleep mode when my system is powered off and to wake it up when it is powered on, this to avoid waiting a long time between each system boot.

For this purpose I know that to enter in sleep mode we can use this command :

sudo bash -c "echo -n mem > /sys/power/state"

Now to wake up the jetson I want to do it by setting some GPIOs on the jetson to LOW or HIGH level externally from my custom card to trigger a wake event. I know through the documentation that it is possible to trigger a wake event on pins that are configured for this purpose, however I don’t know how to achieve that.

Can someone give me some explanations about how to setup a Xavier’s pin to act as a wake event from a rising edge?

Thanks in advance for your answer !

1 Like

Hi TD05Educat,

Please go to the xavier device tree(dts) and search for “gpio-keys”.

gpio-keys {
 		compatible = "gpio-keys";
 		gpio-keys,name = "gpio-keys";
 
 		forcerecovery {
 			label = "force-recovery";
 			gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(G, 0) GPIO_ACTIVE_LOW>;
 			linux,code = <BTN_1>;
 		};
 
 		power_key {
 			label = "power-key";
 			gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(EE, 4) GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_POWER>;
 			gpio-key,wakeup;
 		};
 	};
};

You could register a new key here.

And you could monitor the key event by some tools. For example, I am trying to monitor the key_volumedown and volumeup on my tx2 with below commands.

nvidia@nvidia-desktop:/dev/input$ sudo evtest /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 116 (KEY_POWER)
Properties:
Testing ... (interrupt to exit)
Event: time 1582269997.329261, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 1582269997.329261, -------------- SYN_REPORT ------------
Event: time 1582269997.514287, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 1582269997.514287, -------------- SYN_REPORT ------------
Event: time 1582269998.869235, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 1582269998.869235, -------------- SYN_REPORT ------------
Event: time 1582269999.045246, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 1582269999.045246, -------------- SYN_REPORT ------------
Event: time 1582270000.358204, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 1582270000.358204, -------------- SYN_REPORT ------------
Event: time 1582270000.527246, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 1582270000.527246, -------------- SYN_REPORT ------------
Event: time 1582270001.435317, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 1582270001.435317, -------------- SYN_REPORT ------------
Event: time 1582270001.640221, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 1582270001.640221, -------------- SYN_REPORT ------------

reference:
https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt

1 Like

Hi WayneWWW,

Thank you very much for your answer, I will set up this as soon as possible.

Have a nice day !

Hi WayneWWW
I am using the same way to wake up nano,but this way can’t be waken up

Hi,

Please file a topic on jetson nano forum and describe more detail about your issue.

您好,我最近购买了数台Jetson AGX Xavier和Jetson Xavier NX ,用于电力行业上的 应用。
我们想要的目标是能否通过外设开关触发让主机进入到休眠状态(并且需要时可以唤醒),这两个主板上是否有触发睡眠的接口。

如果通过触发让主机休眠和唤醒,有什么方案呢
多谢,解答

Hi 798749812.

Pleas open a new topic for your issue, Thanks