xorbit / LiFePO4wered-Pi

Access library, command line tool and daemon for the LiFePO4wered/Pi module
GNU General Public License v2.0
132 stars 31 forks source link

Pi doesn't seem to shutdown seems to be in loop #24

Closed bbourqu closed 5 years ago

bbourqu commented 5 years ago
[ ~ ]$ lifepo4wered-cli get AUTO_BOOT     
4
[~ ]$ lifepo4wered-cli get AUTO_SHDN_TIME
0

When I unplug from the powersource the PWR LED pulses and I can see the activity LED on the Pi show like its in its shutdown phase but the power LED never shuts off and the activity LED continues to blink. The PWR LED never stops pulsing. No SSH access until I plug the power supply back in. The fan I have connected to the VOUT pads also continues to run. Holding down the switch for 10 seconds does shut off the pi.

Is there anything I'm missing that might create an issue? The scenario I'd like to have is that when main power is removed, then the pi is gracefully shutdown, on main power return the pi is booted back up.

Raspberry Pi 3 B+ running Raspbian Stretch.

xorbit commented 5 years ago

Hi, That is the correct config to get the behavior you want. Which LiFePO4wered model do you have and when did you get it?

bbourqu commented 5 years ago

  LiFePO4wered/Pi+ (14500 Battery) non-stackable headers. About 13 days ago(Shipped Nov, 1st)

xorbit commented 5 years ago
# I2C device tree settings
dtparam=i2c1=on
dtparam=i2c_arm=on

# UART device tree settings
enable_uart=1

If for some reason the TX line is not going low or it is not being detected, there are a couple of workarounds:

https://lifepo4wered.com/files/LiFePO4wered-Pi+-Product-Brief.pdf

bbourqu commented 5 years ago

UART device tree settings

enable_uart=1 gpu_mem_256=128 gpu_mem_512=256 gpu_mem_1024=256 overscan_scale=1



* I don't have a way currently to check that pin

I'll try the first option and report back
bbourqu commented 5 years ago

Before trying the first option I pulled the power again. This time the pi shutdown. Plugged the power back in, power came back on.

Tried again, pi shutdown, plugged in pi came back on. Tried one more time and this time I got back into the power cycle loop.

Let the Pi run for about ten minutes and tried the cycle again, same thing about every third time the pi gets into the loop. I plug in and unplug over maybe a two minute period.

xorbit commented 5 years ago

Ooooh I know what's going on. Your description of how it sometimes works and other times doesn't made me realize, and I should have figured this out sooner from the info you gave.

The bottom line is that the 14500 small battery model is unfortunately not compatible with the Pi 3 Model B+. Full explanation is on page 14 of the product brief: https://lifepo4wered.com/files/LiFePO4wered-Pi+-Product-Brief.pdf.

My opinion is that the power system on the Pi 3 Model B+ is not designed well and doesn't have enough decoupling capacitance on board to take care of load spikes. The result is that the power source becomes partially responsible to deliver the current for these load spikes. [This lack of on-board decoupling and filtering for the power system is also what caused them the problem with their own PoE HAT, they "fixed" that by adding more filtering to the HAT. This doesn't take care of the root cause in my opinion, it's more of a patch.]

In the LiFePO4wered/Pi+, the 14500 battery version has more series resistance in the power path than the 18650 version. When the Pi 3 B+ pulls a sudden current spike from the 18650 version, the power path is capable of pulling this from the battery and the boost converter doesn't brown out. Due to the higher power path resistance (both battery internal resistance and current sense resistor) of the 14500 battery version, these spikes cannot be pulled fast enough from the battery and the boost converter goes into brown out.

Hence your power cycle loop. During shutdown, the system is reset by the brown out instead. It boots again, detects external power is missing and starts a shutdown. This is again interrupted by a brownout, the system resets again, and so on.

The 14500 version was mostly intended for lower power systems but it works with the original Pi 3, I haven't seen any such issue when used with that board. Unfortunately, with the Pi 3 B+ it doesn't work out of the box.

As is noted in the product brief, you can make it work by adding a bulk capacitor (470 uF) to the Vout pads. This will allow load spikes to be pulled from the bulk capacitor instead of through the boost converter and power path.

bbourqu commented 5 years ago

Lets go ahead and close this issue. I got the capacitor but totally messed up the pads de-soldering and soldering back. I'll look at purchasing the correct version at a future date.

openedhardware commented 4 years ago

I do have the same issue.. RPi 3B+ and 14500 battery.

@xorbit

What is a desired value for IOUT_SHDN_THRESH register?

Otherwise, where should I add the bulk capacitor?

Thanks!

xorbit commented 3 years ago

@openedhardware You need to determine IOUT_SHDN_THRESH experimentally for your system. Get the value of IOUT and go from there. That said, I think a value of about 120 (mA) may work if you don't have external (USB) loads etc. Note that you should only use this if the TX line shutdown detection doesn't work for you for some reason.

Bulk capacitor can be added to the VOUT pads.