How to add a power button to your N2

User avatar
odroid
Site Admin
Posts: 34906
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 954 times
Been thanked: 770 times
Contact:

How to add a power button to your N2

Post by odroid »

You can add a power button with a few wires soldering.
We've written a guide on this WiKi page.
https://wiki.odroid.com/odroid-n2/appli ... key_wakeup

The blue LED in the button flashes like heartbeat action, if you edit the device-tree file.
You may like this GIF animated image. ;)
Image
These users thanked the author odroid for the post (total 2):
istanbulls (Sun May 19, 2019 7:02 am) • Kernel (Wed May 29, 2019 5:42 am)

User avatar
rooted
Posts: 7888
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 724 times
Been thanked: 227 times
Contact:

Re: How to add a power button to your N2

Post by rooted »

Very nice, thanks for the how-to.

mad_ady
Posts: 8330
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 573 times
Been thanked: 438 times
Contact:

Re: How to add a power button to your N2

Post by mad_ady »

Nice case adjustment. You can leave an opening and it could be used for serial.
Would the power button sold with the h2 work as well?

User avatar
tobetter
Posts: 5517
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 220 times
Been thanked: 647 times
Contact:

Re: How to add a power button to your N2

Post by tobetter »

mad_ady wrote:
Mon Feb 25, 2019 8:15 pm
Nice case adjustment. You can leave an opening and it could be used for serial.
Would the power button sold with the h2 work as well?
Technically it is, the problem is the size. In terms of hardware, it would work.

hominoid
Posts: 437
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2
Location: Lake Superior Basin, USA
Has thanked: 39 times
Been thanked: 124 times
Contact:

Re: How to add a power button to your N2

Post by hominoid »

Thanks, much appreciated!

mad_ady
Posts: 8330
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 573 times
Been thanked: 438 times
Contact:

Re: How to add a power button to your N2

Post by mad_ady »

Out of curiosity, how did you cut through the case evenly?

User avatar
tobetter
Posts: 5517
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 220 times
Been thanked: 647 times
Contact:

Re: How to add a power button to your N2

Post by tobetter »

mad_ady wrote:
Tue Feb 26, 2019 12:45 am
Out of curiosity, how did you cut through the case evenly?
Simple, cut the surface with a drill and a cutter to make a hole and file until you have an 8 x 8.5mm square.

wallyz21
Posts: 139
Joined: Thu Apr 04, 2019 11:00 am
languages_spoken: english
ODROIDs: N2
Has thanked: 10 times
Been thanked: 16 times
Contact:

Re: How to add a power button to your N2

Post by wallyz21 »

Momentary or latched switch?

And the button diameter of the specific switch that you used is what, please?
Walter Zambotti
N2 - Ubuntu Mate Desktop

User avatar
tobetter
Posts: 5517
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 220 times
Been thanked: 647 times
Contact:

Re: How to add a power button to your N2

Post by tobetter »

wallyz21 wrote:
Thu Apr 11, 2019 12:14 pm
Momentary or latched switch?

And the button diameter of the specific switch that you used is what, please?
Momentary if you follow up the Wiki. Latched switch if you like to control the power at DC jack.
The hole for the switch in the Wiki is about 6-7mm.
https://www.aliexpress.com/item/Led-Lig ... 52543.html

sanangel
Posts: 4
Joined: Wed Apr 24, 2019 7:53 pm
languages_spoken: english, spanish
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by sanangel »

@odroide Thanks for the tutorial

User avatar
istanbulls
Posts: 254
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID-N2, ODROID C4
Location: Istanbul-Turkey
Has thanked: 140 times
Been thanked: 28 times
Contact:

Re: How to add a power button to your N2

Post by istanbulls »

Hi,
How to do Simple On/Off Odroid N2 Power button/switch.
I'm a beginner, can you teach it simply?
The led heartbeat do not want to led do not want, just power button.

Thank
Edit: I put a button on 9 and 11 GPIO pins, it works.

mad_ady
Posts: 8330
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 573 times
Been thanked: 438 times
Contact:

