LowPowerLab Forum

Hardware support => ATXRaspi => Topic started by: mseymour0307 on January 08, 2017, 09:35:42 PM

Title: Button Wont Shut Down RetroPie Pi [SOLVED: wires inverted]
Post by: mseymour0307 on January 08, 2017, 09:35:42 PM
I am having a problem with the ATX shutting down my Pi Zero with RetroPi installed. I have wired my setup and installed the script as described in the installation section of the website and depicted in the image attached.

When everything is off, I press the momentary button and the Pi comes on with the BootOK LED lighting up and then turning off once the RetroPie software has fully loaded. When pressing and holding the button for any amount of time less than 7 seconds nothing happens; the Pi doesn't power down or enter a shutdown sequence. When holding the button longer than 7 seconds the Pi enters a forced shutdown.

This is similar to an older post https://lowpowerlab.com/forum/atxraspi/system-does-not-power-down-(solved)/ (https://lowpowerlab.com/forum/atxraspi/system-does-not-power-down-(solved)/)

I have tested the ATX as described on the second page of the post linked above and the ATX seems to work as it should when not plugged into the Pi. This makes me think I either have a wiring issue or the script I loaded doesn't work properly for the Pi Zero. I don't have a ton of experience programming in this particular environment so any help would be really appreciated.
Title: Re: Button Wont Shut Down PI
Post by: Felix on January 09, 2017, 08:22:54 AM
Quote from: mseymour0307 on January 08, 2017, 09:35:42 PM
When everything is off, I press the momentary button and the Pi comes on with the BootOK LED lighting up and then turning off once the RetroPie software has fully loaded.

I think that might be your problem. I don't see the Green BOOTOK LED being ON.
As explained in the guide (http://lowpowerlab.com/atxraspi) ATXRaspi expects the BOOTOK to stay ON all the time while Pi is in operation (that GPIO is set HIGH/ON by the atxraspi shutdowncheck script during boot). If it turns OFF for whatever reason then ATXRaspi assumes the Pi is in an unknown state and the only way to turn off is in forced mode.
Make sure the script is running and is not stopped by anything on your Pi.
Title: Re: Button Wont Shut Down PI
Post by: mseymour0307 on January 09, 2017, 10:33:22 AM
How can I check to make sure the script is running? When it turnseems on it boots right to the RetroPi software so I can't see if it sets the GPIO pins correctly.
Title: Re: Button Wont Shut Down PI
Post by: Felix on January 09, 2017, 04:04:26 PM
Depending if you run polling or the irq variant of the script (you chose that during setup), if you run "ps aux | grep shutdown" you should see something like:

pi@raspberrypi:~ $ ps aux | grep shutdown
root       573  0.0  0.5   9528  5472 ?        S     2016   0:00 python /etc/shutdownirq.py


This is for the irq python script, the other is shutdowncheck.sh
Title: Re: Button Wont Shut Down PI
Post by: mseymour0307 on January 09, 2017, 09:22:51 PM
Quote from: Felix on January 09, 2017, 04:04:26 PM
Depending if you run polling or the irq variant of the script (you chose that during setup), if you run "ps aux | grep shutdown" you should see something like:

pi@raspberrypi:~ $ ps aux | grep shutdown
root       573  0.0  0.5   9528  5472 ?        S     2016   0:00 python /etc/shutdownirq.py


This is for the irq python script, the other is shutdowncheck.sh

I tried this and got something similar (see attached). I assume this means the code is running. I also measured my pins with a multimeter on start up and the GPIO8 pin starts out as high and then reverts back to low for some reason. Not sure why this would be.
Title: Re: Button Wont Shut Down PI
Post by: Felix on January 10, 2017, 08:43:10 AM
Looks like it should be working, you will need to see what else is setting BOOTOK back to LOW.
Is this a clean retropie install with nothing other than the atxraspi script?
Title: Re: Button Wont Shut Down RetroPie Pi
Post by: mseymour0307 on January 10, 2017, 10:13:18 AM
Yes it is a clean install. I installed the Retropie imge and then installed the atx program. Nothing else.
Title: Re: Button Wont Shut Down RetroPie Pi
Post by: Felix on January 10, 2017, 10:52:32 AM
Others have no issue with Retropie, looks like something is turning OFF the BOOTOK GPIO.
Can you try changing the script to use another free GPIO instead and move the wiring, see if it makes a difference?
Otherwise you could try removing the script and reinstalling using the polling method.
Title: Re: Button Wont Shut Down RetroPie Pi
Post by: mseymour0307 on January 10, 2017, 11:04:18 AM
I have tried the polling method as well. It worked at first but after a few reboot cycles the Pi would turn on for about 10 seconds and then it would receive a command from the atx to shutdown and it would never run long enough for me to troubleshoot it. What commands would I use to get inside the atx code to change the GPIO Pins? Not used to command line programming.
Title: Re: Button Wont Shut Down RetroPie Pi
Post by: Felix on January 10, 2017, 11:19:20 AM
QuoteIt worked at first but after a few reboot cycles the Pi

That probably means your SHUTDOWN signal was floating (not connecter properly or loose wiring?) and issuing a (forced?) shutdown.
It almost sounds like you installed both scripts which could explain the conflicting writing to the GPIO. You have to make sure only 1 of those is running not both. Although from your ps aux result pnly the python script was showing.
If you need to disconnect ATXRaspi from your Pi - jumper the SHUTDOWN GPIO pin to GND to avoid a shutdown after you power your Pi again.

To edit the script you use the editor of your choice, nano is what I use.

sudo nano /etc/shutdowncheck.sh    (for the polling script)
sudo nano /etc/shutdownirq.py         (for the interrupt script)

To prevent the scripts from running, remove their startup command from /etc/rc.local:

/etc/shutdowncheck.sh &
python /etc/shutdownirq.py &
Title: Re: Button Wont Shut Down RetroPie Pi
Post by: mseymour0307 on January 10, 2017, 09:02:17 PM
I got it working.. I had my pins wired wrong on the Pi. I had my wires going to the ID_SC and GPIO7 pins. Not sure how that happened. I think I was looking at the wrong pin diagram when I put it together. Thanks for all of your help troubleshooting!
Title: Re: Button Wont Shut Down RetroPie Pi [SOLVED: wires inverted]
Post by: Felix on January 11, 2017, 08:02:52 AM
Thank you for the update, glad you have it working now, enjoy!