I have a pi in an embedded project. When the user turns the instrument off, I want to inhibit turning back on until the pi is done shutting down. I can do this with a timer circuit, but would like to minimise the inhibit time. Is there a way to detect the status of the pi? GPIO pins appear to retain their state and the RUN and EN pins on the (not installed) header are always at 3.3v.
2 Answers
This howchoo post shows how to connect an LED to show the status of the Pi. The LED is steady on when the Pi is running, and off after shutdown.
Briefly:
Add this line to /boot/config.txt, and reboot
enable_uart=1
Connect the TxD pin (GPIO pin 8) to the positive lead of a 2 or 3 volt LED.
Connect a ground pin (e.g. GPIO pin 6) to a 330 ohm resistor, then to the negative lead of a 2V LED.
I have not yet tried this, it's on my to-do list.

- 329
- 2
- 6
-
The UART is used for communication between RPi and my instrument's microprocessor, so is not easily available. – Graham Brown Jun 10 '19 at 15:19
As you have noted GPIO pins retain their state when shutdown.
There are a couple of exceptions where the state is modified by the shutdown process. gpio-poweroff
(which is designed for this purpose) is the most reliable method.
See https://raspberrypi.stackexchange.com/a/94399/8697
PS RUN and EN pins are INPUTS, and NOT connected to the GPIO. RUN is actually a RESET pin.

- 59,890
- 31
- 101
- 209
When the user turns the instrument off
– jsotola Jun 07 '19 at 21:04