Page 2 of 4

Re: Wake from halt

Posted: Thu Mar 21, 2013 12:15 pm
by 020110348
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?

Re: Wake from halt

Posted: Fri Mar 29, 2013 1:09 am
by cleverca22
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)

Re: Wake from halt

Posted: Thu Apr 11, 2013 9:51 am
by kadamski
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)?

Re: Wake from halt

Posted: Sat Apr 13, 2013 4:18 am
by cleverca22
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!

Re: Wake from halt

Posted: Sat Apr 13, 2013 9:19 am
by kadamski
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.

Re: Wake from halt

Posted: Tue Apr 30, 2013 1:33 pm
by pifab
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.

Re: Wake from halt

Posted: Tue Apr 30, 2013 1:51 pm
by RaTTuS
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

Re: Wake from halt

Posted: Tue Apr 30, 2013 5:35 pm
by pifab
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/

Re: Wake from halt

Posted: Wed Oct 16, 2013 1:25 pm
by mcgyver83
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?

Re: Wake from halt

Posted: Wed Oct 16, 2013 9:39 pm
by jojopi
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.

Re: Wake from halt

Posted: Wed Oct 16, 2013 9:59 pm
by mcgyver83
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)?

Re: Wake from halt

Posted: Sat Jul 19, 2014 5:34 pm
by dom
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?

Re: Wake from halt

Posted: Sat Jul 19, 2014 6:40 pm
by MrEngman
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

Re: Wake from halt

Posted: Sat Jul 19, 2014 7:05 pm
by jojopi
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?

Re: Wake from halt

Posted: Sat Jul 19, 2014 7:46 pm
by dom
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.

Re: Wake from halt

Posted: Sat Jul 19, 2014 9:30 pm
by jojopi
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.)

Re: Wake from halt

Posted: Sun Jul 20, 2014 5:35 pm
by dom
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...

Re: Wake from halt

Posted: Sun Jul 20, 2014 5:44 pm
by dom
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.

Re: Wake from halt

Posted: Sun Jul 20, 2014 8:17 pm
by jojopi
Yes, that fixes it.

(Intriguing file format is fun to modify!)

Re: Wake from halt

Posted: Sun Jul 20, 2014 8:28 pm
by ShiftPlusOne
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.

Re: Wake from halt

Posted: Sun Jul 20, 2014 8:37 pm
by gsh
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

Re: Wake from halt

Posted: Sun Jul 20, 2014 8:50 pm
by drgeoff
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. :)

Re: Wake from halt

Posted: Mon Jul 21, 2014 10:55 am
by dom
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

Re: Wake from halt

Posted: Mon Jul 21, 2014 10:58 am
by ShiftPlusOne
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.

Re: Wake from halt

Posted: Sat Mar 21, 2015 7:19 am
by ha107642
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.