dm00089742

AN4324
Application note
STC3115 system integration
Aurelien Mazard
Introduction
Mobile application users demand accurate battery capacity monitoring. In particular, they are interested
to know if the battery state of charge (SOC) in stressful conditions is logical and accurate. To this end,
STMicroelectronics has developed a device (STC3115) which uses its internal algorithm to provide the
user with accurate and reliable information about the battery’s SOC. This tiny chip can be used in any
handheld electronic mobile phone or tablet. The purpose of this application note is to provide the basics
of how to build an accurate fuel gauge system using the STC3115.
A complete fuel gauge system is a combination of hardware and software functions. The STC3115 has
been designed to convert the physical nonlinear measurements of lithium-ion battery models to stable
and compensated information, which can easily be reported to the final user of a mobile application.
Chipset manages the real-time aspects of the battery gauging. It combines the voltage method and
coulomb counter to provide the best accuracy in every application state. The application software is
concerned with the reporting and calculation of application-dependent information.
November 2014
DocID024963 Rev 2.0
1/31
www.st.com
Contents
AN4324
Contents
1
Architectural overview .................................................................... 4
2
STC3115 selection guide ................................................................ 5
3
2.1
STC3115 version selection ............................................................... 5
2.2
STC3115 version detection ............................................................... 6
Battery parameters .......................................................................... 7
3.1
Battery internal impedance identification........................................... 8
3.2
Battery open circuit voltage (OCV) curve measurement and
calculation ...................................................................................................... 9
4
Schematic guidelines .................................................................... 10
4.1
5
6
Sense resistor selection .................................................................. 10
4.1.1
Sense resistor impedance value ...................................................... 10
4.1.2
Sense resistance impedance accuracy ............................................ 10
4.1.3
Sense resistance power dissipation capability ................................. 10
4.1.4
Sense resistor deviation over temperature range (TCR) ................. 11
4.1.5
Sense resistor selection proposal .................................................... 11
4.2
BatD pin system integration ............................................................ 11
4.3
RSTIO pin system integration ......................................................... 14
Place and route guidelines ........................................................... 16
5.1
Vin pin connection ........................................................................... 16
5.2
External sense resistor.................................................................... 17
5.3
Temperature considerations............................................................ 18
5.4
STMicroelectronics PCB design recommendations ........................ 19
Software ......................................................................................... 20
6.1
STC3115 RAM memory organization proposal ............................... 21
6.2
Chip initialization ............................................................................. 22
6.3
STC3115 running configuration....................................................... 27
6.4
Periodic device access.................................................................... 27
6.4.1
6.5
STC3115 task procedure ................................................................ 28
6.5.1
2/31
First STC3115 access after initialization .......................................... 27
How often the STC3115 has to be called in run mode..................... 28
6.6
STOP procedure ............................................................................. 28
6.7
Power saving mode software management .................................... 29
DocID024963 Rev 2.0
AN4324
7
Contents
Revision history ............................................................................ 30
DocID024963 Rev 2.0
3/31
Architectural overview
1
AN4324
Architectural overview
The system architecture has been separated into two main parts in order to facilitate the
most flexible integration. The STC3115 takes physical measurements and reports the
battery state of charge (SOC) through I²C interface while the software layer is concerned
with battery parameter initialization and compensation using all the dedicated features of
the chipset.
Depending on the targeted accuracy of the application environment, the STC3115 can be
used alone without software compensation. In this configuration, the application software
uses only the STC3115 register information to display the battery SOC to the user. If the
temperature and aging effects need to be compensated, the software layer uses the
STC3115 dedicated features.
Figure 1: System architecture overview
4/31
DocID024963 Rev 2.0
AN4324
2
STC3115 selection guide
STC3115 selection guide
Two versions, in two different packages, of the STC3115 device currently exist. They are:
1.
2.
STC3115AIJT / STC3115AIQT
STC3115IJT / STC3115IQT
Either version can be selected to plug onto the application.
2.1
STC3115 version selection
The STC3115 can lend its functionalities to different battery types with different voltage
ranges. Depending on the battery voltage, either the STC3115AIJT / STC3115AIQT or the
STC3115IJT / STC3115IQT can be selected.
Table 1: STC3115 version selection
STC3115 version
Battery voltage (typ)
Battery voltage (max)
STC3115AIJT / STC3115AIQT
3.7 V
4.2 V
STC3115IJT / STC3115IQT
3.8 V
4.35 V
The STC3115 behavior is the same with the different versions but the device uses a
different initial internal open circuit voltage (OCV) curve to track the battery state of charge.
The table below describes the internal OCV curve of each STC3115 version.
Table 2: STC3115 internal OCV curve references
State of charge (%)
STC3115AIJT / STC3115AIQT
STC3115IJT / STC3115IQT
100
4.176
4.313
90
4.076
4.197
80
3.991
4.088
70
3.929
3.990
65
3.899
3.953
60
3.863
3.914
50
3.802
3.825
40
3.778
3.790
30
3.761
3.770
25
3.747
3.761
20
3.721
3.743
15
3.695
3.710
10
3.658
3.675
6
3.618
3.651
3
3.541
3.571
0
3.300
3.300
DocID024963 Rev 2.0
5/31
STC3115 selection guide
AN4324
If the battery to be tracked is not exactly in line with the voltages described in the tables
above, the closest STC3115 version should be selected. Then, by software, the internal
OCV curve is adjusted using the REG_OCVTAB registers (see STC3115 datasheet). The
internal curve can be fine-tuned to better fit with battery behavior, using the OCV offset e.g.
chip initialization (see Section 3.2: "Battery open circuit voltage (OCV) curve measurement
and calculation").
2.2
STC3115 version detection
This section describes how to detect which version of the STC3115 is plugged onto the
application. If the STC3115AIJT / STC3115AIQT version of the device is power supplied, a
4.2 V power supply provides 100 % state of charge information. If the STC3115IJT /
STC3115IQT version is power supplied, a 4.2 V power supply provides 90 % state of
charge information into the STC3115 REG_SOC.
6/31
DocID024963 Rev 2.0
AN4324
3
Battery parameters
Battery parameters
This section describes how to calculate the parameters of the application.
To operate properly, the STC3115 uses typical values of the battery to track the state of
charge (SOC) in the application at a given time.
The parameters can be calculated using the formulae below. This parameter set is
commonly called the "battery model". This model is an image of battery behavior against
the STC3115 principle. The parameters and their calculation are also described in the
STC3115 datasheet.
•
•
•
•
•
REG_CC_CNF: (Rsense x Nominal battery capacity) / 49.556
REG_VM_CNF: (Internal battery impedance x Nominal battery capacity) / 977.78
REG_ALARM_SOC has to be set according to the application needs
(e.g. 10 % as a typical value)
REG_ALARM_VOLTAGE has to be set according to the application needs
(e.g. 3600 mV as a typical value)
REG_CURRENT_THRES: (Battery capacity / 10), up to 200 mA
DocID024963 Rev 2.0
7/31
Battery parameters
3.1
AN4324
Battery internal impedance identification
Thanks to its internal OptimGauge algorithm, the STC3115 does not depend on the
variation of the internal battery impedance over the state of charge (SOC) range. In other
words, only one internal battery impedance value is necessary to represent internal battery
impedance behavior at a given temperature.
The internal impedance factor can be measured using several solutions which are
described in the literature. One solution is to:
•
•
•
•
measure the battery voltage at the end of several minutes discharge
(with a fixed current value)
measure the battery voltage again after 30 minutes of relaxation
calculate the voltage difference
use the discharge current value to find the internal battery impedance
To use this method successfully, a value of around 80 % SOC allows the VM_CNF
parameter (see datasheet) to be calculated with enough accuracy to track the battery SOC
correctly.
Figure 2: Internal battery impedance measurement example
8/31
DocID024963 Rev 2.0
AN4324
3.2
Battery parameters
Battery open circuit voltage (OCV) curve measurement and
calculation
The default OCV curve selected by the STC3115 version can be adjusted to fit the battery
REG_OCVTAB model. The TAB registers can be filled to define the OCV curve as in the
equation: OCV[x] = OCVinit[x] + OCVTAB[x].
The battery OCV curve can be characterized and evaluated by measuring the relaxed
voltage of the battery at a given state of charge (SOC). In the table below, column 2,
"Battery OCV (V)", should be measured using the relaxed voltages of the corresponding
"SOC (%)" values in column 1. These measured points can then be used to define the
REG_OCVTAB(0.55mV) "Value" in column 6 using the equation: REG_OCVTAB[x] =
(Battocv[x] - OCVinit[x]) / 0.55.
Table 3: OCV offset calculation table
SOC
(%)
Battery OCV in volts
(battery measurement
data)
OCV-init(V)
REG_OCVTAB(0.55mV)
STC3115AIJT /
STC3115AIQT
STC3115IJT /
STC3115IQT
Address
100
4.176
4.313
0x3F
90
4.076
4.197
0x3E
80
3.991
4.088
0x3D
70
3.929
3.990
0x3C
65
3.899
3.953
0x3B
60
3.863
3.914
0x3A
50
3.802
3.825
0x39
40
3.778
3.790
0x38
30
3.761
3.770
0x37
25
3.747
3.761
0x36
20
3.721
3.743
0x35
15
3.695
3.710
0x34
10
3.658
3.675
0x33
6
3.618
3.651
0x32
3
3.541
3.571
0x31
0
3.300
3.300
0x30
DocID024963 Rev 2.0
Value
9/31
Schematic guidelines
4
AN4324
Schematic guidelines
The STC3115 is designed to limit the external component amount versus accuracy of the
reported information. To provide the best accuracy versus flexibility, an external sense
resistor has to be selected. The STC3115 provides standard application signal interfaces
that are used to give the best accuracy in specific application-use cases.
4.1
Sense resistor selection
To use the STC3115 enhanced mixed mode, a sense resistor must be placed between the
battery minus pin and the application ground. The sense resistor should be capable of
measuring current accurately so, it is imperative not to connect any signal on the battery
minus pin except the sense resistor.
The external sense resistor measures the current which is used internally by the device
and integrated over time to provide a coulomb counter feature which tracks the battery
state of charge (SOC). The choice of sense resistor is extremely important and has a direct
impact on battery monitoring accuracy. The following points concerning the sense resistor
value and reference must be considered:
1.
2.
3.
4.
5.
4.1.1
Sense resistor impedance value
Sense resistor impedance accuracy
Sense resistor power dissipation capability
Sense resistor deviation over temperature range (TCR)
Sense resistor selection proposal
Sense resistor impedance value
The sense resistor impedance depends on the application maximum current and the
STC3115 Vin_gg input voltage range (see datasheet).
Vin_gg = Rcg x IMax
Where Rcg = sense resistor value in mΩ and IMax = application peak current in A
Vin_gg must be below 40 mV for IMax charging and above -40 mV for IMax discharging.
4.1.2
Sense resistance impedance accuracy
The precision of the sense resistor depends on the targeted accuracy of the application. An
accuracy of 1 % allows the STC3115 to attain its best accuracy.
4.1.3
Sense resistance power dissipation capability
To limit self-heating of the sense resistor due to current flow into it, the power dissipation
capability of the chosen sense reference has to be in line with the application current
consumption. Assuming a voltage drop of 40 mV on the sense resistor and in the case of a
10 mΩ resistor, the sense resistor power dissipation capability has to be at least 160 mW.
10/31
DocID024963 Rev 2.0
AN4324
4.1.4
Schematic guidelines
Sense resistor deviation over temperature range (TCR)
The sense resistor impedance value depends on ambient temperature. The generated
error from temperature deviation has to be limited in order to ensure that the impact of
temperature on current measurement accuracy is minimized. A 0.3 % impedance value
deviation at maximum temperature deviation is acceptable as it does not impact the current
measurement accuracy over the temperature range too much.
Example for a 75 ppm TCR sense of 10 mΩ, with a 40 °C maximum temperature deviation
from typical temperature:
MaxError: ((TCR x Rsense x d) / Rsense) x 100 = ((0.000075 x 0.01 x 40) / 0.01) x 100 =
0.3 %
Where d = temperature in ˚C.
4.1.5
Sense resistor selection proposal
Table 4: Proposed sense resistor references
4.2
Product reference
Manufacturer
ERJM03NF10MV
PANASONIC
WSL0603R0100FEA
VISHAY
DALE
Impedance
10 mΩ
Accuracy
Power
dissipation
Sense resistor
deviation over
temperature
range (TCR)
±1 %
250 mW
±100 ppm/°C
±1 %
100 mW
±75 ppm/°C
Package
0603
BatD pin system integration
The BatD pin detects battery removal events: either the third battery pin is an ID pin or a
thermal information pin. The following three situations describe several application cases
where the battery is removed and how the STC3115 detects such an event:
1.
2.
3.
Battery is removed during a low consumption stage: At this time, the application
consumption is low and the Vbat voltage can take time to decrease (application
capacitor discharging period). At the same time, the third battery pin is disconnected
and the BatD pin voltage is fixed by the pull-up voltage value. Battery removal is
detected rapidly by the BatD feature.
Battery is removed during a high consumption stage: At this time the application
consumption is high and the Vbat voltage decreases rapidly. The STC3115 detects
battery removal and in this case the BatD pin is not used.
Battery is removed if the charger is already connected: At this time, Vbat voltage
maintains the same value or increases slightly. The BatD pin is used to detect battery
removal as the battery voltage information cannot be used.
During battery removal, the BatD pull-up voltage should be ON and higher than 1.61 V
internal threshold.
For most applications, the pull-up voltage should always be available and above the
threshold. The best voltage to use is the Vbat voltage itself.
DocID024963 Rev 2.0
11/31
Schematic guidelines
AN4324
The following configurations can be used. In each one, the R2 resistor is mandatory. If the
STC3115 BatD pin is pulled down to ground, the BatD feature is disabled. Battery removal
and swap events are only detected using the battery voltage reference.
Figure 3: STC3115 BatD schematic if the BatD feature is disabled or not used
1.
Typical R2 value = 1 kΩ
If the third battery pin is used by the charger thermal protection signal, the STC3115 BatD
pin has to be connected to this signal to prevent an open circuit voltage (OCV)
measurement error due to a charging current at application start-up.
This protection mechanism forces the battery protection pin to disable the charger because
it indicates that the battery cannot be charged. This state is maintained during the first OCV
measurement period. The measurement is made only after battery insertion and each time
a battery insertion is detected.
Figure 4: STC3115 application integration if charger provides an internal biasing current
1.
12/31
Typical R2 value = 1 kΩ, Ru = 1 MΩ
DocID024963 Rev 2.0
AN4324
Schematic guidelines
Figure 5: STC3115 application integration if charger provides a reference voltage
1.
Typical R2 value = 1 kΩ, Ru = 1 MΩ
The application can be connected to the STC3115 BatD pin even if it has no charger or the
application charger does not manage the battery security pin. In this configuration, the
BatD feature improves battery presence detection.
Figure 6: STC3115 application integration if charger does not use the third battery pin
1.
Typical R2 value = 1 kΩ, Ru = 1 MΩ
DocID024963 Rev 2.0
13/31
Schematic guidelines
4.3
AN4324
RSTIO pin system integration
The STC3115 RSTIO is an open drain pin which, to operate, must always be pulled-up to a
VCC.
The STC3115 RSTIO feature maintains the accuracy of the first open circuit voltage (OCV)
measurement in all application start-up sequences. This feature prevents the first OCV
measurement from a fast application start-up. If the main application reset signal is
detected as low before the beginning of the first OCV measurement, it is forced low by the
RSTIO pin until the end of the measurement to guarantee measurement accuracy. In this
reset state, the application consumption is low and no battery voltage drop is implied. This
operation takes a maximum of 500 ms.
Several typical application implementations are described below.
The Vbatt voltage used to pull-up the RSTIO signal can be another system voltage such as
an IO voltage (see Figure 7: "STC3115 RSTIO schematic if the RSTIO feature is
disabled"). If the RSTIO pin is pulled-up to a fixed positive voltage or if it is grounded, this
feature is disabled.
Figure 7: STC3115 RSTIO schematic if the RSTIO feature is disabled
1.
Typical R1 value = 1 kΩ
In the architecture of Figure 8: "STC3115 RSTIO feature integration in a PMU based
application", it is assumed that the application processor (AP) consumes the most power.
Once the PMU is ready to provide the voltage and clock to the AP, the RESETN signal is
relaxed by the PMU (which informs the AP that the PMU is ready). The STC3115 RSTIO
pin relaxes this signal at the end of the first OCV measurement.
14/31
DocID024963 Rev 2.0
AN4324
Schematic guidelines
Figure 8: STC3115 RSTIO feature integration in a PMU based application
1.
Typical R1 value = 1 kΩ
Figure 9: STC3115 RSTIO feature integration in PMU and Smart reset based applications
DocID024963 Rev 2.0
15/31
Place and route guidelines
5
AN4324
Place and route guidelines
The four layout "rules" listed below should be followed to achieve the best STC3115
accuracy in an application.
1.
2.
3.
4.
5.1
Connect the Vin signal to the battery connector with a specific track and not directly
through a Vbatt+ plan.
Connect an external sense resistor if the STC3115 is used in mixed mode.
Consider the temperature with regard to the placement of the battery, the STC3115,
and the components of the application.
Use the STMicroelectronics PCB design recommendations.
Vin pin connection
The Vin pin should be connected to the battery connector with a specific track and not
directly through a Vbatt+ plan. This is to improve the voltage measurement accuracy during
the first open circuit voltage (OCV) and during the life of the application.
The voltage drop coming from track impedance and current amount is not negligible
compared to the targeted accuracy of the voltage measurement. This rule aims to minimize
the current impact on the voltage measurement by minimizing the voltage drop due to track
impedance combined with current level.
In low power mode as well as in mixed mode, the STC3115 voltage algorithm is used. In
both configurations and in every application state (sleep, normal, fast) the voltage
measurement accuracy is critical. The lower the current flowing in the Vin track is, the more
accurate the measurement is.
Rule description:
1.
2.
Minimize the track and connector impedances
Minimize the current to take into account for the voltage drop calculation
This is a priority 2 rule and is not mandatory (priority 1 indicates a mandatory rule). If low
power mode is used to track the battery state, this rule becomes a priority 1.
In the diagram below, the image on the left is the correct implementation since the single
Vin track involves a very low current level in the voltage measurement track. The maximum
value of this current is equal to the STC3115 consumption when the Vcc is also powered by
this track. This involves a quasi-null voltage drop and guarantees the best voltage
measurement accuracy in every application consumption condition. To achieve even
greater efficiency, this track should be separated from the other system power supply
tracks that come directly from the battery connector.
16/31
DocID024963 Rev 2.0
AN4324
Place and route guidelines
Figure 10: Vin track implementation (top view)
5.2
External sense resistor
If the STC3115 is used in mixed mode, an external sense resistor has to be connected
between the CG+ and the GND pin. The aim of this rule is to sense the battery flowing
current properly by connecting the STC3115 dedicated pins to the system through the
sense resistor. The protocol for doing this is as follows (priority 1 indicates a mandatory
rule):
1.
2.
3.
4.
5.
Place the sense resistor close to the battery connector with the minimum track length
to minimize the equivalent impedance. In the same logic, ensure the track wideness is
in line with the application power consumption (priority 2).
Connect the STC3115 CG pin directly to the sense resistor without any connection
with the track coming from the battery (VBat-). The CG pin connection with BATD- pin
is performed through the sense resistor pad (see Figure 11: "CG track implementation
(top view)") (priority 1).
Connect the STC3115 GND pin directly to the sense resistor with a track. The sense
resistor has to be independently connected to the ground to avoid any voltage
reference issue. The GND pin connection with application ground plane is performed
through the sense resistor pad (see Figure 12: "GND plan implementation (top view)")
(priority 1).
Connect the sense resistor to the ground plane with the minimum equivalent
impedance to minimize the sense resistor effect on the application behavior
(priority 1).
If there are multiple PCB layers with GND plane or if there is a Vbat track on a layer
other than Reg, the STC3115 CG and GND pins must be connected to the RCG pads
directly on the RCG layer.
DocID024963 Rev 2.0
17/31
Place and route guidelines
AN4324
Figure 11: CG track implementation (top view)
Figure 12: GND plan implementation (top view)
5.3
Temperature considerations
The STC3115 provides an accurate temperature sensor feature. If this internal temperature
sensor is used for battery temperature compensation, the position of the STC3115 with
respect to the battery position impacts slightly the accuracy of the temperature
measurement. The closer the STC3115 is to the battery, the more accurate the
temperature measurement and compensation is.
The other heating components of the application should be placed as far from the
STC3115 as possible to avoid big temperature measurement errors. For example, during
application charging mode, the IC charger temperature can be increased by several
degrees.
18/31
DocID024963 Rev 2.0
AN4324
5.4
Place and route guidelines
STMicroelectronics PCB design recommendations
For optimum electrical performance and highly reliable solder joints, STMicroelectronics
recommends the PCB design guidelines listed below.
Table 5: PCB design recommendations with "solder mask defined"
PCB pad design
Non solder mask defined, micro via under bump allowed
PCB pad size
Ø = 260 µm max (circular) – 220 µm recommended
Ø = 300 µm min (for 260 µm diameter pad)
Solder mask opening
Ø = 260 µm min (for 220 µm diameter pad)
PCB pad finishing
Cu – Ni (2-6 µm) – Au (0.2 µm max)
To optimize the natural self-centering effect of Flip-Chips on the PCB, the PCB pad
positioning and size have to be properly designed (see Figure 13: "PCB design
recommendations").
Figure 13: PCB design recommendations
A thick gold layer finishing on the PCB pad is not recommended (low joint reliability).
The PCB tracks close to the CSP footprint have to be designed to ensure a correct
mechanical assembly (see Figure 14: "PCB track recommendations").
Figure 14: PCB track recommendations
DocID024963 Rev 2.0
19/31
Software
6
AN4324
Software
The STC3115 hardware architecture can autonomously track the battery status. From
battery plug-in to battery plug out, a simple initialization is enough to provide an accurate
battery state of charge (SOC). From this initial point, the system can access when the SOC
has to be refreshed and displayed to the user without any real time constraints.
An additional software layer can also be used to compensate the temperature and aging
effects. This layer uses the STC3115 hardware features for accuracy and to be
independent from the host system.
The software architecture can be separated into several blocks (e.g. start, task, and API)
which are described below.
Figure 15: Software architecture overview
The STC3115 start block initializes and configures the STC3115. Effectively, this block
updates the register reset values so that the values are in line with the battery that has to
be tracked.
The STC3115 periodic task is the software block which periodically reads the STC3115
register to update the system with the new battery status. This block can be enriched to
compensate temperature and aging effects.
The STC3115 software API is the software block between the main application software
and the driver itself. This block allows communication between each layer.
20/31
DocID024963 Rev 2.0
AN4324
6.1
Software
STC3115 RAM memory organization proposal
The STC3115 device embeds a 16-byte RAM memory area.The registers of this area can
be used to periodically save the battery status. This allows battery information to be
recovered when the application is stopped but the battery is not unplugged.
The STC3115 registers can be initialized with memorized data (see Section 6.2) which is
called "restoration". The choice of whether to use a default initialization or a restoration is
based on the STC3115 CTRL_REG and on the RAM memory content.
A RAM organisation is proposed in Table 6 below. The RAM test word is a fixed word but,
the cyclic redundancy check (CRC) word has to be calculated after each RAM write
operation. The CRC calculation can be made using any standard algorithm.
Before checking if the STC3115 can be restored or not, chcek to see if the RAM data can
be used to initialize the STC3115 registers or not i.e. check if the test and CRC words
located in the RAM memory are used to secure and check the validity of the RAM content.
Table 6: STC3115 RAM stack example, 16 bytes @0x20
RAM register
Content proposal
REG_RAM0
RAM test word
REG_RAM1
Battery SOC_LOW
REG_RAM2
Battery SOC_HIGH
REG_RAM3
Battery CC_CNF_LOW
REG_RAM4
Battery CC_CNF_HIGH
REG_RAM5
Battery VM_CNF_LOW
REG_RAM6
Battery VM_CNF_HIGH
...
...
REG_RAM15
CRC
16 RAM bytes can be used to save other information/events
DocID024963 Rev 2.0
21/31
Software
6.2
AN4324
Chip initialization
The STC3115 has to be initialized from a specific value. The initialization process is
different depending on the history of the application before startup. We can identify two
main situations:
1.
2.
New battery plug-in. Full battery initialization has to be performed starting from the
default software point and using the initial battery model. The initial open circuit
voltage (OCV) measurement and state of charge (SOC) have to be used as the initial
battery state. This information can be retrieved from the STC3115 registers.
The battery has not been removed. When the battery has not been removed since the
last application switch off, the last recorded data can be recovered and stored in the
STC3115 using the data saved in the RAM memory.
At every application startup, the following steps are recommended to correctly configure
the STC3115 registers:
1.
2.
3.
4.
5.
6.
Read the chip ID in the REG_ID at address 0x18
Check the RAM memory status (test and CRC words)
If the RAM content is incorrect, initialize the RAM and the chip with default parameters
If the RAM content is correct, check the PORDET and BATFAIL bits
If BATFAIL = 1, the battery voltage was previously decreased below 2.6 V (UVLO
threshold), the Batd pin detected a battery removal/switch event, and the chip has to
be fully initialized. If PORDET = 1, the battery voltage was previously decreased
below 2 V (POR threshold), the battery was removed/switched, and the chip has to be
fully initialized. The STC3115 cannot be restored and full STC3115 initialization is
required (i.e. STC3115 initialization steps).
If the BATFAIL/PORDET = 0, the battery has not been removed and chipset
configuration can be recovered from the RAM data information (e.g. from the RAM
memory content description). STC3115 restoration is possible; the saved RAM data
can be used to restart the STC3115 from a previous application status (i.e. STC3115
restoration steps).
Once the validity of the STC3115 RAM memory and the status of the REG_CTRL register
has been checked, the STC3115 can then be initialized with default parameters or with
restored parameters (see Section 6.1 for RAM content clarification).
STC3115 initialization steps
This is the standard STC3115 initialization flow: all registers have to be initialized using
default values and the first open circuit voltage (OCV) measurement. Carry out the
following three steps when no data can be retreived from the last STC3115 running mode.
1.
2.
22/31
Read the OCV register. The first OCV measurement reflects the initial battery state of
charge (SOC). Read it and save it into a temporary variable.
Set the STC3115 parameters (ensuring first that the GG_RUN bit is set to 0). The
REG_OCVTAB registers have to be filled with their previously calculated values as
well as the values of the REG_CC_CNF and REG_VM_CNF registers. Then configure
the
application
parameters
by
setting
the
REG_ALARM_SOC,
REG_ALARM_VOLTAGE,
REG_CURRENT_THRES,
REG_RELAX_MAX,
REG_ALARM_SOC, and REG_ALARM_VOLTAGE registers as required by the
application to provide an HW interruption signal on the ALM pin when one of the
measurements is detected as being below the defined threshold. The
REG_CURRENT_THRES and REG_RELAX_MAX registers are used to configure the
internal behavior of the STC3115. Default values are enough to provide good
accuracy.
DocID024963 Rev 2.0
AN4324
Software
3.
From this point, the battery model characteristics and application threshold are
initialized and battery tracking can start. To define the battery starting point, write back
the OCV value into the REG_OCV register (16 bits) using the variable content. From
this operation, the first battery SOC is available in the REG_SOC register 100 ms
later. At this point, the provided SOC is based on the fine-tuned OCV curve defined in
Table 3 plus the initial OCV curve described in Table 2.
STC3115 restoration steps
In this case, some registers can be initialized with the recorded RAM data using the
improved battery model from the last running period. Other registers have to be initialized
with default values.
1.
2.
3.
Read the RAM memory. In this case, the last recorded state-of-charge (SOC) reflects
the initial battery SOC. Read it and save it as a temporary variable.
Set the STC3115 parameters (ensuring first that the GG_RUN bit is set to 0). The
REG_OCVTAB registers have to be filled with their previously calculated values. The
REG_CC_CNF and REG_VM_CNF registers have to be initialized using RAM
information that can be different and more accurate regarding battery aging. Then,
configure the application parameters by setting the REG_ALARM_SOC,
REG_ALARM_VOLTAGE,
REG_CURRENT_THRES,
REG_RELAX_MAX,
REG_ALARM_SOC, and REG_ALARM_VOLTAGE registers as required by the
application to provide an HW interruption signal on the ALM pin when one of the
measurements is detected as being below the defined threshold. The
REG_CURRENT_THRES and REG_RELAX_MAX registers are used to configure the
internal behavior of the STC3115. Default values are enough to provide good
accuracy.
Write the REG_SOC register. From this point, the battery model characteristics and
application threshold are initialized and battery tracking can start. To define the battery
starting point, write back the SOC value (read previously in the RAM) into the
REG_SOC register (16 bits). From this operation, the first battery SOC is available in
the REG_SOC register without delay. To start battery monitoring, set the GG_RUN bit,
as well as the VMODE bit if the power saving mode is selected (refer to Section 6.3).
Figure 16 summarizes the initialization steps and Figure 17 summarizes the initialization
and restoration flowcharts.
DocID024963 Rev 2.0
23/31
Software
AN4324
Figure 16: STC3115 initialization type selection flowchart
Applica on
start-up
Check
ID_REG=0x14
Read RAM
memory
If RAM correct
Read @I²C 0x18
Read @I²C
0x20 To 0x2F
no
yes
Read @I²C
0x00 & 0x01
Read
REG_MODE
Read REG_CTRL
If PORDET or
BATFAIL = 0
Reset RAM
no
yes
STC3115
restora on
in
Set STC3115 in
running
24/31
DocID024963 Rev 2.0
STC3115
alisa on
Write 0x00 @I²C
0x20 To 0x2F
AN4324
Software
Figure 17: STC3115 initialization and restoration flowcharts
i
STC3115
Restora on
STC3115
ali
Read
REG_OCV (16b)
Set STC3115
parameters
Read @I 2C
0x0E & 0x0D
Temporary
variable
Write
REG_OCV (16b)
Write @I 2C
0x0E & 0x0D
DocID024963 Rev 2.0
Read
RAM memory
Set STC3115
parameters
Read @I 2C 0x20
to 0x2F
RAM_SOC
variable
Write
REG_SOC (16b)
Write @I 2C
0x03 & 0x02
25/31
Software
AN4324
Figure 18: Set STC3115 parameters flowchart
Set STC3115
parameters
26/31
Write
REG_OCV_
OFFSET
Write @I²C
0x30 To 0x3F
Write
REG_CC_CNF
Write @I²C
0x10 & 0x0F
Write
REG_VM_CNF
Write @I²C
0x12 & 0x11
Write
REG_ALARM_
SOC
Write @I²C 0x13
Write
REG_ALARM_
VOLTAGE
Write @I²C 0x14
DocID024963 Rev 2.0
AN4324
6.3
Software
STC3115 running configuration
During initialization, the STC3115 is in standby mode after initialization. It has to be
configured in run mode to track the battery state of charge (SOC). The GG_RUN bit in
REG_MODE register must be set to one. At same time, STC3115 run mode has to be
selected, by setting the VMODE bit in the REG_MODE register.
•
•
If VMODE is set to 1, the STC3115 is in power saving mode and it uses only the
voltage measurement to track the battery state. This mode is recommended for low
power applications or during a low power application state.
If VMODE is set to 0, the STC3115 is set to mixed mode using the internal
OptimGauge algorithm to provide the battery SOC status using voltage and current
measurements simultaneously. This mode is recommended to provide the best
accuracy whatever the application consumption.
The IODATA bit has to be written to 1 to enable the ALM pin report using
previously initialized parameters.
After GG_RUN = 1 configuration, the REG_COUNTER register is increased every 0.5 s
and the REG_SOC, REG_VOLTAGE, REG_CURRENT, and REG_TEMPERATURE
registers are updated at the same frequency.
The REG_COUNTER register is not increased if the BatD signal is above 1.61 V.
6.4
Periodic device access
To refresh the battery state that is reported to the application, the STC3115 needs to be
accessed. The period duration and frequency accuracy do not impact the accuracy of the
report.
6.4.1
First STC3115 access after initialization
Depending on whether the STC3115 was fully initialized or restored, the state of charge
(SOC) availability can be delayed:
1.
2.
After full initialization, the REG_SOC register is updated 100 ms after the end of the
REG_OCV write operation.
After restoration, the REG_SOC register is directly available, and even the temporary
variable content can be reported to the user.
Note that a simple way to manage the SOC delay is to use the STC3115 conversion
counter information available in the REG_COUNTER register. This conversion counter is
increased by 1 every 500 ms (after setting the GG_RUN bit to 1). To ensure availability of
the first SOC, the software can wait to read a counter higher than 2.
DocID024963 Rev 2.0
27/31
Software
6.5
AN4324
STC3115 task procedure
The task software block reports the battery state. From a simple system status check to a
full battery report, the STC3115 task software block is called periodically at any frequency
to be in line with the system power consumption.
6.5.1
How often the STC3115 has to be called in run mode
A delay between two STC3115 accesses does not change the report accuracy. For
example, when the state of charge (SOC) is moving faster, an access delay can be scaled
by the application consumption to update more frequently the SOC reported to the user.
This can be achieved by using the REG_CURENT value. The STC3115 access delay can
also be decreased accordingly to the SOC level. The lower the SOC is, the lower the
access delay is.
Alternatively, the STC3115 can be accessed with a fixed period. A fixed period has to be in
line with application consumption and battery capacity. For example, the period could be
equal to a minimum delay of 1 % discharge:
(Battery capacity (mAh) / application maximum current (mA)) x 0.01 = STC3115 access
period (h).
By default, a delay of 30 seconds to 1 minute between two STC3115 accesses is
considered adequate for most standard applications.
During the periodic access to the STC3115, several simple checks have to be performed to
verify system stability. Consequently, the task function needs to read the STC3115 to
report the information to the system.
The application checks verify if any battery swaps or removal events have occurred since
checking the BATFAIL and PORDET bits. The RAM memory integrity can also be checked
to ensure chipset stability and reliability between two driver accesses. From these bits and
the RAM status, the driver can either report the updated battery status or it can restart and
reset the data in the exchange structure.
At the end of the task procedure, the exchange data structure has to be updated to report
the last battery status to the system. At this time, the RAM memory registers have also to
be updated to save their status for the next driver access.
An additional feature of this procedure is to track the application state. Based on current
and voltage measured values, charging, end of charging, idle, discharging, and low battery
status can also be reported to the system.
6.6
STOP procedure
To stop the device correctly if the application switches off, the GG_Run bit has to be
cleared. The RAM can also be updated with the last updated battery state. This information
can be used during the START procedure if the battery has not been removed.
28/31
DocID024963 Rev 2.0
AN4324
6.7
Software
Power saving mode software management
The power saving mode of the STC3115 can be set dynamically during normal application
running. To maintain the best accuracy from the device, the driver should be called to use
power saving integrated functions (see Figure 19: "STC3115 power saving mode software
management"). Power saving management can be done in parallel with the normal
application workflow.
Figure 19: STC3115 power saving mode software management
The global behavior of the driver remains the same irrespective of the STC3115 power
mode: it reports the battery state information to the system after each scheduled task.
From the application software point of view, the STC3115 VMODE bit has to set to 1 to
enter power saving mode and has to be set to 0 to go back to normal mode. The VMODE
bit can be set to power saving mode or mixed mode according to the system mode as
shown in Figure 19: "STC3115 power saving mode software management".
Even if the STC3115 power saving mode is ON by default and used as the main mode for
reporting the battery state over the application life, the STC3115 mixed mode remains
more accurate. Mixed mode allows the user to get the best performance from the
STC3115. Mixed mode must not be set if no sense resistor is connected to the CG pin.
DocID024963 Rev 2.0
29/31
Revision history
7
AN4324
Revision history
Table 7: Document revision history
Date
Revision
30-Oct-2013
1
Changes
Initial release
Added order codes STC3115AIQT and STC3115IQT
Replaced "REG_OCV_OFFSET" register with "REG_OCVTAB"
register
Section 3.1: updated text and added Figure 2
Section 3.2: updated register names
Section 4.1: The five points concerning the sense resistor value and
reference "must" be considered (and not "should" be considered).
Section 4.1.3: replaced 10 mW with 160 mW
Section 4.2: updated internal threshold of BatD pull-up voltage
from1.6 V to 1.61 V; updated title of Figure 3
Section 4.3:replaced "voltage platform" with "system voltage"
12-Nov-2014
2
Figure 10: added "top view" to title
Section 5.2: added fifth point to the protocol on how to add an
external resistor
Figure 11 and Figure 12: added "top view" to titles
Table 5: added option "Ø = 260 µm min (for 220 µm diameter pad)"
Added Section 6.1
Section 6.2 deleted the two subsections related to this section and
added them into the main section, updated text, updated Figure 16
and Figure 17, added Figure 18.
Updated Section 6.3
Section 6.4: modified section title
Section 6.5.1: modified section title
Section 6.7: updated text explaining Figure 19
30/31
DocID024963 Rev 2.0
AN4324
IMPORTANT NOTICE – PLEASE READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications,
and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant
information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at
the time of order acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application
assistance or the design of Purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such
product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
© 2014 STMicroelectronics – All rights reserved
DocID024963 Rev 2.0
31/31
Similar pages