GPIO power/wakeup button: power doesn't turn on

Post Reply
vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

Hi,

I am connecting a GPIO power button to Odroid C2 as described here: http://odroid.com/dokuwiki/doku.php?id= ... key_wakeup

The button works well: short click sends "suspend" and then "wakeup" events, long click sends "power off" event which is then confirmed on the screen.

But after I confirm power off on the screen and the device is turned off, the button doesn't turn it on. I tried short and long press, no success. The kernel log from USB/UART is empty.

Is there something I missed? Any hardware jumpers maybe? My boot.ini file is attached.
Attachments
boot.ini
(4.12 KiB) Downloaded 226 times

User avatar
odroid
Site Admin
Posts: 38033
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1999 times
Been thanked: 1206 times
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by odroid »

Did you edit/compile/flash the DT(device tree) correctly?

vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

Yes, double checked that. The meson64_odroidc2.dts file is attached. The following code is there:

Code: Select all

...
gpio_keypad{
    .
    status = "okay";
    .
};
...
Attachments
meson64_odroidc2.dts.txt
(22.27 KiB) Downloaded 203 times

vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

Here is the log

Code: Select all

root@builder:~/android/odroid-c2/kernel# make dtbs
KBUILD_CFLAGS_MODULE:-DMODULE  
  DTC     arch/arm64/boot/dts/meson64_odroidc2.dtb
Warning (reg_format): "reg" property in /spi-gpio/spi-gpio@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
Warning (avoid_default_addr_size): Relying on default #address-cells value for /spi-gpio/spi-gpio@0
Warning (avoid_default_addr_size): Relying on default #size-cells value for /spi-gpio/spi-gpio@0

#### make completed successfully  ####

root@builder:~/android/odroid-c2/kernel# fastboot flash dtb /home/seva/android/odroid-c2/kernel/arch/arm64/boot/dts/meson64_odroidc2.dtb
target reported max download size of 536870912 bytes
sending 'dtb' (29 KB)...
OKAY [  0.004s]
writing 'dtb'...
OKAY [  0.104s]
finished. total time: 0.109s
root@builder:~/android/odroid-c2/kernel# fastboot reboot
rebooting...

finished. total time: 0.100s

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: GPIO power/wakeup button: power doesn't turn on

Post by joy »

Hi.
I will double-check the operation tomorrow.

Could you share which Android version you're using?

vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

I built the following Android version: s905_6.0.1_master

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: GPIO power/wakeup button: power doesn't turn on

Post by joy »

Hi vmayorow,

I've checked gpio wakeup with the latest version of Android Marshmallow v3.3
and confirmed it's working normally.
http://odroid.com/dokuwiki/doku.php?id= ... allow_v3.3
I modified gpio_keypad's status of meson64_odroidc2.dts
( status = "disabled" -> status = "okay" )
and then compiled and fusing dtb as you did.
https://github.com/hardkernel/linux/blo ... 2.dts#L832

Could you check your u-boot version?
Its version should be later version than Feb 24, 2017.
( If you don't have USB-UART module kit,please refer to the following wiki page.
http://odroid.com/dokuwiki/doku.php?id= ... user_space )

And the key press holding time should be higher than 2~3 seconds. (Long key event)
You said sleep and wakeup using gpio keypad work well,
so I think gpio keypad flow has no problem with your environment.
Please check key press time after poweroff.

vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

Thank you for your response!

Please could you confirm that I get the latest version (Android Marshmallow v3.3) and U-Boot later version than Feb 24, 2017 when I get the source codes from the repository by following this manual: http://odroid.com/dokuwiki/doku.php?id= ... ng_android

I use the commands:

Code: Select all

repo init -u https://github.com/hardkernel/android.git -b s905_6.0.1_master
repo sync
repo start s905_6.0.1_master --all
If this is not the latest version of the OS source codes, please advise where to get the latest version.

Luke.go
Posts: 652
Joined: Mon May 30, 2016 1:55 pm
languages_spoken: english
Has thanked: 91 times
Been thanked: 99 times
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by Luke.go »

Hi there.
You got the latest version of the Android source code. :)

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: GPIO power/wakeup button: power doesn't turn on

Post by joy »

Hi,
As Luke.go mentioned, you can get the latest version using the commands.
(Thanks Luke!)

And if you want to confirm the last log in your local workspace, check the git log in kernel and u-boot.

Code: Select all

# cd ${android_root_path}/kernel
# git log

Code: Select all

# cd ${android_root_path}/bootable/uboot
# git log
You can find the log history and compare them with HK's git history. ;)
https://github.com/hardkernel/linux/tre ... -android-m
https://github.com/hardkernel/u-boot/tr ... 2-v2015.01

vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

I tried the image from here: http://odroid.com/dokuwiki/doku.php?id= ... allow_v3.3 and the button turns on the device.

I suppose I'm building an older version of kernel.

However, I looked at the git history for both uboot and kernel as you suggested, and found the latest commits on May 31st, 2017. But there are different versions of kernel.

How can I check which version of the kernel I'm building?

I see that you referred me to the branch odroidc2-3.14.y-android-m. Should I checkout this particular branch and build it, rather than using the default kernel branch in the Android source codes?

vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

I have replaced u-boot, kernel and dts in your prebuilt image by u-boot, kernel and dts built by me.

Code: Select all

fastboot flash bootloader out/target/product/odroidc2/u-boot.bin
fastboot flash boot kernel/arch/arm64/boot/Image
fastboot flash dtb kernel/arch/arm64/boot/dts/meson64_odroidc2.dtb
The power button still works. That is magic.

I found the following text in your manual:

"The 1st stage bootloader, bl1.bin.hardkernel, is provided as prebuilt binary only.
The u-boot binary needs to be signed. This is done by an x86-64 executable, aml_encrypt_gxb, which is shipped with the u-boot source; source for aml_encrypt_gxb is not available.."

Could that be the reason why the power button doesn't work? Where can I get the 1st stage bootloader? Can I extract it from your image and move it to my image?

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: GPIO power/wakeup button: power doesn't turn on

Post by joy »

Well, I can't guess the reason. :(

The wake-up action after power-off works on bl301.bin of u-boot.
I updated the relevant commit on HK's github on Feb 15, 2017.
https://github.com/hardkernel/u-boot/co ... ed13ebe290

When you compile u-boot source code, it makes a new ./sd_fuse/u-boot.bin including ./fip/gxb/bl301.bin.

Code: Select all

u-boot/fip/gxb/bl301.bin  -> u-boot/sd_fuse/u-boot.bin
So if you have the latest u-boot source code and compile it then flash it, it must work with wake-up using the gpio key.

Actually, I expected your bl301.bin was an old version before Feb 15, 2017,
so I asked you to check and update source version including u-boot.

To make sure, can I ask one more?
When you compile the latest u-boot again and flash it, does it still NOT work?

vmayorow
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: GPIO power/wakeup button: power doesn't turn on

Post by vmayorow »

Looks like I flashed u-boot from a wrong place or got the wrong version of u-boot. I have removed u-boot/sd_fuse/u-boot.bin, then rebuilt u-boot and flashed it:

fastboot flash bootloader u-boot/sd_fuse/u-boot.bin

The button works now.

Thank you for the assistance!

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: GPIO power/wakeup button: power doesn't turn on

Post by joy »

Thank you for sharing the status.
I'm glad to know it works well! :D
I think we need to make up the wiki page for troubleshooting. ;)

Post Reply

Return to “Android”

Who is online

Users browsing this forum: No registered users and 6 guests