Chris Green <
c...@isbd.net> wrote:
> Theo <
theom...@chiark.greenend.org.uk> wrote:
> >
> > You use external power control if you want that.
> >
> How? I.e. if I shut down the PI and there's still power on the
> peripherals doesn't it damage the Pi? How then can you do any sort of
> shutdown from the Pi without risking its hardware? E.g. wouldn't an
> LED operated by the Pi still be pushing (some fraction of) 5v into the
> GPIO pin driving it when you shut down the Pi?
>
> It would seem the only safe way to shut down is to pull the power, but
> then you risk corrupting software.
'shutdown' or 'poweroff' commands shut down the OS, so the OS flushes disc
caches, puts the CPU into an idle state and then stops executing
instructions. There's no power control, so the board remains powered. The
chip is still 'on', so electrically speaking everything is as it is when the
system is running, just the software isn't doing anything any more.
In the case of an LED on a GPIO, either the pin is still driving low or high
as the last time it was set, or it's turned into a high-impedance input so
no current will flow into/out of the I/O pin. Either way won't cause harm.
The 'shutdown'/'poweroff' procedure will put the software in a safe state so
you can pull the plug, but it doesn't have the hardware to pull the plug for
you.
If you choose to disconnect things, eg unplug a HAT, while the Pi is still
powered that's your lookout. You should physically remove power before
doing so (just like you should work on mains equipment unless physically
unplugged). There are cables for that:
https://thepihut.com/products/usb-c-cable-with-switch
> > > The Beaglebone Black has both 5v and 3.3v output power pins that power
> > > down when you shut the machine down.
> >
> > The BBB I think powers those from voltage regulators, which stop when the
> > CPU shuts down. The Pi's power (on the early ones) is bidirectional so
> > powering it from the GPIO header is a feature.
> >
> The BBB can be powered from it's 'GPIO' header too, it has both 5v in
> and 5v out as it were, on different pins.
OK, so it's not bidirectional, it can turn off the power on the 'out' pin
while being powered from the 'in' pin. The Pi doesn't have such hardware:
there are electrical connections between all of the 5V inputs (via some
limiting for USB, on some boards).
Theo