# What is wrong with my USB Li-Ion charging circuit?

I'm trying to design my own PCB based off of this one: My relevant schematics are here: Their Q3 transistor DMG3415U-7 was going obsolete, so I used DMP2045U-7, which seemed to be a similar replacement. As well as another regulator.

For the battery charger (U3 in the original schematics, U10 in mine), I wanted to use the MCP73831 variant (datasheet here), which includes these 3 status outputs: So to read out all 3 possibilities from a microcontroller, I added the scheme with R12-R14 and D10. The idea was that there would be a Vbus of 5V from the USB cable. If the chip output STAT is low, the pickoff point would be 0V. If it was high it would be 2.5V, and the diode would protect from any unwanted current flow between STAT and Vbus. If STAT is high impedance, the pickoff point would be 1.6V. So with an ADC at the pickoff point I could differentiate between all 3 states. PROG is set to ground on the microcontroller pin it connects to.

I fabricated the board, and this is not working. Firstly, the MCP chip doesn't charge the battery. If there is USB connection but no battery, the Vbat output is 0V. If both USB and the battery are connected, Vbat measures the voltage of the battery (say 3.5V), not 4.2V or another voltage used to charge at Constant Voltage. I left it "charging" for 12 hours and the voltage never changed.

Secondly, the "STAT" output scheme is not working. Measuring the voltages as Vbus, Vstat, and the pickoff point, the voltages measured with a multimeter in the different situations are as follows:

No Battery:

Vbus = 5V

Vstat = 3.86V (should be 3.3V)

Vreading = 2.82V (should be 1.6V)

"Charging":

Vbus = 5V

Vstat = 3.86V (should be 0V)

Vreading = 2.82V (should be 0V)

No USB, only battery plugged in:

Vbus = 1.46V (should be 0V)

Vstat = 2.5V (should be 0V)

Vreading = 1.95V (should be 0V)

I don't understand what could be going wrong. Vbus and Vbat are direct connections to their sources otherwise, they don't connect to any other components not seen in the schematics. Is there something wrong in the design? Why would both charging and the status indicator not be working correctly?

## 1 Answer

If you have a spare GPIO, rather than using the voltage divider, you could use the following circuit. This circuit simply takes a second GPIO pin (CTL) that you can use to pull up or pull down STAT using the p-channel (Q5) and n-channel (Q6) MOSFETs. If STAT is floating, then it will change depending on the value of CTL, otherwise STAT will stay the same.

Given I wanted to use a 3.3v MCU, I then used Q7 to drive inverted output with a pull-up to 3.3v

To get the value of ~STAT will mean you will need to take 2 readings, one with CTL high and another with CTL low.

Hope this helps.