Re: How to add a power button to your N2

Post by mad_ady »

For heartbeat led try:

Code: Select all

echo none > /sys/class/leds/blue\:heartbeat/trigger

pillemats
Posts: 8
Joined: Mon Apr 03, 2017 2:19 am
languages_spoken: german, english
ODROIDs: xu4 + cloudshell
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by pillemats »

Hey

How does it works ?

Only Plug the button cables to gpio and it works ?
I dont Unterstand the tut because my English is Not the best.

I use my n2 with Batocera Linux for emulation!

Should i put the Button to gpio an thats it ?

Thx

pillemats
Posts: 8
Joined: Mon Apr 03, 2017 2:19 am
languages_spoken: german, english
ODROIDs: xu4 + cloudshell
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by pillemats »

kardanadm wrote:
Sun May 19, 2019 7:01 am
Hi,
How to do Simple On/Off Odroid N2 Power button/switch.
I'm a beginner, can you teach it simply?
The led heartbeat do not want to led do not want, just power button.

Thank
Edit: I put a button on 9 and 11 GPIO pins, it works.
Which Switch did you use ?

In my case it wont works

User avatar
tobetter
Posts: 5517
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 220 times
Been thanked: 647 times
Contact:

Re: How to add a power button to your N2

Post by tobetter »

pillemats wrote:
Sat Jun 15, 2019 4:00 am
kardanadm wrote:
Sun May 19, 2019 7:01 am
Hi,
How to do Simple On/Off Odroid N2 Power button/switch.
I'm a beginner, can you teach it simply?
The led heartbeat do not want to led do not want, just power button.

Thank
Edit: I put a button on 9 and 11 GPIO pins, it works.
Which Switch did you use ?

In my case it wont works
How did you connect the switch? And what's the switch you use?

pillemats
Posts: 8
Joined: Mon Apr 03, 2017 2:19 am
languages_spoken: german, english
ODROIDs: xu4 + cloudshell
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by pillemats »

This one for testing on Pin 9 + 11
Attachments
C4667522-5C26-48B4-A13C-75AD702012DD.jpeg
C4667522-5C26-48B4-A13C-75AD702012DD.jpeg (1.3 MiB) Viewed 14101 times

User avatar
tobetter
Posts: 5517
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 220 times
Been thanked: 647 times
Contact:

Re: How to add a power button to your N2

Post by tobetter »

@pillemats, the switch would work if you wire properly. Also, please double check your boot.ini.
https://wiki.odroid.com/odroid-n2/appli ... ng_bootini

pillemats
Posts: 8
Joined: Mon Apr 03, 2017 2:19 am
languages_spoken: german, english
ODROIDs: xu4 + cloudshell
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by pillemats »

How do i wired propably?

I think i Need a pic with the connections

Do you have it?

democles
Posts: 1
Joined: Thu Jul 11, 2019 10:33 pm
languages_spoken: english
ODROIDs: N2/U3/ C1+
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by democles »

Here is a picture with wat jou have to copy and past in the boot.ini file.
Works great :D
I edit it with WEBMIN.

aangepast.jpg
aangepast.jpg (155.76 KiB) Viewed 13482 times

joy
Posts: 1335
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 146 times
Been thanked: 163 times
Contact:

Re: How to add a power button to your N2

Post by joy »

pillemats wrote:
Sun Jun 16, 2019 5:53 am
How do i wired propably?

I think i Need a pic with the connections

Do you have it?
Do you have a PCB layout and circuit description of your button part?

Please refer to this wiki page for the wire connections.
https://wiki.odroid.com/odroid-n2/appli ... are_set-up
https://wiki.odroid.com/odroid-c2/appli ... are_set-up

superpowter77
Posts: 185
Joined: Mon Sep 09, 2019 9:14 pm
languages_spoken: english,french,spanish
ODROIDs: Odroid-N2+ 4Gb,N2 4Gb(2),C4
Has thanked: 19 times
Been thanked: 7 times
Contact:

Re: How to add a power button to your N2

Post by superpowter77 »

