020110348
Posts: 18
Joined: Thu Mar 21, 2013 12:07 pm

Re: Wake from halt

Thu Mar 21, 2013 12:15 pm

I too am wondering, if i could use the same button to apply "Sudo Halt" and use the Wake Function?

Say i have a "Power" button, if the RPi is "halted" it wakes it, if the RPi is on it issues a "Sudo Halt" command. now how can i issue a sudo halt command and be sure it is entered?
e.x running an application like "startx" or an emulator, than want to shutdown, how can that happen?

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: Wake from halt

Fri Mar 29, 2013 1:09 am

020110348 wrote:I too am wondering, if i could use the same button to apply "Sudo Halt" and use the Wake Function?

Say i have a "Power" button, if the RPi is "halted" it wakes it, if the RPi is on it issues a "Sudo Halt" command. now how can i issue a sudo halt command and be sure it is entered?
e.x running an application like "startx" or an emulator, than want to shutdown, how can that happen?

http://spritesmods.com/?art=rpi_arcade&page=5

you can maybe use the script linked on this page to perform the soft power off, with a slight change

(look at pwrbtn.c in the tar file linked at the end of the post)

kadamski
Posts: 187
Joined: Fri Jun 08, 2012 10:56 pm

Re: Wake from halt

Thu Apr 11, 2013 9:51 am

dom wrote:The Pi goes into a lower powered state.
I was wondering how low the power usage is when RaspberryPi is halted. Connecting my multimeter, it seems that my model B takes about 110mA, which is 0.55W. It is almost 1/4 of the power consumption when turned on (and idle) but still quite high - it's almost the same as model's A power usage when turned on. Did anybody do similar experiments (especially on model A)?

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: Wake from halt

Sat Apr 13, 2013 4:18 am

http://www.raspberrypi.org/phpBB3/viewt ... 50#p119941

this shows pretty clearly, where all the power is going when in halt state

its the ethernet!

kadamski
Posts: 187
Joined: Fri Jun 08, 2012 10:56 pm

Re: Wake from halt

Sat Apr 13, 2013 9:19 am

Yes I was aware of where the power goes, that's why I was interested in the same measurement on model A. And I found it in the tread you linked to - 0.2W, not that bad. Now if only the LAN chip could be put in some deeper power safe mode..

Thanks for the link.

pifab
Posts: 70
Joined: Wed Mar 27, 2013 7:44 pm

Re: Wake from halt

Tue Apr 30, 2013 1:33 pm

Dweeber wrote:Holidays were a blur... Finally got a chance to upgrade my test unit which is on a Adafruit Pi plate to a current kernel that has the new Halt code in it. I already had switches setup to test this with the pre-release before the code made it into the mainstream kernel.

Works like a champ.

Now using two switches (red and green) a couple resistors and a green LED, I am about to solder up some kits to allow me to upgrade my other units so that they have a Request Stop (Red) button, Restart Button (Green) and Green LED to show status of the OS (if OS is running) that I can then mount on the top of the cases I have for the other RPi.

I have a script which runs to watch for the Request Stop button, which when it sees it, tells the OS to do a shutdown.

All of my RPi are headless (no keyboard) so this will allow me to do a safe shutdown, see if it is already running and restart it if needed.
I would like to know what parts you used and how you connected them all together. Couldn't find this on your homepage.

User avatar
RaTTuS
Posts: 10325
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Wake from halt

Tue Apr 30, 2013 1:51 pm

kadamski wrote:Yes I was aware of where the power goes, that's why I was interested in the same measurement on model A. And I found it in the tread you linked to - 0.2W, not that bad. Now if only the LAN chip could be put in some deeper power safe mode..

Thanks for the link.
use a model A ;) ;-p
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

pifab
Posts: 70
Joined: Wed Mar 27, 2013 7:44 pm

Re: Wake from halt

Tue Apr 30, 2013 5:35 pm

I now use a reset switch from an old pc which is connected to pin 5 and pin 6 and it works just fine.

To add a power off switch, could I just follow this guide?
"Just connect pin 1 to a momentary open switch, and the switch to a 1K and a 10K resistor. Then connect the 10K resistor to the ground on pin 9 and the 1K to pin 17."
Quoted from: http://www.3cc.org/blog/2013/01/raspber ... ff-the-pi/

