deepo
Posts: 614
Joined: Sun Dec 30, 2018 8:36 pm
Location: Denmark

dtoverlay gpio-shutdown not working on Stretch

Thu Oct 10, 2019 6:13 pm

I performed an upgrade on my RPi 3B+ running Stretch Lite yesterday and now my shutdown button doesn't work.

I am at this kernel:
uname -a
Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

I have this in boot/config.txt:
dtoverlay=gpio-shutdown,gpio_pin=3

There doesn't seem to be any overlays loaded:
sudo dtoverlay -l
No overlays loaded

dmesg gives me:
dmesg | grep -i shutdown
[ 3.819743] input: soc:shutdown_button as /devices/platform/soc/soc:shutdown_button/input/input0

So maybe something is happening? Changing the gpio_pin in /boot/config.txt results in the same message.

I tried to manually load the overlay:
sudo dtoverlay gpio-shutdown gpio_pin=3
* Failed to apply overlay '0_gpio-shutdown' (kernel)

Anybody running an older kernel, that can try this out?

/Mogens

skcasb
Posts: 18
Joined: Wed Jul 11, 2018 12:46 pm

Re: dtoverlay gpio-shutdown not working on Stretch

Mon Oct 14, 2019 2:39 pm

Hi,

I use the same RPI 3B+ running raspbian stretch within the same Kernel version, generated by pi-gen.

Adding the following line to the config.txt file (even if the gpio used is different from yours) it is possible to verify that on power on the gpio goes to the high level and then go low when shutdown has completed.

This is my config line:

Code: Select all

dtoverlay=gpio-poweroff,active_low,gpiopin=18
if it can be useful to you, the following link helped me to solve your same issue:

https://www.raspberrypi.org/forums/view ... p?t=178015

Check also If you use a true gpio pin (because I read that you want to use one of the i2c bus pin).

regards.

deepo
Posts: 614
Joined: Sun Dec 30, 2018 8:36 pm
Location: Denmark

Re: dtoverlay gpio-shutdown not working on Stretch

Thu Oct 17, 2019 3:52 pm

I'm not looking for gpio-poweroff, which drives an output and specifically states that it ruins my attempt at powering on and off (halt actually) my RPi using gpio-shutdown.

https://raw.githubusercontent.com/raspb ... ays/README

Code: Select all

Name:   gpio-poweroff
Info:   Drives a GPIO high or low on poweroff (including halt). Enabling this
        overlay will prevent the ability to boot by driving GPIO3 low.

Name:   gpio-shutdown
Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
        is configured as an input key that generates KEY_POWER events.
        This event is handled by systemd-logind by initiating a
        shutdown.
        This overlay only handles shutdown. After shutdown, the system
        can be powered up again by driving GPIO3 low. The default
        configuration uses GPIO3 with a pullup, so if you connect a
        button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
        you get a shutdown and power-up button.
I am specifically using GPIO3 because shorting that to ground when the RPi is halted will wake it up.
And gpio-shutdown is supposed to halting the RPi when I press the same button.
But it's not working after the update.

/Mogens

deepo
Posts: 614
Joined: Sun Dec 30, 2018 8:36 pm
Location: Denmark

Re: dtoverlay gpio-shutdown not working on Stretch

Sat Oct 19, 2019 6:51 pm

I have spent the evening trying out older Raspbian versions, but none of them work (for my purpose) very long.
Some of them I can get a shutdown from a few seconds after booting up the Raspbian Stretch.
If I let the Raspbian sit idle for a few minutes, then it doesn't react to shorting GPIO3 to GND.

I tried these Stretch versions:

2018-11-13-raspbian-stretch-lite.zip
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

2018-10-09-raspbian-stretch-lite.zip
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux

2018-03-13-raspbian-stretch.zip
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux

All with the same symptoms: A few minutes after bootup any shorting of GPIO3 to GND does nothing.

Is the RPi 3B+ supposed to work with the last Jessie:
http://downloads.raspberrypi.org/raspbi ... 017-07-05/
And the first Stretch:
http://downloads.raspberrypi.org/raspbi ... 017-08-17/
I guess not, as the release date for RPi 3B+ was around January 12 2018.

/Mogens

deepo
Posts: 614
Joined: Sun Dec 30, 2018 8:36 pm
Location: Denmark

Re: dtoverlay gpio-shutdown not working on Stretch

Sun Oct 27, 2019 4:19 pm

I found the problem, but not a solution.
The overlay gpio-shutdown requires that you have a monitor connected on the HDMI port.
I don't know why, but if I don't have a monitor connected it just doesn't work.
If I connect a monitor, then it works fine.

/Mogens

LeisureSuitLadi
Posts: 2
Joined: Fri Apr 20, 2018 11:54 am

Re: dtoverlay gpio-shutdown not working on Stretch

Sat Nov 16, 2019 8:11 pm

I have the same problem even a monitor is connected.

Linux 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
"lsmod" shows gpio_keys is loaded (used by 0), but gpio-shutdown is not.
"raspi-gpio get 4" shows correct status of the key, so the key works
Manual loading with "sudo dtoverlay gpio-shutdown gpio_pin=4 active_low=0 gpio_pull=down" gives
* Failed to apply overlay '0_gpio-shutdown' (kernel)

As mentioned earlier, it makes no difference if monitor is connected or not.

Anybody an idea in the mean time what needs to be changed to get this working?

Best regards,
Ladi

alphanumeric
Posts: 2670
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: dtoverlay gpio-shutdown not working on Stretch

Sat Nov 16, 2019 8:39 pm

On my Pi 4B running Buster, if I enable i2c, the GPIO shutdown VIA GPIO 3 stops working. Disable i2c and reboot and its working again.
Also If I change what GPIO pin it uses to another Pin it then works again. I have a Pimoroni Fan Shim attached that uses BCM 17 for its Button.
I changed my config.txt edit to this
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
And it then worked again.

Return to “Troubleshooting”