Very nice solution. Alternately, if you just want to play "safe" without getting your hands "dirty", you can just spend $12 USD bucks and get a "Smart Plug Mini WiFi Outlet" just for the Odroid-N2 with an On/Off switch controlled from any Android phone. Also, 100% compatible with Alexa and Google Home where a simply vocal command will suffice.

User avatar
istanbulls
Posts: 254
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID-N2, ODROID C4
Location: Istanbul-Turkey
Has thanked: 140 times
Been thanked: 28 times
Contact:

Re: How to add a power button to your N2

Post by istanbulls »

Boot.ini does not work when you change boot.ini for Ubuntu Mate

setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd}" Do not paste this code. Protect your existing code.

Code: Select all

 
setenv gpiopower "479"
setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} voutmode=${voutmode} ${cmode} disablehpd=${disablehpd} cvbscable=${cvbscable} overscan=${overscan} ${hid_quirks} monitor_onoff=${monitor_onoff} logo=osd0,loaded ${cec_enable}"
setenv bootargs ${bootargs} gpiopower=${gpiopower}

User avatar
odroid
Site Admin
Posts: 34906
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 954 times
Been thanked: 770 times
Contact:

Re: How to add a power button to your N2

Post by odroid »

Sorry for the inconvenience caused.
I've updated the wiki page.
https://wiki.odroid.com/odroid-n2/appli ... ng_bootini
These users thanked the author odroid for the post:
istanbulls (Wed Sep 18, 2019 5:05 pm)

superpowter77
Posts: 185
Joined: Mon Sep 09, 2019 9:14 pm
languages_spoken: english,french,spanish
ODROIDs: Odroid-N2+ 4Gb,N2 4Gb(2),C4
Has thanked: 19 times
Been thanked: 7 times
Contact:

Re: How to add a power button to your N2

Post by superpowter77 »

Excellent job. Finally,we have a well written and Visual documented guide to DIY.

vayd3r
Posts: 5
Joined: Tue Nov 26, 2019 1:13 am
languages_spoken: english
ODROIDs: N2, HC2
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by vayd3r »

I'm also trying to get this to work for Batocera linux. I have a momentary switch on pins 9 and 11. However, my kernel bootargs are different so I don't want to just paste in what's in the wiki. Is there a specific parameter on the bootargs line I should be looking for, or add?

Code: Select all

setenv bootargs "label=BATOCERA console=tty3 quiet loglevel=0 consoleblank=0 vt.global_cursor_default=0 hdmimode=${hdmimode} max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd}"

### wake stuff
setenv gpiopower "479"
setenv bootargs ${bootargs} gpiopower=${gpiopower}
I know the button works because I was using it for GPIO wake on a Raspberry Pi 3.

User avatar
tobetter
Posts: 5517
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 220 times
Been thanked: 647 times
Contact:

Re: How to add a power button to your N2

Post by tobetter »

vayd3r wrote:
Thu Nov 28, 2019 12:01 am
I'm also trying to get this to work for Batocera linux. I have a momentary switch on pins 9 and 11. However, my kernel bootargs are different so I don't want to just paste in what's in the wiki. Is there a specific parameter on the bootargs line I should be looking for, or add?

Code: Select all

setenv bootargs "label=BATOCERA console=tty3 quiet loglevel=0 consoleblank=0 vt.global_cursor_default=0 hdmimode=${hdmimode} max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd}"

### wake stuff
setenv gpiopower "479"
setenv bootargs ${bootargs} gpiopower=${gpiopower}
I know the button works because I was using it for GPIO wake on a Raspberry Pi 3.
I think the last two lines are fair enough to enable GPIO switch, it just adds gpiopower=479 right after disablehpd=${disablehpd} in the command line.

vayd3r
Posts: 5
Joined: Tue Nov 26, 2019 1:13 am
languages_spoken: english
ODROIDs: N2, HC2
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by vayd3r »

Right, that's what I originally thought. But since it wasn't working I figured there must be a necessary kernel parameter also.

