Page 1 of 3

Pi B+ won't shutdown? Tying pin 28 to GND seems to solve it

Posted: Fri Jul 18, 2014 4:31 pm
by alexeames
Having done my "all the ports" GPIO test today, I found something strange happening on my B+.

I have all the ports wired up to leds powered with 5V through Darlington array chips. Here's what it looks like http://youtu.be/03_WJsGqDs0

When I shutdown with sudo halt, it shuts down normally, but as soon as my hand or wireless keyboard goes anywhere near the wires, the Pi comes back up again.

Just curious. Is there a GPIO port that's activated to bring the Pi back up aside from the RUN header? Otherwise wondering why this is happening. It's repeatable so could get video evidence if needed.

I'm sure if I pull all the wires off it'll stop, but it's curious. :lol:

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 4:34 pm
by ukscone
anything plugged into the USB that could be supplying power? I seem to recall one of the James's saying that you can't back power unless it's been boot strapped from the mucro usb so maybe it's something related to that

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 4:41 pm
by alexeames
I have Edimax wifi dongle, kbd dongle and a Memory stick plugged in, none of which provides power, so no. Not really. The LED power comes from the Pi itself, but that's isolated from the Pi by Darlington array chips. I'm figuring it must be floating ports, one of which, when triggered brings the Pi back up.

It doesn't always happen immediately, which kind of supports that theory too.

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 5:33 pm
by alexeames
Pulling out the wifi dongle and the USB memory stick makes a difference.

Now when I sudo halt, I still get 10 LED flashes on port 16, then, about half a second later, port 14 lights and stays lit and the Pi boots. I don't need to do anything. It just happens.

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 5:41 pm
by PiGraham
alexeames wrote:Pulling out the wifi dongle and the USB memory stick makes a difference.

Now when I sudo halt, I still get 10 LED flashes on port 16, then, about half a second later, port 14 lights and stays lit and the Pi boots. I don't need to do anything. It just happens.
So, when you remove the USB peripherals, leaving only your keyboard dongle, the Pi restarts every time after a halt?

The two possibilities that occur to me are:
1. Something slugs the power rail as it shuts down, triggering the reset circuit.
2. Some noise during shut-down couples to the RUN (reset) lines causing a reset.

Do you have anything connected to the RUN pins?

I haven;t noticed my my B+ doing this.

Does it still happen if you remove the keyboard dongle and do the halt via USB keyboard or SSH?

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 5:42 pm
by asandford
One of my Bs has started to do the same. sudo halt or poweroff results in a reboot. Only way to shut it down is pull the plug.

Details:

Code: Select all

[email protected] ~ $ uname -a
Linux sandford 3.12.24+ #694 PREEMPT Tue Jul 15 17:34:35 BST 2014 armv6l GNU/Linux
[email protected] ~ $

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 6:05 pm
by PiGraham
asandford wrote:One of my Bs has started to do the same. sudo halt or poweroff results in a reboot. Only way to shut it down is pull the plug.

Details:

Code: Select all

[email protected] ~ $ uname -a
Linux sandford 3.12.24+ #694 PREEMPT Tue Jul 15 17:34:35 BST 2014 armv6l GNU/Linux
[email protected] ~ $
Interesting. A B, not a B+?
What do you have attached to it?

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 6:12 pm
by alexeames
PiGraham wrote:
So, when you remove the USB peripherals, leaving only your keyboard dongle, the Pi restarts every time after a halt?
Yep. Exactly that.
PiGraham wrote: The two possibilities that occur to me are:
1. Something slugs the power rail as it shuts down, triggering the reset circuit.
2. Some noise during shut-down couples to the RUN (reset) lines causing a reset.

Do you have anything connected to the RUN pins?
No
PiGraham wrote: Does it still happen if you remove the keyboard dongle and do the halt via USB keyboard or SSH?
Don't have a USB keyboard over here. Will plug the wifi dongle back in a try by ssh. Shutting it down by SSH with no keyboard dongle seems stable. I've grabbed the bunch of GPIO connected wires and it still doesn't restart. Some kind of interaction with the keyboard dongle then?

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 6:13 pm
by asandford
PiGraham wrote:What do you have attached to it?
Nothing on GPIO, just a (powered) HDD on USB (no hub):

Code: Select all

[email protected] ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0bc2:3320 Seagate RSS LLC
[email protected] ~ $

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 6:29 pm
by ukscone
alexeames wrote:
PiGraham wrote:
So, when you remove the USB peripherals, leaving only your keyboard dongle, the Pi restarts every time after a halt?
Yep. Exactly that.
PiGraham wrote: The two possibilities that occur to me are:
1. Something slugs the power rail as it shuts down, triggering the reset circuit.
2. Some noise during shut-down couples to the RUN (reset) lines causing a reset.

