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

Moderators: mdrjr, odroid

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

Unread postby vmayorow » Sat Jul 08, 2017 3:10 pm

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 11 times
vmayorow
 
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2

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

Unread postby odroid » Sat Jul 08, 2017 4:22 pm

Did you edit/compile/flash the DT(device tree) correctly?
User avatar
odroid
Site Admin
 
Posts: 23641
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

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

Unread postby vmayorow » Sat Jul 08, 2017 5:06 pm

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 7 times
vmayorow
 
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2

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

Unread postby vmayorow » Sat Jul 08, 2017 5:12 pm

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
vmayorow
 
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2

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

Unread postby joy » Sun Jul 09, 2017 2:02 pm

Hi.
I will double-check the operation tomorrow.

Could you share which Android version you're using?
joy
 
Posts: 279
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

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

Unread postby vmayorow » Sun Jul 09, 2017 7:35 pm

I built the following Android version: s905_6.0.1_master
vmayorow
 
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2

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

Unread postby joy » Mon Jul 10, 2017 10:42 am

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.
joy
 
Posts: 279
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

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

Unread postby vmayorow » Mon Jul 10, 2017 2:18 pm

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.
vmayorow
 
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2

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

Unread postby Luke.go » Mon Jul 10, 2017 2:33 pm

Hi there.
You got the latest version of the Android source code. :)
Luke.go
 
Posts: 96
Joined: Mon May 30, 2016 1:55 pm
languages_spoken: english

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

Unread postby joy » Mon Jul 10, 2017 7:34 pm

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
joy
 
Posts: 279
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

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

Unread postby vmayorow » Sat Jul 15, 2017 5:19 pm

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

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

Unread postby vmayorow » Sat Jul 15, 2017 8:19 pm

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?
vmayorow
 
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2

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

Unread postby joy » Sun Jul 16, 2017 9:10 pm

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?
joy
 
Posts: 279
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

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

Unread postby vmayorow » Mon Jul 17, 2017 10:52 pm

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!
vmayorow
 
Posts: 17
Joined: Tue Jul 04, 2017 11:15 pm
languages_spoken: english
ODROIDs: Odroid C2

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

Unread postby joy » Tue Jul 18, 2017 10:51 am

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. ;)
joy
 
Posts: 279
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X


Return to Android

Who is online

Users browsing this forum: No registered users and 4 guests