mcgyver83
Posts: 358
Joined: Fri Oct 05, 2012 11:49 am

Re: Wake from halt

Wed Oct 16, 2013 1:25 pm

dom wrote:
KenT wrote:Is there any practical difference between this and the Reset pin P6 introduced on the Rev. 2 board.
This scheme avoids reloading bootcode.bin, but otherwise the two schemes are pretty much identical (as long you have a rev2 board).

So only reloading bootcode (with reset pin used in the video) is the difference?
So any suggestion? I usually use shutdown -h now, is the same as sudo halt?
So I can add the wake/reset switch (reset pin or gpio way) and everything should be fine?

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Wake from halt

Wed Oct 16, 2013 9:39 pm

mcgyver83 wrote:So any suggestion? I usually use shutdown -h now, is the same as sudo halt?
So I can add the wake/reset switch (reset pin or gpio way) and everything should be fine?
"sudo halt" by itself actually starts "shutdown -h now" for you.

The main difference between P6 and P1-5 is what will happen if you press the button when the system is not halted. P6 will cause an immediate crash and reboot. P1-5 just changes GPIO3, which by default does nothing, but you could run a program to watch for this and start an orderly shutdown, or some other action.

Incidentally, if you attach a button to GPIO3 permanently, you should probably include a 330Ω resistor in series. This avoids a short circuit in case the button is ever pressed when the GPIO is configured as an output.

P6 has additional noise and static protection on the board, in the form of a 100nF capacitor and a pair of clamping diodes. But these are only really important if you use long or exposed wiring.

mcgyver83
Posts: 358
Joined: Fri Oct 05, 2012 11:49 am

Re: Wake from halt

Wed Oct 16, 2013 9:59 pm

So the best choice is to use P1-5 with a "listener" that intercept the close circuit and does a shutdown.
And for wake up?
We were talking about 2 different way of "restart" the rpi: reset Jumper P6 ( but it has the side effect you explained if pushed incidentally) and a switch on the P1-5 that wakes the rpi without reloading bootcode.bin.
When is important to reload bootcode (with P6) and when is not needed (P1-5)?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5268
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Wake from halt

Sat Jul 19, 2014 5:34 pm

Can anyone test this file:
https://dl.dropboxusercontent.com/u/366 ... otcode.bin

Replace the one on boot partition.

I'd like to know any of the following:
Does B+ still wake from halt?
Does B+ spuriously wake from halt when prodded with fingers?
Does a rev2 model A/B still behave as before?
Does a rev1 model A/B still behave as before?

MrEngman
Posts: 3831
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Wake from halt

Sat Jul 19, 2014 6:40 pm

dom wrote:Can anyone test this file:
https://dl.dropboxusercontent.com/u/366 ... otcode.bin

Replace the one on boot partition.

I'd like to know any of the following:
Does B+ still wake from halt?
Does B+ spuriously wake from halt when prodded with fingers?
Does a rev2 model A/B still behave as before?
Does a rev1 model A/B still behave as before?
B+ wake from halt OK with RUN, anything else to try?
B+ NO spurious wake from halt when prodding gpio pins
B2 512MB, B2 256MB, B1 256MB, A all appear OK


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Wake from halt

Sat Jul 19, 2014 7:05 pm

Model B rev1 and rev2 (0x0002 and 0x000f) each now wake on the correct external SCL pin only, and not on the internal one.

Incidentally, this suggests that bootcode.bin is revision-aware. It had been reported that it used the wrong GPIO for ACT LED, or otherwise configures GPIO16 as an output on a B+ (and perhaps on CM). Is that fixed too?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5268
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Wake from halt

Sat Jul 19, 2014 7:46 pm

jojopi wrote:Incidentally, this suggests that bootcode.bin is revision-aware. It had been reported that it used the wrong GPIO for ACT LED, or otherwise configures GPIO16 as an output on a B+ (and perhaps on CM). Is that fixed too?
Yes. This was fixed prior to the B+ launch in rpi-update firmware, but not the apt-get firmware.

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Wake from halt

Sat Jul 19, 2014 9:30 pm

I have noticed another halt state anomaly (not new with this bootcode, but I think it may be recent). On some Model Bs the Ethernet PHY and LEDs can remain fully powered while the SoC is halted. (Depending on distro, this may need "halt -fp" so that the kernel does not explicitly down eth0 before returning to GPU.)