So does pressing the button just cut power to the N2 while it's on? And when it's off you hold the button for 2 seconds to wake it? That's what I gathered from the wiki. Really confused as to why this isn't working.

User avatar
tobetter
Posts: 5517
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 220 times
Been thanked: 647 times
Contact:

Re: How to add a power button to your N2

Post by tobetter »

vayd3r wrote:
Thu Nov 28, 2019 2:03 am
Right, that's what I originally thought. But since it wasn't working I figured there must be a necessary kernel parameter also.

So does pressing the button just cut power to the N2 while it's on? And when it's off you hold the button for 2 seconds to wake it? That's what I gathered from the wiki. Really confused as to why this isn't working.
I am not sure if the Linux kernel for BATOCERA enables GPIO input driver or not when I had tried to run it last week for some other issue, even it does not give a kernel message or shell prompt. Then I've not looked into yet. Any idea if you can get a shell problem on it?

vayd3r
Posts: 5
Joined: Tue Nov 26, 2019 1:13 am
languages_spoken: english
ODROIDs: N2, HC2
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by vayd3r »

Yep I can get a shell on Batocera. Should I be seeing something in the kernel ring buffer (dmesg output) when I press the button? For the driver, is the kernel config option you’re talking about CONFIG_GPIO_GENERIC or is there another option that is needed? I can try to see if the kernel config is available through /proc/config.

Cosmicbase
Posts: 54
Joined: Tue Nov 26, 2019 2:31 am
languages_spoken: german
ODROIDs: Odroid N2
Has thanked: 7 times
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by Cosmicbase »

Hello I have used pin 1 and 6 for the LED and 9 and 11 for the switch.
Unfortunately, the LED burns permanently. The switch does not work as it should.
My Odroid N2 comes with CoreElec.

Did I do something wrong?
Gruß / Greatings Cosmicbase
Ich bin nicht blöd, auch wenn ich nur so tue! :lol:

User avatar
cdu13a
Posts: 309
Joined: Tue Jan 20, 2015 3:33 pm
languages_spoken: english
ODROIDs: C1, C2, XU4, HC1, N2
Has thanked: 12 times
Been thanked: 88 times
Contact:

Re: How to add a power button to your N2

Post by cdu13a »

Cosmicbase wrote:
Sat Jan 25, 2020 4:06 am
Hello I have used pin 1 and 6 for the LED and 9 and 11 for the switch.
Unfortunately, the LED burns permanently. The switch does not work as it should.
My Odroid N2 comes with CoreElec.

