2

I'm using this Battery Charger IC.

My question is,

Datasheet mentions, if STAT1, STAT2, and PG# are connected to MCU then We need to connect a pull up do we need to pullup to MCU VCC voltage or MCP73871 Vin?

Regarding SEL Pin, Although, I have connected a pull-up on SEL Pin. If I connect USB Cable how will this be impacted…? Only the current that can be supplied will be different right? If I adjust the charging current to be less than 500mA. We should be able to power the device with either USB Cable or AC/DC Adapter right?

2 Answers2

4

The datasheet states that STAT1, STAT2, and PG# are open-drain outputs. This means that they have a transistor between the pin and GND. When the signal is asserted, the transistor turns on and pulls the pin to GND. When the signal is not asserted, the transistor turns off and the pin is high impedance (Hi-Z), i.e. essentially left floating.

Each of those pins is designed to be able to directly drive an LED. You can see in the Typical Application Circuit on page 2 of the datasheet that each pin has an LED going from the IN voltage to the pin:

MCP73871 Typical Application circuit diagram from page 2 of the datasheet. Three LEDs with 470 ohm series resistors are connected from the input supply to the STAT1, STAT2, and PG# pins.

This arrangement acts exactly like a low-side MOSFET switch, except the MOSFET is inside the IC. When the STAT1, STAT2, or PG# signals are asserted, the MOSFET switches on and current flows from power, through the respective LED, to ground. When the signals are not asserted, the MOSFET switches off and no current can flow across it.

If you would rather interface these pins to a microcontroller (or some other logic input) instead of using them to drive LEDs, then you need a way to convert the open drain output (Hi-Z and GND) to two defined logic levels (VCC and GND). That's where the pullup resistor comes in - when the transistor is switched off, the resistor pulls the voltage up to some defined high state, rather than leaving the output floating (Hi-Z). The voltage that you should pull up to is, therefore, the voltage level for the input pin on the device (e.g. MCU) that you're trying to interface with. In this case, you'd pull up to VCC on your MCU.

The SEL and PROG2 pins are designed to be used to specify the current that is allowed to be drawn from the input pin. The SEL pin documentation says this:

The input source type selection (SEL) pin is used to select the input power source for the input current limit control feature. With the SEL input high, the MCP73871 device is capable of providing 1.65 (typical) total amperes to be shared by the system load and LiIon battery charging. The MCP73871 device limits the input current up to 1.8A. When SEL active-low, the input source is designed to provide system power and Li-Ion battery charging from a USB Port input while adhering to the current limits governed by the USB specification.

The SEL pin should be set low when the IN pin is powered from the VBUS pin of a standard USB port. The PROG2 pin should initially be set low, so that no more than 100mA is drawn from the port when it is first connected, as per the USB specification. After USB negotiation completes (with the aid of your MCU, or some other USB interface chip), PROG2 may be set high after the USB negotiation process confirms that 500mA operation is allowed.

If you're powering the IN pin from a DC barrel jack, you can set SEL high and ignore PROG2 entirely. The MCP73871 will then source up to 1.65A from the IN pin, as needed, to charge the battery and supply the device. However, you should not set SEL high when connecting to a standard USB port, because this will exceed the maximum current draw allowed by the USB specification.

The datasheet's mention of the 1.8A current limit when SEL is high is no accident. This ties in with the USB Battery charging Specification. You can read about this here but the idea is that USB Dedicated Charging Port can supply a maximum of 1.8A without active negotiation. Importantly, you must first detect whether you are connected to a Standard Port or a Dedicated Charging Port, before asserting SEL high. You aren't allowed to set SEL high until you've detected the presence of a Dedicated Charging Port.

A Dedicated Charging Port has a 200Ω resistor between the D+ and D- pins. To detect this, you apply 0.5-0.7V to D+, and connect D- to a 100µA constant-current sink. You then use a comparator to check if the voltage at D- exceeds around 0.3V. If a 200Ω resistor is not present across D+ and D-, the voltage at D- will be pulled low by the current sink, which tells you that you're connected to a USB Standard Port. If there is a 200Ω resistor, the voltage at D- will be pulled high, because the 0.5-0.7V source from D+ through 200Ω to ground would be around 2.5-3.5mA, and the sink is only 100µA, and this tells you that you're connected to a USB Dedicated Charging Port. You can implement this yourself, or you can get a charge controller chip that performs this detection for you and outputs a logic signal that you can use to drive the SEL/PROG2 pins as needed.

Polynomial
  • 10,562
  • 5
  • 47
  • 88
1

To give a short answer: yes, if you want to read PG, STAT1 and STAT2 from your MCU those need to be pulled up to your MCU's VCC. You can also use internal pull-up resistors if available pinMode(PG_PIN, INPUT_PULLUP);.

Your second question is trickier.

ON USB ports USB devices are normally only allowed to draw 100mA in the beginning (or if they are dumb).

They need to "talk" to the USB host port an request for instance to draw 500 mA. Only if the USB host allows the device to draw that much, the device is allowed to switch to the 500 mA charging mode. The SEL pin is meant to implement this.

Many maker devices ignore this rule and immediately draw 500 mA without even contacting the host. While this is often tolerated, it is beyond the USB specs and may cause strange behavior (host may disconnect the device) or can cause malfunction on other ports etc.

The story is different with USB charging adapters though. Here it depends on the adapter what really happens.

To be absolutely safe a charging current of 100 mA has to be chosen if charged from USB ports (like on computers) - this is always safe. If your device authenticates to the host, it may increase power draw to 500 mA afterwards if it gets a go from the host.

datenheim
  • 900
  • 1
  • 15