1

I want an external circuit to know when the Pi has started booting up and finished shutting down. How early/late is it possible to control the pins? And how might it be done?

I'm thinking of writing a simple C program and using systemd to control when it's run.

But how early/late would this actually be able to work? What software alternatives are there for controlling GPIO state as early/late as possible, short of recompiling the kernel or other high-skill methods?

Also I want to avoid hacking the hardware, as I would want to make a hat for the Pi with this circuitry, and I want to be able to install it on a normal Raspbian installation

2

You would have to experiment but I believe the simplest and least intrusive method would be to disable serial boot messages and monitor the UART TX line (GPIO 14, pin 8).

This line will go high during boot and go low at power down.

  • Very clever! Thanks! But if I wanted a simpler circuit, how early/late would regular output pins be settable? (And how might it be done?) – CL22 Oct 19 '16 at 20:39
  • I can't see that you can get an earlier start signal than the UART. I'm also not sure you can get a later stop signal. On the stop side perhaps look at /boot/overlays/README for gpio-poweroff. – joan Oct 19 '16 at 20:46
  • Ah I didn't read your answer properly - I just realised that a UART receiver in the circuit is not necessary - it just needs to monitor the level of the UART to pin and check that the pin stays low for the period of 10 bits or more, since the line stays high without data, and during data, the start/stop bits will guarantee the line will still periodically be high. – CL22 Oct 22 '16 at 9:08
  • @Jodes As far as I am aware, unless something actually uses the port (which is under your control) TXD will stay high between start-up and shutdown. – joan Oct 22 '16 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.