Do you have anything connected to the RUN pins?
No
PiGraham wrote: Does it still happen if you remove the keyboard dongle and do the halt via USB keyboard or SSH?
Don't have a USB keyboard over here. Will plug the wifi dongle back in a try by ssh. Shutting it down by SSH with no keyboard dongle seems stable. I've grabbed the bunch of GPIO connected wires and it still doesn't restart. Some kind of interaction with the keyboard dongle then?
you've invented a pressure based charger for the raspi. do you get more current the faster you type? :)

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 6:54 pm
by alexeames
ukscone wrote:you've invented a pressure based charger for the raspi. do you get more current the faster you type? :)
If I plug the dongle back in and type really fast it still doesn't come back on. :lol: So it might be related to that dongle somehow interacting with something.

But now I've rearranged the dongles, it doesn't seem to happen any more. Will keep an eye on it and see if it happens again.

Weird though. It happened repeatably at least 6 or 7 times.

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 8:25 pm
by PiGraham
alexeames wrote:
PiGraham wrote:
So, when you remove the USB peripherals, leaving only your keyboard dongle, the Pi restarts every time after a halt?
Yep. Exactly that.
PiGraham wrote: The two possibilities that occur to me are:
1. Something slugs the power rail as it shuts down, triggering the reset circuit.
2. Some noise during shut-down couples to the RUN (reset) lines causing a reset.

Do you have anything connected to the RUN pins?
No
PiGraham wrote: Does it still happen if you remove the keyboard dongle and do the halt via USB keyboard or SSH?
Don't have a USB keyboard over here. Will plug the wifi dongle back in a try by ssh. Shutting it down by SSH with no keyboard dongle seems stable. I've grabbed the bunch of GPIO connected wires and it still doesn't restart. Some kind of interaction with the keyboard dongle then?
Maybe. I assume you used this keyboard dongle with your model Bs without seeing this.
I have seem Pis reboot when plugging devices into USB, due to the initial current dipping the supply voltage.
Now the USB sockets will source a lot more current that should be less likely, but, your PSU still has to be able to source that current surge (if any, at halt).

It might be worth trying a beefier PSU.

It is surprising, given that the new switch-mode on-board will run as low as 2.6V. It's hard to believe the keyboard dongle could be pulling enough juice to glitch the supply below that.

I wonder if it's a swing the other way. At halt, it the load drops suddenly, the PSU might glitch high and trip a crowbar protection that trips the reset. That doesn't seem likely

Hopefully somebody who knows the circuit will have some ideas.

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 8:34 pm
by alexeames
It must be my electric personality. :lol:

Having taken off all the GPIO wires, all the USB dongles, I can still get the Pi to come back up again from halt by touching my finger on the GPIO pins. Sometimes, even just getting close to them is enough. It seems to be GPIO16&20 when I touch those two it comes right back up. But sometimes, just getting close is enough.

It's no good me touching a radiator or tap as the darned house over here isn't earthed anyway.

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Fri Jul 18, 2014 10:25 pm
by jbeale
alexeames wrote:It's no good me touching a radiator or tap as the darned house over here isn't earthed anyway.
My guess- if you have static charge (dry day, rubbing against carpet, fabric etc.? high local field from imminent thunderstorm?) and get near the Pi, you could change the logic level of any floating / high impedance lines. So it sounds like whatever state the Pi is in shutdown, it is leaving some important GPIO line in a high-impedance state, and without an external pullup/pulldown resistor, so susceptible to voltage change from external field.

If you have a high-power RF transmitter in the area, the same argument applies except that your body acts as an antenna for the RF signal, instead of DC static charge.

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Sat Jul 19, 2014 4:51 am
by Milliways
When the pi is halted using sudo halt or similar, pulling pin 5 low will make it boot up again.

This is implemented in bootcode.bin as documented
http://elinux.org/RPI_safe_mode#Wake_from_Halt.5B1.5D

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Sat Jul 19, 2014 6:21 am
by alexeames
jbeale wrote:
alexeames wrote:It's no good me touching a radiator or tap as the darned house over here isn't earthed anyway.
My guess- if you have static charge (dry day, rubbing against carpet, fabric etc.? high local field from imminent thunderstorm?) and get near the Pi, you could change the logic level of any floating / high impedance lines. So it sounds like whatever state the Pi is in shutdown, it is leaving some important GPIO line in a high-impedance state, and without an external pullup/pulldown resistor, so susceptible to voltage change from external field.

