Raspberry goes to sleepmode after boot

Started by rednas32, February 25, 2015, 02:08:49 PM

rednas32

Hi,

Just received my ATXRaspi in the mail and got my solderingkit out.

Everything is connected and I have loaded the script onto my Raspberry Pi 2.

The problem I am having is that the Pi starts fine with the powerbutton but then goes to sleepmode, with the powerbutton led still on.
When I press the powerbutton for about 10 seconds it shuts down and when I press it again it boots again, but with the same problem.

I think the problem is with the script but I cannot find what or where, please assist!

Felix

Can you verify the wiring again, it's extremely important that part is correct. Otherwise your Pi will pick up static and detect a fake Shutoff signal and shut down.
Also verify the script is running during boot (you should see the message that the script generates at the end of boot).

rednas32

Finally had the time to try and adjust things.

Resoldered everything and put heatshrinkers on the connections to make sure it doesn't connect in any way on the on-off button and using jumpercables on all ATX side and with the wires to the Pi, except the power which goes through the usb port.

Had to reformat my sd card since it wouldn't let me do anything and tried to install the script again without the ATX attached.

As soon as I rebooted my Pi it automatically went to sleep mode halfway through the bootprocess, without the ATX attached.

Attached my ATX and started the Pi again, the problem still persists. It just goes to sleep mode halfway through the boot, and with sleepmode i mean that the red led on the Pi is on and the led for the on-off button is also powered on. They both do not power down but stay this way.

Since it shuts down halfway through the boot process i cannot use my Pi for anything at this point, except for when reformat my sd card and install everything again. Which is a great hussle and looking to avoid this.

Again I am using the Pi 2 (latest version) and running retropie 2.6 from my sd card.

Please give me advice on what could be wrong and how to fix it since the ATX is useless at this point and I keep having to reformat and install everything if i try the script.

Felix

You keep mentioning "sleep mode". You mean shutdown right? ATXRaspi or the script does not put it to sleep, but it shuts it down (SUDO HALT)
To avoid a shutdown connect the shutoff pin on the Pi to GND.

Please see this thread on ATXRaspi debugging information: https://lowpowerlab.com/forum/index.php/topic,637.0.html

If you have a few minutes, could you try installing raspbian instead of retropie and try it on that?
Can you post a closeup photo of your wiring?

rednas32

Yeah you are correct, I use sleepmode since the Pi doesn't actually power down. But it does use the halt command.

Don't have the time at the moment to install raspbian but will try that tomorrow.

Here is the picture:


In the tread with Razza about his media center setup he mentioned he needed to change the script to a different code, I have no experience in coding but could that be necessary?

Felix

It appears you wired it correctly. I need to try it on a Pi2 B+ as well on raspbian.
If you have any results with raspbian let me know in the meantime.

Felix

I can confirm it works perfectly fine on a Pi B+, with the install instructions found at the ATXRaspi page.

rednas32

Could you also confirm it works with it running retropie as an OS?
And could there be a difference between the B+ and the Pi 2 in things like wiring or code?

Because of other obligations I have not been able to test it with Raspbian yet.

Felix

I believe the retropie is not an official distribution so I will leave it up to you to test and customize if needed.
I am more concerned about standard distributions which I know will work with ATXRaspi.

There is an easy way to test ATXRaspi without any Pi. Just power it up via button, then connect the BOOTOK signal to 5V (via jumper wire from ATXRaspi 5v output). Then BOOTOK signal green LED will come ON. Then hold the button down for 3 seconds, the SHUTOFF LED should come ON and button LED should start pulsing. If you then unplug the BOOTOK signal from 5V the board will allow a delay and then cut power off from the 5V output. At that point you know the board is working as expected.

Cybergei

#9
rednas32:  I am having the same problem since I have upgraded my Pi to the latest B+ 2 board.  First one major helpful hint will be that when your board is powering down before it offers a login, you need to deactivate the shutdowncheck.sh script, instead of reformatting and writing a whole brand new card.  To do that, you must plug the sdcard into another linux distro to access the partition on the card.  From there you navigate to:

sdcard/etc/rc.local

and then comment out the shutdowncheck.sh line.  Now you will be able to put the card back into the pi and boot.  Was faster than re-imaging a card.

Next I noticed several issues, for one, my gpio library needed to be updated. This is evident when I used gpio readall and found that the board could not be determined.  After the update, the gpio was read fine.

Atxraspi still does not function properly though.  What I find when I run through all commands to program the boot and shutdown pins are that the gpio command do not actually have any physical affect on the pins.  For example the boot pin does not turn on the boot light when running the commands manually in the terminal from shutdowncheck.sh.

But if I go to the terminal and use the following commands:

gpio mode 25 out
gpio write 25 1

then my boot light comes on since I am using GPIO25.  NOW the question is why does't the shutdowncheck.sh do the same thing?

If I run /etc/./shutdowncheck.sh manually, there is also no effect.  When I run gpio readall right after, I see that no gpio has been changed.

I forgot to mention that I am using raspian but our problems seem identical.  I can confirm that once I moved the shutdown and boot pins to different gpio, the automatic shutdown no longer occurred.  Keep in mind that I did not have these problems with identical wiring and scripts on older pi versions.

Cybergei


Cybergei

#11
Got it.  What I found out and yet do not understand is that originally shutdowncheck.sh was using the pin numbers corresponding with the wPi column in the gpio readall table. So it appears that when I use the commands

gpio mode ....
gpio write .....

from the terminal, these are wPi column numbers.  However, the shutdowncheck.sh uses the pin numbers from the BCM column instead.  Somewhere in the updating of the Distro, GPIO has been set to read from the BCM (Broadcom) numbers instead of from the BOARD numbers. That is the snafu. Once I figure out how to change GPIO back to BOARD, I will let you know. If this were python, that would be easy, but this tells me that the library itself is set to BCM.

Cybergei

So here ya go.  My shutdown check.sh just so you get the idea:

#!/bin/bash

#Using gpio readall this script is using the wPi column for numbers

#This is GPIO 2 (pin 13 on the pinout diagram).
#This is an input from ATXRaspi to the Pi.
#When button is held for ~3 seconds, this pin will become HIGH signalling to this script to poweroff the Pi.
SHUTDOWN=27
echo "$SHUTDOWN" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio$SHUTDOWN/direction

#This is GPIO 3 (pin 15 on the pinout diagram).
#This is an output from Pi to ATXRaspi and signals that the Pi has booted.
#This pin is asserted HIGH as soon as this script runs (by writing "1" to /sys/class/gpio/gpio8/value)
BOOT=22
echo "$BOOT" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$BOOT/direction
echo "1" > /sys/class/gpio/gpio$BOOT/value

echo "ATXRaspi shutdown script started: asserted pins ($SHUTDOWN=input,LOW; $BOOT=output,HIGH). Waiting for GPIO$SHUTDOWN to become HIGH..."

#This loop continuously checks if the shutdown button was pressed on ATXRaspi (GPIO7 to become HIGH), and issues a shutdown when that happens.
#It sleeps as long as that has not happened.
while [ 1 ]; do
  shutdownSignal=$(cat /sys/class/gpio/gpio$SHUTDOWN/value)
  if [ $shutdownSignal = 0 ]; then
    /bin/sleep 0.5
  else
    sudo poweroff
  fi
done


Next here is my corresponding GPIO readall table:

See attachment






Cybergei

My ATXRaspi

Cybergei

#14
My RPi, pay attention to the wire colors