Tackling Graceful Shutdowns on the GBZ

Various user-contributed guides for software-related things
User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Mon May 30, 2016 12:09 am

Camble wrote:
Popcorn wrote:
Fleder wrote:@[mention]Popcorn[/mention]
I am sorry, i am sure this was already answered, but will the push button switch work as well instead of the slide switch?
Yes, the push button will work. Put UART TX to CTRL. Everything else should be wired the same. We can also use the OFF pin and GPIO-Poweroff but CTRL should work fine.

Image
Popcorn, this is the Pololu I have and while the monitor detects the slide switch in the off position and shuts down the Pi, the Pololu remains powered. I have the UART pin connected to the CTRL pin on the switch. I should note that I've had to connect the switch pins on the Pololu through ground, as there isn't a common ground on the push button version.

Any ideas what could be causing the switch to stay powered?
Hmm. That was based on my read through of the spec sheet. It was untested. Seems that the uart TX isn't sending a proper low signal on the shutdown process then which is why it's not shutting down. Not to fear, there's another way. The other option to make it work using the GPIO-poweroff driver and mapping a GPIO port to the off pin. Try that and let us know.

You'll have to pick another pin or turn off serial in raspi-config to be able to repurpose the uart TX pin. I would pick gpio4/ physical pin 7 since it's free and just on the left side of the same row that uart TX is on physical pin 8

Once you selected a pin, just add this to your /boot/config.txt

Code: Select all

dtoverlay=gpio-poweroff,gpiopin=xx
Obvs replacing xx with the GPIO pin you picked (not to be confused with the physical pin number) and mapping it to OFF on the pololu switch. This should work. Let us know so I can revise the installation instructions for the pololu push button.

User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Mon May 30, 2016 12:29 am

Also, just reading this thread, there might be another way to do it by adding a custom dt-blob file too.

This patch will make a GPIO port go low on shutdown rather than go no-state which seems to be what is happening. This would let you use the CTRL pin still.

Seems like a couple things to try.

Scroll down to the post by paulv written on June 27, 2015 at 7:20am

https://www.raspberrypi.org/forums/view ... 7&t=113789

User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Mon May 30, 2016 1:17 am

SidSilver wrote:What about gluing the reset button inside the shell, in the battery compartment ?
It would be protected and easily accessible. ;)
Yeah, probably a great place for it.

User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Camble » Mon May 30, 2016 5:27 am

Ah, thanks Popcorn. I was beginning to question whether the pin was enabled by default or if additional config was required.

User avatar
Bubble
Posts: 35
Joined: Sun May 08, 2016 7:33 am
Has thanked: 7 times
Been thanked: 4 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Bubble » Mon May 30, 2016 4:38 pm

Today low battery signal and - wait fo it - it worked.
First I got the message telling me to save my game when the light was blinking, then when the light was red, 60s. countdown, finally PI0 went off !
Amazing job Popcorn :mrgreen:

User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Mon May 30, 2016 6:35 pm

Bubble wrote:Today low battery signal and - wait fo it - it worked.
First I got the message telling me to save my game when the light was blinking, then when the light was red, 60s. countdown, finally PI0 went off !
Amazing job Popcorn :mrgreen:
Great to hear! Hurray! :)

SidSilver
Posts: 263
Joined: Sun May 22, 2016 6:22 am
Location: France
Has thanked: 137 times
Been thanked: 37 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by SidSilver » Tue May 31, 2016 7:15 am

Would it be compatible with this Recalbox functionality ?
https://github.com/recalbox/recalbox-os ... x-%28EN%29

I think this script doesn't totally cut off the power , the board is still powered.
So we should use this functionnality only to trigger the system shutdown before actually physically shut down the power.

User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Tue May 31, 2016 7:23 am

Not even sure what Recall is. The power is completely cut from the Pi, Video, Audio Amp, etc since the Pololu switch cuts it all. The Powerboost is still enabled though so it's basically on standby mode.

User avatar
dirtybeagles
Posts: 386
Joined: Thu May 05, 2016 6:04 am
Has thanked: 34 times
Been thanked: 64 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by dirtybeagles » Tue May 31, 2016 7:31 am

Now that we have confirmed this works are you going to add a new topic in the software thread [mention]Popcorn[/mention]? :D

User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Tue May 31, 2016 9:28 am

You are right. This probably belongs in the guides section now that it's complete. The only question is which guide section? hardware or software? :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest