GeorgeIoak
Posts: 40
Joined: Thu Aug 30, 2012 1:50 am

Confirmation of gpio-poweroff Behavior

Wed Jan 03, 2018 8:27 pm

I've been running some experiments and wanted to confirm the behavior I'm seeing. I'm running the latest Stretch and firmware has been updated.

In /boot/config.txt I have:

Code: Select all

dtoverlay=gpio-poweroff,gpiopin=21,active_low="y"
dtoverlay=gpio-shutdown,gpio_pin=20
This seems to work properly but the delay before GPIO21 changes is over 4 seconds (yellow line is Pi's 3.3V, blue is GPIO21):
GPIO21_Not_inDTS_PowerUp.PNG
GPIO21 Power Up
GPIO21_Not_inDTS_PowerUp.PNG (5.54 KiB) Viewed 222 times
Here is what it looks like on power down:
GPIO21_Not_inDTS_PowerUp.PNG
GPIO21 Power Up
GPIO21_Not_inDTS_PowerUp.PNG (5.54 KiB) Viewed 222 times
I wanted to reduce the time that it takes for GPIO21 to go up/down so I created a "blob" with:

Code: Select all

            //pin@p20 { function = "input"; termination = "pull_up"; polarity = "active_low"; }; // Pi_GPIO20
            pin@p21 { function = "output"; termination = "pull_up"; startup_state = "active"; }; // Pi_GPIO21
I found that I don't need to define GPIO20 in my situation but it's in there from a prior test. When this is added I see the following changes:

Power Up now looks like this:
GPIO21_inDTS_PowerUp.PNG
GPIO21 Power Up (DTS)
GPIO21_inDTS_PowerUp.PNG (5.93 KiB) Viewed 222 times
Power Down will be shown in the next thread since I can't add 4 files
Attachments
GPIO21_Not_inDTS_PowerDwn.PNG
GPIO21 Power Down
GPIO21_Not_inDTS_PowerDwn.PNG (6.31 KiB) Viewed 222 times

GeorgeIoak
Posts: 40
Joined: Thu Aug 30, 2012 1:50 am

Re: Confirmation of gpio-poweroff Behavior

Wed Jan 03, 2018 8:28 pm

GPIO21 Power Down when using "blob"
GPIO21_inDTS_PowerDwn.PNG
GPIO21 Power Down (DTS)
GPIO21_inDTS_PowerDwn.PNG (6.09 KiB) Viewed 220 times
So why does GPIO21 not stay low?

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

Re: Confirmation of gpio-poweroff Behavior

Fri Jan 05, 2018 10:14 am

Running the same tests I get different results - it works as expected.

First without the dt-blob:
without_dtblob.png
without_dtblob.png (53.38 KiB) Viewed 172 times
Then with:
with_dtblob.png
with_dtblob.png (53.55 KiB) Viewed 172 times
Apart from a decrease in the time before GPIO21 goes high, the two traces are essentially the same.

My advice is to work with the natural pull of the GPIO (0-8 pull high, 9-27 pull low), if possible, then there is no need for the dt-blob:
gpio4_noblob.png
gpio4_noblob.png (53.88 KiB) Viewed 172 times

GeorgeIoak
Posts: 40
Joined: Thu Aug 30, 2012 1:50 am

Re: Confirmation of gpio-poweroff Behavior

Sun Jan 07, 2018 12:11 am

Hi Phil,

Well I've got a custom board designed, built, and attached to the Pi so I need to work with these 2 GPIO pins (20 and 21). It looks like in your first capture without the dt-blob GPIO 21 doesn't go low until about 10 seconds after you toggle GPIO 20 low, is that correct? There are seems to be a bit of a bounce before GPIO 21 goes low. Perhaps I'm zoomed in on this bounce and not seeing the complete picture that you're showing with the logic analyzer captures. Would you mind zooming in and showing me what your GPIO 21 looks like when it first goes low please.

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

Re: Confirmation of gpio-poweroff Behavior

Sun Jan 07, 2018 9:50 pm

My boot sequence is particularly slow because kernel UART output is enabled and it is running from an NFS-mounted root FS, but that should not alter the final shutdown sequence.

At the end of the power-down the gpio-poweroff driver sets the pin active (low) for 100ms, then inactive (high) for 100ms, then active (low) again.

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 1 guest