If you have a high-power RF transmitter in the area, the same argument applies except that your body acts as an antenna for the RF signal, instead of DC static charge.
Yes. I think that must be what it is. Although we have no carpets here (laminate panel floor). I have been barefoot most of the time as it's hot here. I'll try it with shoes on.

Still happens with shoes on. Must be static. I was wondering which pins it might be due to. Could be the pin 5 thing? But it happens when I get close to the pins at the USB end of the B+

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Sat Jul 19, 2014 7:23 am
by alexeames
Here's the issue...

http://youtu.be/PV8P-KnGXGg

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Sat Jul 19, 2014 8:12 am
by guzunty
Yes, I have been seeing this issue too. I first reported it in the 'Who's received their B+' topic, but everyone there shrugged their shoulders.

Well, it appears to be real. I believe I have traced it to pin 28 - ID_SC. Pulling that to ground prevents the issue, for me anyway.

Alex, can you try that and see if it fixes the problem for you too?

Since that pin is reserved for future use, it is possible that there is a bad (or more likely, uninitialised) vector for it, should be easy enough to fix

HTH,

Derek

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Sat Jul 19, 2014 8:21 am
by alexeames
OK. Running from a battery and with ESD protection measures in place eliminated the issue. It's quite likely the communist era wiring in the house here.

https://twitter.com/RasPiTV/statuses/490406307112161280

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Sat Jul 19, 2014 8:32 am
by PeterO
guzunty wrote: Since that pin is reserved for future use, it is possible that there is a bad (or more likely, uninitialised) vector for it, should be easy enough to fix
HTH,
Derek
That sounds plausible Derek,good catch !
PeterO

Re: Pi B+ won't shutdown. Which Port brings it back up?

Posted: Sat Jul 19, 2014 8:50 am
by alexeames
guzunty wrote:
Well, it appears to be real. I believe I have traced it to pin 28 - ID_SC. Pulling that to ground prevents the issue, for me anyway.

Alex, can you try that and see if it fixes the problem for you too?
That seems to work for me (quick n=1 test) even on 'commie' mains wiring.

Tried again without ESD protective measures and it still works. Looking at the pinouts, there's a GND pin (pin 30) next to pin 28. Happy days :)
(Although I feel like a naughty boy connecting something to a DNC pin :o )

Digs in parts box for a jumper :lol:

Re: Pi B+ won't shutdown? Tying pin 28 to GND seems to solve

Posted: Sat Jul 19, 2014 1:38 pm
by guzunty
I have a refinement to the pin 28 theory.

Since the board does not reboot during normal use, even when touching pin 28, I believe that one of 2 possibilities remain;

- There is a pull down resistor on that pin that gets disabled during halt and/or
- The vector that is supposed to handle transitions on that pin is invalidated during halt

both eventualities should be easy to fix in software.

Re: Pi B+ won't shutdown? Tying pin 28 to GND seems to solve

Posted: Sat Jul 19, 2014 1:46 pm
by joan
Isn't pin 28 connected to gpio1 or SCL for I2C bus 0 in old money. Shouldn't that have a hard pull-up to 3.3V? Or does this new boot device not use I2C.

Re: Pi B+ won't shutdown? Tying pin 28 to GND seems to solve

Posted: Sat Jul 19, 2014 2:02 pm
by PeterO
joan wrote:Isn't pin 28 connected to gpio1 or SCL for I2C bus 0 in old money. Shouldn't that have a hard pull-up to 3.3V? Or does this new boot device not use I2C.
Yes it is the I2C bus pin, but the suspicion is that something changes when the system enters the halted state. Level transitions on this pin then cause something to happen that has the unintended/unexpected consequence of restarting the system.
PeterO

Re: Pi B+ won't shutdown? Tying pin 28 to GND seems to solve

Posted: Sat Jul 19, 2014 2:18 pm
by guzunty
@Joan, could be.

The ID_SC is not a signal defined in the Broadcom Peripherals manual, so I assume it is a signal defined on the RPi Schematic. Thus I couldn't find out more.

Pull-up or not, the current configuration is demonstrably insufficient to prevent re-booting on some RPi's during halt. I'm hoping to find that a simple software change will suffice to fix this.

If there is a pull-up there, a jumper to ground is going to be sinking some current (possibly damaging the SOC). It would be good to know if this is the case so we can abandon our workaround.

Alex, you're set up for measuring RPi current consumption, can you check the effect of running with that jumper in place?

Edit: Thinking about it, the link is probably ok, but better safe than sorry.