0
\$\begingroup\$

I have a Raspberry Pi project powered by LiPo via an Adafruit Powerboost 500C. Trying to maximize battery life without changing platforms (yet).

My solution is to incorporate the Adafruit TPL5111 to wake the device every once in while but shutting it down will be the problem.

The TPL5111 needs a GPIO shutdown signal from the Pi (so obviously the Pi is powered on to do that) but as soon as the TPL5111 receives that signal, power is cut completely.

Mounting the partitions as read-only is one way to minimise SD card corruption but id rather have circuitry that keeps the power flowing long enough after the signal is received for the Pi to shutdown safely.

Are there any (simple and small sized) solutions i could employ? Maybe a simple capacitor setup or something?

Space is VERY tight as it is so that's issue number 2...

Thanks in advance!

\$\endgroup\$
4
  • \$\begingroup\$ You could probably set up a discrete circuit to delay the signal for long enough until the RPi shuts down. No need for huge caps. \$\endgroup\$ – Wesley Lee Oct 9 '17 at 0:14
  • \$\begingroup\$ I see, so rather than extending the power to the Pi, delay the signal. Without seeming like i want people to do all the work for me, How would one generally go about doing that? Im fairly new beyond soldering leds and basic stuff \$\endgroup\$ – sryan2580 Oct 9 '17 at 0:16
  • \$\begingroup\$ A way to overkill it is set a small micro to send a pulse X seconds after it receives a pulse, this way you can modify the delay without changing components. I'm sure there are many discrete ways of doing this (something like a modified soft start for example) but none of them occur to me now. Maybe something with a 555. \$\endgroup\$ – Wesley Lee Oct 9 '17 at 0:23
  • \$\begingroup\$ A timed based approach is less than ideal, as it will be hard to know deterministically how long the shutdown process will take. It's also unnecessary. \$\endgroup\$ – Chris Stratton Oct 9 '17 at 3:17
1
\$\begingroup\$

You're mixing up distinct meanings of "shutdown".

With something like the pi that can't ordinarily turn off its own power, what happens is that the the system should be rendered safe for power loss (file systems unmounted, storage devices de-initialized if possible, etc), and then the processor enters an end-state condition - either an infinite loop with interrupts disabled, or an actual halt condition.

What you need to do is get in right at that point, and drive the GPIO at the point where the processor is done with the safe system shutdown, and is in a non-returnable state. At that point, it doesn't matter if the halt or infinite loop executes and the user pulls the power cable, or if the GPIO operation you add right before that last instruction instead removes the power, because you are inserting this instruction only at the point where power removal is already safe.

This would be kernel mode code, you might see if anything in /arch/arm/kernel/process.c seems to be the version in use, or if it is elsewhere. GPIO on the pi is indirect, so you may need to do some work to figure out how to still accomplish that in an all-but-stopped system.

\$\endgroup\$
1
  • \$\begingroup\$ I dont remember the name but there is a kernel module which does exactly this - output a signal as long as it's running and turn it off before shutting down. It was mentioned somewhere in the docs fir dt bindings if memory serves. \$\endgroup\$ – Jan Dorniak Feb 28 '18 at 23:59

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.