I see two separate questions re use and configuration of "power buttons" to halt and boot an RPi 4:
Question 1:
Is the shutdown initiated with connecting the GPIO3 pin and the GND pin considered a safe shutdown?
Answer:
Yes - it is a safe shutdown. For details & confirmation, see REF 1 and REF 2.
Question 2:
I know that I can change the pin for shutdown, by changing dtoverlay=gpio-shutdown to dtoverlay=gpio-shutdown,gpio-pin=X, but is there a way to change the pin for boot up as well? Considering GPIO3 is normally used for I2C.
Answer:
Before going any further, I'd like to make sure we're clear on two points:
You can startup and shutdown your RPi with a single push-button switch connected between GPIO 3 and GND. You didn't specifically say that you wanted this 1-button arrangement, but it's far more convenient than using separate buttons for shutdown and startup. The only good reason I can think of to do it any other way is to reduce energy consumption while leaving power connected to the RPi.
Shutting down your RPi - whether done with a button press, or from the command line - does not remove power. Your RPi will continue to consume some power in shutdown
unless and until you "pull the plug".
That said, let's review the options:
Option 1. Move I2C from GPIO 3 and GPIO 4
The latest version of the firmware provides numerous overlay
options for "relocating" I2C1, and/or "adding" I2C buses in /boot/config.txt
. Review the latest version of the README for details.
This is the easiest option, and you need not read any further unless you need to minimize power consumption while in shutdown
.
Option 2.
The RPi 4 introduced a new bootloader that's stored in EEPROM (instead of a bootcode.bin
file). It also provided new configuration properties - two of which are relevant to reducing power consumption while the RPi 4 is shutdown
or halt
ed; i.e. the system is not running, but is powered up:
WAKE_ON_GPIO
If 1 then 'sudo halt' will run in a lower power mode until either GPIO3 or GLOBAL_EN are shorted to ground.
Default: 1 (0 in original version of bootloader 2019-05-10)
Version: All
POWER_OFF_ON_HALT
If 1 and WAKE_ON_GPIO=0 then switch off all PMIC outputs in halt. This is lowest possible power state for halt but may cause problems with some HATs because 5V will still be on. GLOBAL_EN must be shorted to ground to boot.
Default: 0
Version: 2019-07-15
This informs us that the GLOBAL_EN
input node may be used in lieu of GPIO 3 to restart the RPi 4 in all possible configurations of these parameters. Three things should be noted re GLOBAL_EN
:
- It is not a GPIO
- It is pulled up to 5V
- The actual restart is not* triggered when
GLOBAL_EN
is pulled LOW by pressing the pushbutton, but when it is "released" and allowed to return to its "pulled-up" (logic HIGH) state.
The GLOBAL_EN
node is shown in the photo below:
Summary for Option 2:
This is more difficult than Option 1, but offers the advantage of reduced power consumption in halt
/shutdown
. The most straightforward hardware implementation is to use two pushbuttons - one for startup, one for shutdown. If you want to take some additional effort, a single button startup & shutdown solution is illustrated here.