Attempting to probe pin12 on the 9512 immediately stops the PHY. I suspect GPIO6 (LAN_RUN) is floating during halt when in old firmware it used to be pulled down.

(I have never really understood why firmware floats any GPIOs, rather than keeping them in pull states. Especially since the CM documentation appears to recommend against floating.)

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5268
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Wake from halt

Sun Jul 20, 2014 5:35 pm

jojopi wrote:I have noticed another halt state anomaly (not new with this bootcode, but I think it may be recent). On some Model Bs the Ethernet PHY and LEDs can remain fully powered while the SoC is halted. (Depending on distro, this may need "halt -fp" so that the kernel does not explicitly down eth0 before returning to GPU.)

Attempting to probe pin12 on the 9512 immediately stops the PHY. I suspect GPIO6 (LAN_RUN) is floating during halt when in old firmware it used to be pulled down.

(I have never really understood why firmware floats any GPIOs, rather than keeping them in pull states. Especially since the CM documentation appears to recommend against floating.)
Ah yes. LAN_RUN used to be an output with a pull-down. With the gpioman commit the pull-down has gone. I'll fix that...

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5268
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Wake from halt

Sun Jul 20, 2014 5:44 pm

jojopi wrote:I have noticed another halt state anomaly (not new with this bootcode, but I think it may be recent). On some Model Bs the Ethernet PHY and LEDs can remain fully powered while the SoC is halted. (Depending on distro, this may need "halt -fp" so that the kernel does not explicitly down eth0 before returning to GPU.)
Can you add this file to boot partition of sdcard:
https://dl.dropboxusercontent.com/u/366 ... t-blob.bin

and see if it fixes it.

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Wake from halt

Sun Jul 20, 2014 8:17 pm

Yes, that fixes it.

(Intriguing file format is fun to modify!)

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5717
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Wake from halt

Sun Jul 20, 2014 8:28 pm

jojopi wrote:Yes, that fixes it.

(Intriguing file format is fun to modify!)
It's a compiled device tree file. When the .dtc version is made available, it will be very easy to modify.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1416
Joined: Sat Sep 10, 2011 11:43 am

Re: Wake from halt

Sun Jul 20, 2014 8:37 pm

I'm just in the process of adding the clock management to the dt-blob.bin to allow people to also define the clock configuration themselves, unfortunately you'll need a degree in hard stuff to understand how the clock management works in the first place!

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

drgeoff
Posts: 9380
Joined: Wed Jan 25, 2012 6:39 pm

Re: Wake from halt

Sun Jul 20, 2014 8:50 pm

gsh wrote:I'm just in the process of adding the clock management to the dt-blob.bin to allow people to also define the clock configuration themselves, unfortunately you'll need a degree in hard stuff to understand how the clock management works in the first place!

Gordon
But it is the job of people with such degrees to make it simple for those not so fortunate. :)

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5268
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Wake from halt

Mon Jul 21, 2014 10:55 am

ShiftPlusOne wrote:It's a compiled device tree file. When the .dtc version is made available, it will be very easy to modify.
You don't have to wait:

Code: Select all

dtc -I dtb dt-blob.bin

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5717
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Wake from halt

Mon Jul 21, 2014 10:58 am

dom wrote:
ShiftPlusOne wrote:It's a compiled device tree file. When the .dtc version is made available, it will be very easy to modify.
You don't have to wait:

Code: Select all

dtc -I dtb dt-blob.bin
Ah, excellent. Didn't know going the other way was that easy too.

ha107642
Posts: 1
Joined: Sat Mar 21, 2015 7:09 am

Re: Wake from halt

Sat Mar 21, 2015 7:19 am

Hi!

What criteria need to be met to get the "set gpio 3 to low to wake from halt" to work? I connected the fifth and sixth pins on my Raspberry Pi when it was in a halt state. Unfortunately, it did not wake the Pi from halt.

However, my Pi is running OpenELEC, which I suspect is the reason why it doesn't work. Is there any way to get this to work in that distribution?

Or do I need to get a program running in halt state? OpenELEC is quite locked down, so I'm not sure if it's possible (well, it's almost certainly possible somehow, since I have root access). There is no apt-get, and I couldn't find a C compiler installed.

Return to “Advanced users”