We're no longer updating This wiki!!

This is an old revision of the document!


Power Off and Wake Up using GPIO Key Button

This section describes how to set up GPIO key button for power off and wake up purpose.

The brief set-up flow is as following.

  1. Connect a tab button to the pin port you want to use
  2. Set GPIO number using boot.ini
  3. Compiling and flash the modified kernel dts : This part is only needed on ANDROID.

1. Hardware Set-Up

First, You need to prepare a tab switch that are connected to two lines.
Red line is for Power Button and another Gray line is for the active level line (Ground or 3.3V Power).

For example, we will use Pin#29 of 40pin expansion connector.

The pin is assigned to GPIOX.BIT0 and its GPIO number is #228.
Connect the red line to Pin#29.

Its default pin pulled status is high and switch active will be Low, so you should connect the gray line of tab switch to Ground (GND), Pin#30.

Pin Number
(Red Line)
GPIO Number Active Level
(Gray Line)
29 GPIO#228 Active Low (Pin 30)

Setting boot.ini

You can assign GPIO number with env gpiopower in boot.ini.

# gpio power key : J2 (2x20) Pin#29 , GPIOX.BIT0
setenv gpiopower "228"
...
...
setenv bootargs ${bootargs} gpiopower=${gpiopower}

Setting Power Button Action for Power Off

Ubuntu

When you turn the board off using power button, you need to change power key action pattern.

- Open Power Management Preferences : [System] → [Preferences] → [Hardware] → [Power Management]
- and then Select [General] tab

Android

In case of Android, one short power key event is used for sleep and with long key event, you can handle options of power off/reboot.
With Android Marshmallow v2.4 or higher version, it's available to enter power off sequence using long-pressing (5 sec).

Available Key Numbers

1. J2 - 2×20 pins

Pin Number Net Name GPIO Number Active Level Pin Number Net Name GPIO Number Active Level
1 3.3V Power 2 5.0V Power
3 I2CA_SDAN/A 4 5.0V Power
5 I2CA_SCLN/A 6 Ground
7 GPIOX.BIT21GPIO#249 High → Low 8 TXD1N/A
9 Ground 10 RXD1N/A
11 GPIOX.BIT19GPIO#247High → Low 12 GPIOX.BIT10GPIO#238High → Low
13 GPIOX.BIT11GPIO#239High → Low 14 Ground
15 GPIOX.BIT9GPIO#237High → Low 16 GPIOX.BIT8GPIO#236High → Low
17 3.3V Power 18 GPIOX.BIT5GPIO#233High → Low
19 GPIOX.BIT7GPIO#235High → Low 20 Ground
21 GPIOX.BIT4GPIO#232High → Low 22 GPIOX.BIT3GPIO#231High → Low
23 GPIOX.BIT2GPIO#230High → Low 24 GPIOX.BIT1GPIO#229High → Low
25 Ground 26 GPIOY.BIT14GPIO#225Low → High
27 I2CB_SDAN/A 28 I2CB_SCLN/A
29 GPIOX.BIT0GPIO#228High → Low 30 Ground
31 GPIOY.BIT8GPIO#219High → Low 32 GPIOY.BIT13GPIO#224High → Low
33 GPIOX.BIT6GPIO#234Low → High 34 Ground
35 GPIOY.BIT3GPIO#214High → Low 36 GPIOY.BIT7GPIO#218High → Low
37 ADC.AIN1N/A 38 1.8V PowerN/A
39 Ground 40 ADC.AIN0N/A

2. J7 - 1×7 pins

Pin Number Net Name GPIO Number Active Level
1 Ground
2 GPIOAO.BIT6GPIO#128High → Low
3 P5V05.0V Power
4 GPIOAO.BIT8GPIO#130High → Low
5 GPIOAO.BIT10GPIO#132High → Low
6 GPIOAO.BIT9GPIO#131High → Low
7 GPIOAO.BIT11GPIO#133High → Low

3. SW1


Pin Number Net Name GPIO Number Active Level
1 NCN/A
2 GPIOY.BIT5GPIO#216High → Low
3 GNDGround
en/c2_gpio_key_wakeup.1500888675.txt.gz · Last modified: 2017/07/24 18:01 by joy.cho
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0