Did I do something wrong?
For the switch did you set gpiopower=479 in your config.ini file? This is required for the switch to work as a power switch. (479 = pin 11 for other pin numbers see https://wiki.odroid.com/odroid-n2/hardw ... connectors)

As for the LED, what did you intend the LED to indicate? Having it connected between the pin 1 (3.3v) and pin 6 (ground) means that it's will always have power.

Cosmicbase
Posts: 54
Joined: Tue Nov 26, 2019 2:31 am
languages_spoken: german
ODROIDs: Odroid N2
Has thanked: 7 times
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by Cosmicbase »

cdu13a wrote:
Sat Jan 25, 2020 9:09 am
Cosmicbase wrote:
Sat Jan 25, 2020 4:06 am
Hello I have used pin 1 and 6 for the LED and 9 and 11 for the switch.
Unfortunately, the LED burns permanently. The switch does not work as it should.
My Odroid N2 comes with CoreElec.

Did I do something wrong?
For the switch did you set gpiopower=479 in your config.ini file? This is required for the switch to work as a power switch. (479 = pin 11 for other pin numbers see https://wiki.odroid.com/odroid-n2/hardw ... connectors)

As for the LED, what did you intend the LED to indicate? Having it connected between the pin 1 (3.3v) and pin 6 (ground) means that it's will always have power.
Thank you for your answer.
I don't want the LED to be on all the time. I loved the heartbeat.
The best way to get the LED off is when the N2 is off.

Only this 2 lines in config.ini?
setenv gpiopower "479"
setenv bootargs ${bootargs} gpiopower=${gpiopower}

For heartbeat Do I seem to have to use #6 and #8?
What exactly do I have to write in .dtsi?
Gruß / Greatings Cosmicbase
Ich bin nicht blöd, auch wenn ich nur so tue! :lol:

User avatar
cdu13a
Posts: 309
Joined: Tue Jan 20, 2015 3:33 pm
languages_spoken: english
ODROIDs: C1, C2, XU4, HC1, N2
Has thanked: 12 times
Been thanked: 88 times
Contact:

Re: How to add a power button to your N2

Post by cdu13a »

Cosmicbase wrote:
Sat Jan 25, 2020 9:22 am
cdu13a wrote:
Sat Jan 25, 2020 9:09 am
Cosmicbase wrote:
Sat Jan 25, 2020 4:06 am
Hello I have used pin 1 and 6 for the LED and 9 and 11 for the switch.
Unfortunately, the LED burns permanently. The switch does not work as it should.
My Odroid N2 comes with CoreElec.

Did I do something wrong?
For the switch did you set gpiopower=479 in your config.ini file? This is required for the switch to work as a power switch. (479 = pin 11 for other pin numbers see https://wiki.odroid.com/odroid-n2/hardw ... connectors)

As for the LED, what did you intend the LED to indicate? Having it connected between the pin 1 (3.3v) and pin 6 (ground) means that it's will always have power.
Thank you for your answer.
I don't want the LED to be on all the time. I loved the heartbeat.
The best way to get the LED off is when the N2 is off.

Only this 2 lines in config.ini?
setenv gpiopower "479"
setenv bootargs ${bootargs} gpiopower=${gpiopower}

For heartbeat Do I seem to have to use #6 and #8?
What exactly do I have to write in .dtsi?
The setenv lines are for if you are changing the boot.ini file if you are using ubuntu or another similar os.

If you are using CoreELEC you just need to add just the the following line to the /flash/config.ini file.

Code: Select all

gpiopower=479
Also I should note that the /flash partition is mounted read only. So you will have to remount it to make it writable with the following command before you can edit the /flash/config.ini file

Code: Select all

mount -o remount,rw /flash
These users thanked the author cdu13a for the post:
kshi (Wed Apr 08, 2020 12:00 am)

User avatar
cdu13a
Posts: 309
Joined: Tue Jan 20, 2015 3:33 pm
languages_spoken: english
ODROIDs: C1, C2, XU4, HC1, N2
Has thanked: 12 times
Been thanked: 88 times
Contact:

Re: How to add a power button to your N2

Post by cdu13a »

Cosmicbase wrote:
Sat Jan 25, 2020 9:22 am

For heartbeat Do I seem to have to use #6 and #8?
What exactly do I have to write in .dtsi?
Yes pins #6(GND) and #8 (GPIOX.12) if you want to be able to control the LED.

However the following instructions on the wiki has a few problems.
Odroid Wiki - https://wiki.odroid.com/odroid-n2/application_note/gpio/gpio_key_wakeup#heartbeat_led_action_on_the_power_button_led wrote:
For LED heartbeat action, you need to modify this dtsi file, build dtb image again and replace meson64_odroidn2.dtb in /media/boot.
There are a few problems here if you want this to work with CoreELEC.
1. You would need to build a dtb file using the CoreELEC kernel source not the hardkernel source. Because CoreELEC uses a different kernel that is more optimized for media playback then the one that is used by hardkernel.
2. CoreELEC has a different name and location for it's dtb files.
3. CoreELEC updates it's dtb files when you update CoreELEC, which would overwrite any custom dtb file that you used.

I can solve the first two for you by making a dtb file with the required changes, and give you instructions on where it needs to be put. Which will get it working for you for now.
As for the last one I can talk with the other CoreELEC developers and see if we can work out a way of handling this type of LED mod better.

Cosmicbase
Posts: 54
Joined: Tue Nov 26, 2019 2:31 am
languages_spoken: german
ODROIDs: Odroid N2
Has thanked: 7 times
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by Cosmicbase »

OK that would be really great if you could help me with that.
Gruß / Greatings Cosmicbase
Ich bin nicht blöd, auch wenn ich nur so tue! :lol:

Cosmicbase
Posts: 54
Joined: Tue Nov 26, 2019 2:31 am
languages_spoken: german
ODROIDs: Odroid N2
Has thanked: 7 times
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by Cosmicbase »

So I don't need to change anything in Boot.ini?
Add "gpiopower = 479" only in config.ini?

setenv gpiopower "479"
setenv bootargs “$ {initargs} $ {displayopt} $ {coreelec} gpiopower = $ {gpiopower}”
Gruß / Greatings Cosmicbase
Ich bin nicht blöd, auch wenn ich nur so tue! :lol:

User avatar
cdu13a
Posts: 309
Joined: Tue Jan 20, 2015 3:33 pm
languages_spoken: english
ODROIDs: C1, C2, XU4, HC1, N2
Has thanked: 12 times
Been thanked: 88 times
Contact:

Re: How to add a power button to your N2

Post by cdu13a »

Cosmicbase wrote:
Sat Jan 25, 2020 11:50 pm
So I don't need to change anything in Boot.ini?
Add "gpiopower = 479" only in config.ini?

setenv gpiopower "479"
setenv bootargs “$ {initargs} $ {displayopt} $ {coreelec} gpiopower = $ {gpiopower}”

The part that needs to be in the boot.ini to handle the gpiopower setting is already there on CoreELEC. You just need to add the gpiopower=479 line to the config.ini file so that it knows which gpio pin your switch is attached to.

Cosmicbase
Posts: 54
Joined: Tue Nov 26, 2019 2:31 am
languages_spoken: german
ODROIDs: Odroid N2
Has thanked: 7 times
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by Cosmicbase »

@cdu13a
I've followed your steps and it works.
There are still ways to change the heartbeat.
For example, slower or faster or a soft fade-in and hide.

Thank you very much.
Gruß / Greatings Cosmicbase
Ich bin nicht blöd, auch wenn ich nur so tue! :lol:

mxmilkb
Posts: 64
Joined: Fri Apr 26, 2019 9:28 am
languages_spoken: English
ODROIDs: N2
Has thanked: 23 times
Been thanked: 21 times
Contact:

Re: How to add a power button to your N2

Post by mxmilkb »

I got this, works well for me.
These users thanked the author mxmilkb for the post:
jgmdev (Thu Feb 06, 2020 6:18 am)

Cosmicbase
Posts: 54
Joined: Tue Nov 26, 2019 2:31 am
languages_spoken: german
ODROIDs: Odroid N2
Has thanked: 7 times
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by Cosmicbase »

Hello, is there a way to control the LED in the power button brighter or darker?
I have disabled heartbeat. The power button works very well.
I just want to change the brightness of the LED.
Maybe there is also a smooth soft effect from light to dark ad return?
Gruß / Greatings Cosmicbase
Ich bin nicht blöd, auch wenn ich nur so tue! :lol:

Cosmicbase
Posts: 54
Joined: Tue Nov 26, 2019 2:31 am
languages_spoken: german
ODROIDs: Odroid N2
Has thanked: 7 times
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by Cosmicbase »

@cdu13a

Hello I use CoreElec up to date.
Heartbeat is not working.
I tried all but nothing helps.

Do I need to replace a .dtb or anything?
Gruß / Greatings Cosmicbase
Ich bin nicht blöd, auch wenn ich nur so tue! :lol:

naitreia
Posts: 31
Joined: Mon Mar 30, 2020 1:22 am
languages_spoken: english, german
ODROIDs: N2, XU4Q
Has thanked: 0
Been thanked: 0
Contact:

Re: How to add a power button to your N2

Post by naitreia »

tobetter wrote:
Thu Nov 28, 2019 12:29 am
vayd3r wrote:
Thu Nov 28, 2019 12:01 am
I'm also trying to get this to work for Batocera linux. I have a momentary switch on pins 9 and 11. However, my kernel bootargs are different so I don't want to just paste in what's in the wiki. Is there a specific parameter on the bootargs line I should be looking for, or add?

Code: Select all

setenv bootargs "label=BATOCERA console=tty3 quiet loglevel=0 consoleblank=0 vt.global_cursor_default=0 hdmimode=${hdmimode} max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd}"

### wake stuff
setenv gpiopower "479"
setenv bootargs ${bootargs} gpiopower=${gpiopower}
I know the button works because I was using it for GPIO wake on a Raspberry Pi 3.
I think the last two lines are fair enough to enable GPIO switch, it just adds gpiopower=479 right after disablehpd=${disablehpd} in the command line.
Hi,
i also try to get the power button work with batocera also without success...
I implemented like above but there is no reaction when i press the button...someone here to help?

XFer
Posts: 68
Joined: Wed Aug 19, 2015 7:09 pm
languages_spoken: english, italian
ODROIDs: C0, C1+, C2, N2
Has thanked: 6 times
Been thanked: 5 times
Contact:

Re: How to add a power button to your N2

Post by XFer »

Hello,
I'm on official HK Ubuntu Minimal 18.04 (headless), with latest updates:

Code: Select all

Linux odroid 4.9.216-69 #1 SMP PREEMPT Mon Mar 16 14:58:58 -03 2020 aarch64 aarch64 aarch64 GNU/Linux
Everything installed on microSD.

I've followed the instructions on the Wiki and connected a temporary switchbutton on pin9 (ground) and pin11.

My boot.ini has the following, related lines:

Code: Select all

### Power button on pin 11
setenv gpiopower "479"

# Boot Args
setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} voutmode=${voutmode} ${cmode} disablehpd=${disablehpd} cvbscable=${cvbscable} overscan=${overscan} ${hid_quirks} monitor_onoff=${monitor_onoff} ${cec_enable} sdrmode=${sdrmode}"
setenv bootargs "${bootargs} gpiopower=${gpiopower}"
Shutdown works well.
Power on (long button press) does not: the red light comes on, but the boot won't start (no blue light).

Is there anything I could try?

Thanks!

User avatar
odroid
Site Admin
Posts: 34906
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 954 times
Been thanked: 770 times
Contact:

Re: How to add a power button to your N2

Post by odroid »

You might need to set the slide switch position to "MMC" mode.
Also check the cmdline string whether the bootargs passed to the Linux kernel or not.

Code: Select all

cat /proc/cmdline

XFer
Posts: 68
Joined: Wed Aug 19, 2015 7:09 pm
languages_spoken: english, italian
ODROIDs: C0, C1+, C2, N2
Has thanked: 6 times
Been thanked: 5 times
Contact:

Re: How to add a power button to your N2

Post by XFer »

Hello, thanks for the support.

The slide switch is already (has always been) on MMC.

/proc/cmdline:

Code: Select all

root@odroid:~# cat /proc/cmdline
root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw console=ttyS0,115200n8  no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=480x320p60hz cvbsmode=576cvbs max_freq_a53=1896 max_freq_a73=1800 maxcpus=6 voutmode=hdmi  disablehpd=false cvbscable=0 overscan=100 usbhid.quirks=0x0eef:0x0005:0x0004 monitor_onoff=false  sdrmode=sdr gpiopower=479
The red light turns on, but that's all.
Nothings shows up on the serial console, either. :(

joy
Posts: 1335
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 146 times
Been thanked: 163 times
Contact:

Re: How to add a power button to your N2

Post by joy »

Hi @Xfer,
Thanks for sharing the cmdline.
It looks there is no issue of your boot.ini setup.

It's needed to check the boot loader version of ubuntu image that you're using.
I will check it soon from the latest Ubuntu image version.

And could you check the followings to confirm your test environment?
(1)
Can you check uboot version using this uboot command after entering u-boot console?

Code: Select all

# version
(2)
Which Ubuntu minimal image version are you using?

joy
Posts: 1335
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 146 times
Been thanked: 163 times
Contact:

Re: How to add a power button to your N2

Post by joy »

Hi @Xfer,
I've checked this function on the latest image of Ubuntu minimal, ( https://wiki.odroid.com/odroid-n2/os_im ... u/20200229 )
and confirmed it works normally.
This function implemented quite a while ago, so it would work unless you're using very old version. :roll:
As I checked your previous post, it looks you're using the latest ubuntu minimal image, right?
And connections looks OK. pin#9 & pin#11.

To boot up using power button, long press event over 1~2 second is needed.
Could you keep pushing your button for 2 seconds?

XFer
Posts: 68
Joined: Wed Aug 19, 2015 7:09 pm
languages_spoken: english, italian
ODROIDs: C0, C1+, C2, N2
Has thanked: 6 times
Been thanked: 5 times
Contact:

Re: How to add a power button to your N2

Post by XFer »

Hello joy, thanks for following up.

I'm running the latest Ubuntu Minimal image (ubuntu-18.04.4-4.9-minimal-odroid-n2-20200229), with latest updates, installed on 64GB microSD (it's the only installed media); slide switch on "MMC".

I hold the button for 2 seconds; the red LED turns on, but it remains stuck as is: no boot, nothing on the serial console, no blue LED.

If I plug off the power plug and re-connect, it boots normally.

joy
Posts: 1335
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 146 times
Been thanked: 163 times
Contact:

Re: How to add a power button to your N2

Post by joy »

@Xfer,
Thanks for sharing the detailed information of your test environment. :)

I've checked recent updates of uboot and found there are some uboot updates since Feb 17.
https://github.com/hardkernel/u-boot/co ... 5f80acaf07

The uboot version that I tested is Feb 17 and maybe it's not the latest uboot.

Code: Select all

odroidn2#ver

U-Boot 2015.01-g3b8b5cb (Feb 17 2020 - 08:16:24)
aarch64-none-elf-gcc (crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10) 4.8.3 20131111 (prerelea
se)
GNU ld (crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10) 2.23.2.20130610 Linaro 2013.10-4
:o Sorry. I will check it using the latest uboot update soon.

joy
Posts: 1335
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 146 times
Been thanked: 163 times
Contact:

Re: How to add a power button to your N2

Post by joy »

@XFer,
I've updated all packages and checked it again.
uboot version is still 17 Feb.
And then, I compiled the latest uboot source code and confirmed wakeup works normally.
It look there is no problem related to uboot. My guess was wrong.

Can you check the followings?

[1]
If you have uart-to-usb module, please share poweroff log message using gpio button poweroff.
Here is my example.

Code: Select all

.....
.....
[  OK  ] Reached target Unmount All Filesystems.
[  OK  ] Stopped target Local File Systems (Pre).
[  OK  ] Stopped Create Static Device Nodes in /dev.
[  OK  ] Stopped Remount Root and Kernel File Systems.
[  OK  ] Reached target Shutdown.
[  OK  ] Reached target Final Step.
         Starting Power-Off...
[   19.551738@0] reboot: Power down
bl31 reboot reason: 0x108
bl31 reboot reason: 0x108
system cmd  0.
bl30 get wakeup sources!
process command 00000006
bl30 enter suspend!
Little core clk suspend rate 1896000000
Big core clk suspend rate 1800000000
store restore gp0 pll
suspend_counter: 1
Enter ddr suspend
ddr suspend time: 17us
alarm=0S
process command 00000001
GPIOA_11/13 off
cec ver:2018/04/19
CEC cfg:0x003f
WAKEUP GPIO cfg:0x000001df
use vddee new table!
cec reset
Set cec pinmux:0x11
kern log_addr:0x00
cec T: 00
cec_triggle_tx:TX_ERROR
Set cec log_addr:0x10,ADDR0:10
customer pwrkeys for IR is NULL, use defaults!

(here, end of message)
[2]
Do you use 2 wires button?
Could you show me button connection?

[3]
Remove all external devices including HDMI, ethernet, then check it again.

Sorry for many request.

As you said, when you try wakeup after poweroff, red led turns on,
that means wakeup logic detects button event normally and then boot stuck at some point, I think.
I will think over points to be suspicious.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest