Difference between revisions of "Tristatelogic-vs-opendrain"
Latest revision as of 21:43, 29 December 2016
The datasheet for the MCP73831/2 LiPo charge controllers shows that the chip can be ordered with the STATUS pin preconfigured as either Tri-State Logic or Open-Drain.
So what is the difference and why would you want one over the other?
MCP73832 (Open Drain)
Consider the following:
The dotted box is the charge controller and the (N-Channel) FET controls the STAT pin going to the outside world. As you can see the Drain pin of the FET is not connected to VCC. Therefore, the FET can only be in one of two states; when the Gate is ON, the Drain is pulled to Ground, when the Gate is OFF, the Drain is floating. The floating state becomes useful when we use an external pull-up resistor. This way when the Gate is OFF, the Drain is pulled up by the resistor to VCC.
If we want to add an LED to show the charge status with the open drain charge controller we need to have a look at the available signals for the MCP73832 from the datasheet:
Table 5-1 summarizes the state of the status output
during a charge cycle.
As you can see the available signals are only:
- High impedance (High-Z) when the Gate is OFF (and Drain is floating)
- Low impedance (Low-Z) when the Gate is ON (and Drain is actively pulled to Ground)
If we were to place an LED to Ground in series with R1 like so:
..the LED would turn on when the Gate is ON (Closing the path from Drain to Ground)
In this configuration, and according to the datasheet, the LED would turn on:
- When the Charge Controller is in battery pre-conditioning mode
- Charging the battery in constant-current mode
- topping up the battery in constant-voltage mode
When the battery is full, the 'Charge Complete' status turns the Gate OFF and the path to Ground as seen from the Drain is disconnected and the LED Cathode is floating at VCC, which effectively turns the LED off.
A little more on the pull-up resistor when we're talking about microcontrollers. Most microcontrollers have an internal Pull-up Resistor and can source (some) current to power external circuitry like a LED. The schematic will then look something like this:
MCP73831 (Tri-State Logic)
Now let's have a look at the tri-state function of the STAT pin.
3.3 Charge Status Output (STAT)
STAT is an output for connection to an LED for charge
status indication. Alternatively, a pull-up resistor can be
applied for interfacing to a host microcontroller.
STAT is a tri-state logic output on the MCP73831 and
an open-drain output on the MCP73832.
The charge charge status output can be used to illuminate 1, 2, or tri-color LEDs. Optionally, the charge status output can be used as an interface to a host microcontroller.
5.2.1 STATUS INDICATOR (STAT)
The charge status output of the MCP73831 has three
different states: High (H), Low (L), and High-
Impedance (High Z). The charge status output of the
MCP73832 is open-drain. It has two different states:
Low (L) and High-Impedance (High Z). The charge sta-
tus output can be used to illuminate one, two or tri-color
LEDs. Optionally, the charge status output can be used
as an interface to a host microcontroller.
|Tip||No proper images yet for the tri-state and open drain logic yet|
This is what Tri-State logic looks like:
And this is an Open Drain configuration:
Open Drain has two states, High-Z (high resistance) and Low-Z (low resistance).
To use a common anode tricolour LED (two LED's with their anodes connected, not bicolour):
- Anode was connected to the input power supply
- Green cathode connected to ground with a current limiting resistor.
- Red cathode to the STAT pin.
No chip power supply: LED off
Charging - yellow
Done - Green (But it will also light up green when no battery is present)
You could implement a 'red - charging, green - done' with same LED, but with an extra NPN transistor on the green cathode. So when the STAT is low, transistor is off, but pulls the red cathode low. When STAT is high, transistor on, green LED on, red off.