You can of course use the TXD pin, it goes low when the Pi is halted, but that pin is also used to transmit the boot information. If you want to use this signal to switch off the power to the Pi after it has been halted, it's difficult to use the TXD pin.
Luckily, there is another method available. I literally stumbled on this method when following the activity in another thread, which tries to use the gpio-poweroff device tree overlay. Unfortunately, that possibility seems to need a bit more work and it has some side effects you need to know. Here is that thread: viewtopic.php?f=107&t=113789
In any case, here is a method to make it work through modifying the dt-blob.dts file.
First of all, download the latest dt-blob.dts file from this link.https://www.raspberrypi.org/documentati ... uration.md
Scroll all the way down until you see the download link. Be aware of the caveat mentioned in the file about the dt-blob versions.
Save this file on your Pi and make a copy:
Fire-up your favorite editor and look up the section that is relevant for your Pi, or make the change to all Pi sections, to be safe. You can use any normal GPIO pin, I use GPIO-25.cp dts-blob.dts my-blob.dts
I'm using the older B version, so I need to change the pins_rev2 section:
Code: Select all
pins_rev2 {
pin_config {
pin@default {
polarity = "active_high";
termination = "pull_down";
startup_state = "inactive";
function = "input";
}; // pin
// using GPIO-25 as the power-down signal pad
// active high:
pin@p25 { function = "output"; termination = "pull_up"; polarity = "active_high"; startup_state = "inactive"; };
//
The new dt-blob.bin file will be used during the boot process instead of the default dt-blog.bin file that is compiled into the start.elf boot code.sudo dtc -I dts -O dtb -o /boot/dt-blob.bin my-blob.dts
To create an active low signal, you will need to change the polarity of the signal. You can do that by using a MOSFET. Make sure you select one that is capable of switching at a 3V3 voltage level, or use a higher voltage if you can, depending on the /KILL signal voltage level. And finally, just after doing a shutdown and taking the power from the Pi, this is the result at power-up: Top trace (A) is the 3V3 supply, and the lower trace (B) is the /KILL signal. Here is a screen shot when the Pi is halted. Trace A is the TXD pad, which also goes low, and trace B is the active low /KILL signal.
The /KILL signal can now be used to safely disable the output of the power supply when the Pi has been halted.
If the power is not cycled, shorting the two pins of P6 or shorting the SCL0 (GPIO-3) to GND will restart the Pi.
I hope this helps,
paulv