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.
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.
Add this line to /boot/config.txt, and reboot
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.
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.
PS RUN and EN pins are INPUTS, and NOT connected to the GPIO. RUN is actually a RESET pin.