demedeirosa
Posts: 15
Joined: Wed Jul 11, 2018 1:57 pm

Determining via GPIO is the OS has fully shutdown?

Fri Aug 17, 2018 4:57 pm

Hi all,

Using a CM3L on a custom project. I currently have a supercap backup setup where I am monitoring a GPIO via a script, and shutting down immediately if the GPIO goes LOW. My current issue is that my supercap has a bit more energy than is required, and it keeps the 3.3V and 1.8V supplies on until the supercap is empty. This usually takes 5-10 seconds or so.

My backup IC has the ability to shutoff output power with a a digital input. Is there a way to have a GPIO on the Pi change state once the system is completely shutdown? I seem to vaguely recall that there may be something like this already implemented, but I cant seem to find any info on it.

So for clarity, I am looking for a pin state change, when the OS is fully shutdown. Basically something telling me that it is ok to completely remove power.

Thanks

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1301
Joined: Sat Sep 10, 2011 11:43 am

Re: Determining via GPIO is the OS has fully shutdown?

Mon Aug 20, 2018 8:01 am

gpio_restart and gpio_poweroff are built into the kernel so it should just be a matter of providing the right device tree elements with the right gpio description
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

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

Re: Determining via GPIO is the OS has fully shutdown?

Mon Aug 20, 2018 8:34 am

An overlay to enable this feature already exists:

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

Return to “Compute Module”

Who is online

Users browsing this forum: No registered users and 4 guests