Single Li-Po battery and USB 5V load sharing (power path) dropout on changeover - Page 1
Forum section: electronics / beginners

author: GarthyD
author_rank: Regular Contributor
timestamp: March 03, 2017, 01:33:54 am
content: I am working on a project that uses a single-cell Li-Po battery and 5V USB power. I am using an MCP73831 to charge the battery. I am trying to implement a load sharing design and am experiencing a dropout (causing MCU reset) when the 5V supply is disconnected while switching over to battery power. I am having trouble determining why.Originally I connected the load directly across the battery, and things worked fine. However, I wasn't entirely happy with this design- it won't behave well when slow charging, and may never finish charging.I've put together a load sharing / power path design / dynamic power design (what is the correct terminology here?). The idea is that when the 5V supply is connected, this supply will be routed to the main part of the circuit, and the battery is isolated (via P-channel MOSFET) and charged on its own. When the 5V supply is disconnected, the battery powers the main circuit.Partial schematic attached.The problem I am running into is that when the external power is disconnected, the MCU (SAM4S) downstream resets. I am guessing that this occurs due to the battery power not kicking in fast enough due to a fault in my design. Connecting power doesn't result in a reset- it is only during disconnection.Power is supplied through EXTPWR where it goes through "External Protection" to PWRIN. PWRIN supplies the Li-Po charger ("Li-Po Charger") and produces BAT on the battery. Both PWRIN and BAT feed into "Load Sharing" (this is the most relevant part of the schematic), and the result ends up in PWRLOAD. The remainder shows where PWRLOAD ends up.Diagnosing what is happening has proven difficult as I lack an oscilloscope, and the problem is happening faster than the multi-meter and my eyes can see. I've hacked together a logic analyser on a Raspberry Pi, but this only gives me the ability to determine logic levels, and not at a great speed. The best place to measure that I could think of is the PWRGOOD output of the MCP1825 voltage regulator I am supplying the incoming power to. PWRGOOD is an open-drain ground that is low when the output is worse than 92% of the target voltage. With a pullup it is high when the output is fine. Note that I am measuring at the EN1 input under "Internal Protection and Distribution", which PWRGOOD is connected to. VCCEN is not connected so not significant, leaving PWRGOOD and a pullup.Using the crude logic analyser, when USB power is connected (EXTPWR, PWRIN), I've noticed that PWRGOOD hammers between low and high over a period of about 1.4ms before settling. The MCU does not reset. When 5V is removed, it hammers between low and high for about 10.8ms before settling. This time, the MCU does reset.On the gate of the MOSFET that handles changeover (see "Load Sharing") I have used a voltage divider (10k/22k) to pull the voltage down just that little bit closer to the gate threshold (~-2V) so that the MOSFET switches over sooner. PWRIN is inadvertently connected to a capacitor (see "Li-Po Charger"), so the voltage drops more slowly than it normally would, which might be making the problem worse. Perhaps the MOSFET is taking too long to switch over?I've experimented with different capacitor placement and values to see if this can mitigate the issues, but have thus far been unsuccessful. Of note is that a 100uF capacitor on PWRIN seemed to make things worse, which suggests that the voltage on PWRIN isn't dropping fast enough to switch over the MOSFET, leaving PWRLOAD too low, too long.One issue that also concerns me with the current design is that the output of the load sharing circuit (PWRLOAD) is connected to a capacitor, and this capacitor might have already been charged to more than the 4.2V the battery can be charged to. When the MOSFET flips, this charged capacitor will be connected to the battery. I'm concerned it might cause damage to the battery and charge IC, but my knowledge is lacking here.Ideally I'd like to be able to come up with a solution such that I can count on PWRLOAD remaining as close as possible to the current Li-Po voltage at a minimum as possible. PWRLOAD is only connected to regulators and a single LED so the actual voltage is unimportant, only that it is over a certain minimum. I need the MCP1825 to function reliably over as much of the battery voltage range as possible as it feeds the MCU. The 3.6V regulator ("3.6V Regulation") is less essential as it supplies nothing critical.If there is an IC that can manage some of this process, I'm fine with that too, provided the cost is reasonable (<A$2, ideally <A$1). NB: Not just penny-pinching, it's a A$7 MCU, so it's hard to justify more than A$2 on something that handles power changeover.One option is to revert back to the previous design, and just make the MCU scale back resource usage once it knows that the battery voltage is low (which it will, via ADC). Another is to try to come up with a different design so that the changeover happens really fast (eg. diodes blocking capacitors from supplying the gate signal).If you have any suggestions, input is welcomed. What might be going wrong? Do I just need some tweaking, perhaps specific parts? Or are there better designs to be using? Please point me in the right direction. I can supply further details and test/measure as needed, just let me know.Any input appreciated.

author: GarthyD
author_rank: Regular Contributor
timestamp: March 03, 2017, 09:34:54 pm
content: ... and solved.The problem was the orientation of the MOSFET. With drain and source switched, I no longer see hammering on the enable line or resets on the MCU.Here's what I think went wrong:I'm used to using a P-channel MOSFET as a high-side switch, where the source is connected to VCC, and the load to the drain. This is not the correct way to orient the MOSFET in this circuit.In a P-channel MOSFET, the body diode goes from the drain to the source. In this circuit you want to make sure that the body diode only allows flow from the battery down to the load, which means that you need to hook the battery positive to the MOSFET drain, not its source.In a high-side switch you want no flow through the body diode at all, so VCC is connected to the MOSFET source.The result is the MOSFET being reversed between the two types of circuit.Corrected schematic attached.I hope this helps out someone in a similar position.