MadKid
Posts: 2
Joined: Sat Sep 22, 2018 4:11 am

gpio-poweroff doesn't work on Raspbian Lite

Sat Sep 22, 2018 5:44 am

Hi everybody!
My question seems not to be new or unique, but I really did search and didn't get result ((.

I use RPi3B+ as a base of hardware controller with a set of periferals including power source for RPi itself. I was using Raspbian Stretch while developing my controller last year. The power control is made through pins 21 and 19 (shutdown signal and power cut respectively). Theese pins are controlled by dtoverlays in /boot/config.txt:

Code: Select all

dtoverlay gpio-shutdown,active_low=0,gpio_pin=21
dtoverlay gpio-poweroff,active_low=1,gpio_pin=19
Everything was working fine, until I decide to migrate on Raspbian Lite. Under this new system gpio-poweroff overlay is not working. Shutdown process reaches its end:
reboot: Power down
but pin 19 doesn't go low and power still remains on. Try to provide some additional info.
1. Other overlays are working fine.
2. Kernel flags needed for this overlay to work are set (may be not all of theese??):

Code: Select all

[email protected]:~ $ sudo modprobe configs
[email protected]:~ $ zcat /proc/config.gz | grep POWER_RESET
CONFIG_POWER_RESET=y
# CONFIG_POWER_RESET_BRCMKONA is not set
# CONFIG_POWER_RESET_BRCMSTB is not set
CONFIG_POWER_RESET_GPIO=y
# CONFIG_POWER_RESET_GPIO_RESTART is not set
# CONFIG_POWER_RESET_LTC2952 is not set
# CONFIG_POWER_RESET_RESTART is not set
# CONFIG_POWER_RESET_VERSATILE is not set
# CONFIG_POWER_RESET_SYSCON is not set
# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set
3. I also tried to load gpio-poweroff manually at runtime:

Code: Select all

[email protected]:~ $ sudo dtoverlay gpio-poweroff gpiopin=19
* Failed to apply overlay '0_gpio-poweroff' (kernel)
I thought may I have to unload this before reload, but strange:

Code: Select all

[email protected]:~ $ dtoverlay -l
No overlays loaded
but I have a set overlays loaded and working fine write at this moment!

I would appreciate any ideas!

DirkS
Posts: 9038
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: gpio-poweroff doesn't work on Raspbian Lite

Sat Sep 22, 2018 9:27 am

MadKid wrote:
Sat Sep 22, 2018 5:44 am
I thought may I have to unload this before reload, but strange:

Code: Select all

[email protected]:~ $ dtoverlay -l
No overlays loaded
but I have a set overlays loaded and working fine write at this moment!
IIRC 'dtoverlay -l' will only show overlays that are manually loaded.
And I'm also fairly sure that you cannot unload an overlay that was loaded in config.txt

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1863
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: gpio-poweroff doesn't work on Raspbian Lite

Sat Sep 22, 2018 4:08 pm

There is an error in your config.txt - one of the parameter names is wrong.

From the output of "sudo vcdbg log msg":

Code: Select all

001980.108: brfs: File read: /mfs/sd/overlays/gpio-shutdown.dtbo
001989.340: Loaded overlay 'gpio-shutdown'
001989.399: dtparam: active_low=0
001990.085: dtparam: gpio_pin=20
002050.816: brfs: File read: 1250 bytes
002054.604: brfs: File read: /mfs/sd/overlays/gpio-poweroff.dtbo
002063.198: Loaded overlay 'gpio-poweroff'
002063.257: dtparam: active_low=1
002063.648: dtparam: gpio_pin=21
002069.469: Unknown dtparam 'gpio_pin' - ignored
What does the documentation say about the overlay?:

Code: Select all

[email protected]:~$ dtoverlay -h gpio-poweroff
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.

Usage:  dtoverlay=gpio-poweroff,<param>=<val>

Params: gpiopin                 GPIO for signalling (default 26)

        active_low              Set if the power control device requires a
                                high->low transition to trigger a power-down.
                                Note that this will require the support of a
                                custom dt-blob.bin to prevent a power-down
                                during the boot process, and that a reboot
                                will also cause the pin to go low.
        input                   Set if the gpio pin should be configured as
                                an input.
        export                  Set to export the configured pin to sysfs
These overlays have been written by different people at different times, and that has meant that the naming is less consistent than it could be.

With that correction made, the overlay works as expected.

MadKid
Posts: 2
Joined: Sat Sep 22, 2018 4:11 am

Re: gpio-poweroff doesn't work on Raspbian Lite

Sun Sep 23, 2018 4:45 am

Oh, yeah )) Ahahaaa )))

Fairly, I found it too just in time!!
So much time to kill for such a small bug :D :D
Nevertheless, big thanx for your help.
And I just should be more awared of details.

Now everything works ok. Cheers ))

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 4 guests