AN2831
Application note
Using the STw4102 for Li-Ion battery charging and monitoring
Introduction
Many portable applications now use Li-Ion batteries for which a dedicated charging system
is required. Handheld devices such as mobile phones, music and video players, as well as
portable navigation devices tend to integrate ever more multimedia functions that each have
different power needs. As such, it has become difficult to manage the battery capacity and
predict the remaining operating time with no dedicated gas gauge support. The STw4102 is
a new innovative device that combines the charge control function and battery monitoring
features in the same package for reduced PCB area use and global cost optimization.
This application note is intended to assist product designers by taking advantage of using
the STw4102 in one-cell Li-Ion battery handheld applications to implement the charge and
battery monitoring functions. The document provides:
● a brief description of the STw4102 and typical applications.
● a general flow chart of the tasks needed to control the STw4102.
● information on how to use the STw4102 to charge a battery from a wall adapter or USB
cable.
● information on how to use the battery monitoring functions of the STw4102 to build a
gas gauge system.
October 2008 Rev 1 1/16
www.st.com
About the STw4102 AN2831
1 About the STw4102
The STw4102 combines the charge and battery monitoring functions in the same package.
The charge function is a standalone constant-current constant-voltage (CCCV) linear
charger dedicated to the one-cell Li-Ion battery. The STw4102 offers a dual-charging
capability using separate inputs for a USB cable and a wall adapter, or a single input that
accepts both. The charge current can be programmed to a maximum of 100 or 500 mA for
use with a USB 2.0 port, or programmed to the value set by an external resistor for use with
a wall adapter or a dedicated USB charger.
The STw4102 battery monitoring function includes measurement of the battery voltage and
current, and computation of the battery charge variation (Coulomb counter). An external
sense resistor used in series with the battery adapts the current measurement to the
application requirements.
A typical application of the STw4102 is shown in Figure 1.
Figure 1. Typical application diagram for the STw4102
TO$""
)NDICATOR,%$
2ESET
)/VOLTAGE
#
)/VOLTAGE
-!).
53"072
072$%4%#4.
%/#('
#62%&
,$/$26
,$/&"
6)/
3#,
3$!
2%3%4.
34W
'.$
6/54
3%.3%
"!44
"!443%.3%
)3%4
#6)3
#+(:
34$"9
)#'
)#'
2
#
K(Z
3TAND"Y
2
2/16
!-
AN2831 About the STw4102
The STw4102 mode and operation are controlled through an I2C interface. The VIO voltage
is the supply voltage for the digital I/Os.
● SCL and SDA are the clock and data signals of the I2C interface.
● RESETN is used to reset the STw4102 registers to their default value.
● C32KHZ is a 32,768 Hz clock signal used as a time base for the gas gauge.
● STDBY may be used to put the battery monitoring functions in standby mode by using
a hardware signal, the standby state is controlled by a combination of the STDBY
signal and the CG_ENA and ADPOWERON bits in the internal registers. If not used,
the STDBY pin must be connected to VIO.
Refer to the STw4102 datasheet for more detailed information
(a)
.
a. See Table 7: Document references.
3/16
General control flow chart AN2831
2 General control flow chart
Figure 2 depicts the general flow chart to control the charge and battery monitoring
functions of the STw4102.
Figure 2. General charge and battery monitoring flow chart
!PPLICATIONSTA
ZETHECHARGEPARAMETERS
)NITIALI
3TARTTHEGASGAUGESYSTEM
3ETUPAPE
RIODTASKh'AS'AUGEv
RTUP
0ERIODTASK@'AS'AUGE
2EADGASGAUGE
2EADBATTERYVOLTAGE
2EFRESHWATCHDOG
0/7%2$%4%#4.FALLINGEDGE
3TARTOFCHARGE
3ETUPTHECHARGETIMER
!PPLICATIONSHUTDOWN
)FCHARGINGSTOPCHARGING
3TOPGASGAUGE
53"STATUSCHANGE
5PDATECHARGECURRENT
0/7%2$%4%#4.RISINGEDGE
ORCHARGETIMERELAPSED
The controller tasks are described in detail in the following sections.
%NDOFCHARGE
!-
4/16
AN2831 Charge function
3 Charge function
The STw4102 charge function is designed to be controlled by the application system
controller. However, if the controller is not active (for instance when the battery is fully
discharged) the STw4102 operates in standalone mode.
When the system is in the power-down state, the supplies are usually switched off and VIO
is not present. In this case, all the I/O lines, especially the RESETN signal, are low and the
control registers are automatically reset to the default values. The STw4102 starts charging
as soon as a power source is connected to the MAIN or USBPWR inputs.
3.1 Power-up conditions
The charge is enabled at power-up so as to be able to charge an empty battery when the
controller is unable to start due to the battery voltage being too low.
In the standard configuration, the power-up conditions are as follows.
● The charge voltage is set to 4.1 V to ensure maximum safety with all kinds of Li-Ion
batteries.
● The MAIN input is in the wall adapter mode, meaning that the charge current is set by
the external resistor; this corresponds to a configuration where the wall adapter and
USB cable use separate inputs.
● The USB charge current is set to 60 mA to comply with the USB 2.0 regulation.
● The watchdog is enabled and is set to one minute.
For special requirements (for instance, if the STw4102 is used in the common wall
adapter/USB input mode) and on request, some power-up values can be changed directly at
factory level.
● MAIN input mode: either wall adapter mode or USB mode.
● Watchdog enable or disabled: period = 1, 15, 30 or 60 minutes.
Refer to chapter 9 of the STw4102 datasheet for all factory options
(b)
.
When the system controller starts, it has to set the appropriate charge parameters.
● Charge voltage: usually 4.2 V for most batteries. The 4.1 V setting can be used to
extend battery lifetime but with reduced capacity. New high performance battery
generations may take benefit of the 4.30 and 4.35 V settings (consult battery
datasheets).
● MAIN input mode, if different from the power-up mode.
● USB current capability depending on the USB state: 0, 60 or 400 mA.
● Watchdog delay: it is recommended to keep the watchdog enabled and set to 1 minute
for maximum charge safety. If the watchdog is not used it must be disabled with
WDOG_EN=0 and cleared with WDOG_RST=1.
This is done by accessing the REG_CHG0 and REG_WDOG registers. The charge
parameters are kept in the STw4102 registers until the RESETN signal goes low.
b. See Table 7: Document references.
5/16