MAX1726x Software Implementation Guide Datasheet by Maxim Integrated

View All Related Products | Download PDF Datasheet
maxim Integrated ..
Maxim Integrated Page 1 of 15
MAX1726x Software Implementation Guide
UG6595; Rev 2; 6/18
Abstract
The MAX1726x Software Implementation Guide describes the startup sequence to configure and use
the MAX1726x fuel-gauge functions for EZ config and custom models.
Maxim Integrated Page 2 of 15
Table of Contents
Introduction ........................................................................................................................................................................ 4
Register LSBs for MAX1726x ......................................................................................................................................... 4
2-Wire/I2C Functions ..................................................................................................................................................... 5
WriteRegister ................................................................................................................................................................ 5
ReadRegister .................................................................................................................................................................. 5
WriteAndVerifyRegister ............................................................................................................................................. 5
Initialize Registers to Recommended Configuration ............................................................................................... 6
Step 0: Check for POR ................................................................................................................................................. 6
Step 1. Delay until FSTAT.DNR bit == 0 ................................................................................................................. 6
Step 2: Initialize Configuration .................................................................................................................................. 7
Updating Required Registers ............................................................................................................................... 9
Step 3: Initialization Complete .................................................................................................................................. 9
Step 3.1: Identify Battery ............................................................................................................................................. 9
Monitor the Battery ........................................................................................................................................................ 10
Step 3.2: Check for MAX1726x Reset ................................................................................................................... 10
Read the Fuel-Gauge Results ....................................................................................................................................... 10
Step 3.3: Read the RepCap and RepSOC Registers ........................................................................................... 10
Step 3.4: Read the Remaining TTE Register ........................................................................................................ 10
Step 3.5: Save Learned Parameters ........................................................................................................................ 11
Step 3.6: Restoring Learned Parameters ............................................................................................................... 11
Quick Start and Production Test Verification.......................................................................................................... 12
Step T1: Set the Quick-Start Bits ............................................................................................................................ 12
Step T2: Wait for Quick Start to Complete ......................................................................................................... 12
Step T3: Read and Verify Outputs ......................................................................................................................... 12
MAX1726x INI File Format ........................................................................................................................................... 13
Option 2: Short Format ............................................................................................................................................. 13
Option 3: Long Format .............................................................................................................................................. 13
Trademarks ....................................................................................................................................................................... 14
Revision History............................................................................................................................................................... 15
Maxim Integrated Page 3 of 15
List of Figures
Figure 1. MAX1726x fuel-gauge model loading sequence. .................................................................................... 6
List of Tables
Table 1. Register LSBs for MAX1726x .......................................................................................................................... 4
Table 1. Re ister LSBs for MAX1726X
Maxim Integrated Page 4 of 15
Introduction
This document describes the startup sequence to configure and use the MAX1726x fuel-gauge
functions. The MAX1726x should be initialized and loaded with a customized model and parameters at
power-up. Then the reported state of charge (SOC) and other useful information can be easily read by
the host system over the 2-wire bus system and displayed to the user. Figure 1 is a flowchart of the
power-up sequence that a host controller should implement with the MAX1726x.
Register LSBs for MAX1726x
Similar register types in the ModelGaugem5 devices share similar formats, i.e., all the SOC registers
share the same format, all the capacity registers share the same format, etc.
Table 1. Register LSBs for MAX1726x
REGISTER
LSBIT SIZE
NOTES
Capacity 5.0µVh/RSENSE
Or 0.5mAh with 10m
AX Ah
SOC 1/256% Or 1% at bit D8
Voltage 0.078125mV Or 1.25mV at bit D4
Current 1.5625µV/RSENSE Or 156.25µA with 10m, signed two's complement number
Temperature 1/256°C Or C at bit D8, signed two's complement number
Maxim Integrated Page 5 of 15
2-Wire/I2C Functions
The following I2C functions are needed in the load model process. They are described in pseudocode
below.
WriteRegister
int WriteRegister (u8 reg, u16 value)
{
int ret = i2c_smbus_write_word_data(client, reg, value);
if (ret < 0)
dev_err(&client->dev, "%s: err %d\n", __func__, ret);
return ret;
}
ReadRegister
int ReadRegister (u8 reg)
{
int ret = i2c_smbus_read_word_data(client, reg);
if (ret < 0)
dev_err(&client->dev, "%s: err %d\n", __func__, ret);
return ret;
}
WriteAndVerifyRegister
void WriteAndVerifyRegister (char RegisterAddress, int RegisterValueToWrite){
int Attempt=0;
do {
WriteRegister (RegisterAddress, RegisterValueToWrite);
Wait(1); //1ms
RegisterValueRead = ReadRegister (RegisterAddress) ;
}
while (RegisterValueToWrite != RegisterValueRead && attempt++<3);
}
MAX1726X should b “an to the correct they must be w e updated in collisions POWER-UP
Maxim Integrated Page 6 of 15
Initialize Registers to Recommended Configuration
The MAX1726x should be initialized prior to being used. The registers described in this guide should
be written to the correct values for the MAX1726x to perform at its best. These values are written to
RAM, so they must be written to the device any time power is applied or restored to the device. Some
registers are updated internally, so it is necessary to verify that the register was written correctly to
prevent data collisions.
POWER-UP
FUEL-GAUGE POLLING
MAIN LOOP
LOAD INITIAL CONFIGURATION
CHECK FOR FUEL-
GAUGE RESET
HAS NOT
BEEN RESET
RESET
Figure 1. MAX1726x fuel-gauge model loading sequence.
Step 0: Check for POR
The POR bit is bit 1 of the Status register.
StatusPOR = ReadRegister(0x00) & 0x0002;
if (StatusPOR=0){goto Step 3.2;} //then go to Step 3.2.
else { //then do Steps 1-2.}
Step 1. Delay until FSTAT.DNR bit == 0
After power-up, wait for the MAX1726x to complete its startup operations.
while(ReadRegister(0x3D)&1) Wait(10);
//10ms Wait Loop. Do not continue until FSTAT.DNR==0
Maxim Integrated Page 7 of 15
Step 2: Initialize Configuration
Any battery is supported by one of three types of configuration data. According to the configuration
data, only one of the following sections 2.1, 2.2, or 2.3 needs execution.
HibCFG=ReadRegister(0xBA) ; //Store original HibCFG value
WriteRegister (0x60 , 0x90) ; // Exit Hibernate Mode step 1
WriteRegister (0xBA , 0x0) ; // Exit Hibernate Mode step 2
WriteRegister (0x60 , 0x0) ; // Exit Hibernate Mode step 3
2.1 OPTION 1 EZ Config (No INI file is needed):
WriteRegister (0x18 , DesignCap) ; // Write DesignCap
WriteRegister (0x1E , IchgTerm) ; // Write IchgTerm
WriteRegister (0x3A , VEmpty) ; // Write VEmpty
if (ChargeVoltage>4.275)
WriteRegister (0xDB , 0x8400) ; // Write ModelCFG
else
WriteRegister (0xDB , 0x8000) ; // Write ModelCFG
//Poll ModelCFG.Refresh(highest bit),
//proceed to Step 3 when ModelCFG.Refresh=0.
while (ReadRegister(0xDB)&0x8000) Wait(10)
//do not continue until ModelCFG.Refresh==0
WriteRegister (0xBA , HibCFG) ; // Restore Original HibCFG value
Proceed to Step 3.
2.2 OPTION 2 Custom Short INI without OCV Table:
WriteRegister (0x18 , DesignCap) ; // Write DesignCap
WriteRegister (0x1E , IchgTerm) ; // Write IchgTerm
WriteRegister (0x3A , VEmpty) ; // Write VEmpty
WriteAndVerifyRegister (0x28 , LearnCFG) ;// (Optional in the INI)
WriteAndVerifyRegister (0x13 , FullSOCTh) ; // (Optional in the INI)
WriteRegister (0xDB , ModelCfg) ; // Write ModelCFG
//Poll ModelCFG.Refresh(highest bit)
//until it becomes 0 to confirm IC completes model loading
while (ReadRegister(0xDB)&0x8000) Wait(10)
//do not continue until ModelCFG.Refresh==0
WriteRegister (0x38 , RCOMP0) ; // Write RCOMP0
WriteRegister (0x39 , TempCo) ; // Write TempCo
WriteRegister (0x12 , QRTable00) ; // Write QRTable00
WriteRegister (0x22 , QRTable10) ; // Write QRTable10
WriteRegister (0x32 , QRTable20) ; //(Optional in the INI) Write QRTable20
WriteRegister (0x42 , QRTable30) ; //(Optional in the INI) Write QRTable30
WriteRegister (0xBA , HibCFG) ; // Restore Original HibCFG value
Proceed to Step 3.
Maxim Integrated Page 8 of 15
2.3 OPTION 3 Custom Full INI with OCV Table:
2.3.1 Unlock Model Access
WriteRegister (0x62, 0x0059) ; //Unlock Model Access step 1
WriteRegister (0x63, 0x00C4) ; //Unlock Model Access step 2
2.3.2 Write/Read/Verify the Custom Model
Once the model is unlocked, the host software must write the 32 word model to
the MAX1726X. The model is located between memory locations 0x80h and 0x9Fh.
//Actual bytes to transmit will be provided by Maxim after cell
characterization.
//See INI file at the end of this document for an example of the data to be
written.
Write16Registers (0x80, Table [0]) ;
Write16Registers (0x90, Table [1]) ;
The model can be read directly back from the MAX1726X. So simply read the 48
words of the model back from the device to verify if it was written
correctly. If any of the values do not match, return to step 2.3.1.
Read16Registers (0x80) ;
Read16Registers (0x90) ;
2.3.3 Lock Model Access
WriteRegister (0x62, 0x0000) ; //Lock Model Access
WriteRegister (0x63, 0x0000) ;
2.3.4. Verify that Model Access is locked
If the model remains unlocked, the MAX1726X will not be able to monitor the
capacity of the battery. Therefore it is very critical that the Model Access
is locked. To verify it is locked, simply read back the model. However, this
time, all values should be read as 0x00h. If any values are non-zero, repeat
Step 2.3.3 to make sure the Model Access is locked.
2.3.5. Write Custom Parameters
WriteRegister (0x05 , 0x0000); // Write RepCap
WriteRegister (0x18 , DesignCap) ; // Write DesignCap
WriteRegister (0x10, FullCapRep); // Write FullCapRep
WriteRegister (0x45, DesignCap/2); // Write dQAcc
WriteRegister (0x46, 0x0C80) ; // Write dPAcc
WriteRegister (0x1E , IchgTerm) ; // Write IchgTerm
WriteRegister (0x3A , VEmpty) ; // Write VEmpty
WriteRegister (0x38 , RCOMP0) ; // Write RCOMP0
WriteRegister (0x39 , TempCo) ; // Write TempCo
WriteRegister (0x12 , QRTable00) ; // Write QRTable00
WriteRegister (0x22 , QRTable10) ; // Write QRTable10
WriteRegister (0x32 , QRTable20) ; // Write QRTable20 (optional)
WriteRegister (0x42 , QRTable30) ; // Write QRTable30 (optional)
Maxim Integrated Page 9 of 15
Updating Required Registers
Updating optional registers. Some or all of the registers listed below could be optional and may not be
included in the INI.
WriteAndVerifyRegister (0x28 , LearnCFG); // Write LearnCFG
WriteRegister (0x2A, RelaxCFG) ; //Write RelaxCFG
WriteRegister (0x1D, Config) ; //Write Config
WriteRegister (0xBB, Config2) ; //Write Config2
WriteRegister (0x13, FullSOCthr) ; //Write FullSOCthr
WriteRegister (0x2C, TGAIN) ; //Write TGAIN for the selected Thermistor
WriteRegister (0x2D, TOFF) ; //Write TOFF for the selected Thermistor
WriteRegister (0xB9, Curve) ; //Write Curve for the selected Thermistor
2.3.6 Initiate Model Loading
Config2value=ReadRegister(0xBB) ;
//read the Config2 register (0xBB)
WriteRegister(0xBB,((Config2value) | (0x0020))) ; // Setting the LdMdl bit
in the Config2 register
2.3.7
Poll the LdMdl bit in the Config2 register, proceed to step 2.3.8 when LdMdl
bit becomes 0.
//Poll Config2.LdMdl(0x0020)
//until it becomes 0 to confirm IC completes model loading
while (ReadRegister(0xBB)&0x0020) Wait(10)
//do not continue until Config2.LdMdl==0
2.3.8 Update QRTable20 and QRTable30
WriteAndVerifyRegister (0x32 , QRTable20) ; // Write QRTable20
WriteAndVerifyRegister (0x42 , QRTable30) ; // Write QRTable30
2.3.9 Restore HibCFG
WriteRegister (0xBA ,HibCFG) ; // Restore Original HibCFG value
Proceed to Step 3.
Step 3: Initialization Complete
Clear the POR bit to indicate that the custom model and parameters were successfully loaded.
Status = ReadRegister(0x00) ; //Read Status
WriteAndVerifyRegister (0x00, Status AND 0xFFFD) ; //Write and Verify
Status with POR bit Cleared
Step 3.1: Identify Battery
If the host recognizes the battery pack as one with a saved history, go to Step 3.6 to restore all the
saved parameters; otherwise, continue to Step 3.2.
Maxim Integrated Page 10 of 15
Monitor the Battery
Once the MAX1726x is initialized and customized, the host can simply read the desired information
from the MAX1726x and display that information to the user.
Step 3.2: Check for MAX1726x Reset
Periodically the host should check if the fuel gauge has been reset and initialize if needed.
StatusPOR = ReadRegister(0x00) & 0x0002; //Read POR bit in Status Register
If StatusPOR=0, then go to Step 3.3.
If StatusPOR=1, then go to Step 0.
Read the Fuel-Gauge Results
Step 3.3: Read the RepCap and RepSOC Registers
The MAX1726x automatically calculates and reports the cell’s state of charge in terms of a percentage
and the mAhrs remaining. The RepSOC (as a percent) is read from memory location 0x06 and the
RepCap (in mAHrs) is read from memory location 0x05.
RepCap = ReadRegister(0x05) ; //Read RepCap
RepSOC = ReadRegister(0x06) ; //Read RepSOC
The RepSOC_HiByte has a unit of 1%, so the RepSOC_HiByte can be directly displayed to the user for
1% resolution.
Step 3.4: Read the Remaining TTE Register
The MAX1726x also calculates the Time-to-Empty register (TTE). TTE is in memory location 0x11h.
The LSB of the TTE register is 5.625 seconds.
TTE = ReadRegister(0x11) ; //Read TTE
Maxim Integrated Page 11 of 15
Step 3.5: Save Learned Parameters
It is recommended to save the learned capacity parameters every time bit 2 of the Cycles register
toggles (so that it is saved every 64% change in the battery) so that if power is lost the values can
easily be restored.
Saved_RCOMP0 = ReadRegister(0x38) ; //Read RCOMP0
Saved_TempCo = ReadRegister(0x39) ; //Read TempCo
Saved_FullCapRep = ReadRegister(0x10) ; //Read FullCapRep
Saved_Cycles = ReadRegister(0x17) ; //Read Cycles
Saved_FullCapNom = ReadRegister(0x23) ; //Read FullCapNom
Step 3.6: Restoring Learned Parameters
If power is lost, then the learned information can be easily restored with the following procedure.
WriteAndVerifyRegister(0x38, Saved_RCOMP0) ; //WriteAndVerify RCOMP0
WriteAndVerifyRegister(0x39, Saved_TempCo) ; //WriteAndVerify TempCo
WriteAndVerifyRegister(0x10, Saved_FullCapRep) ; //WriteAndVerify FullCapRep
//Write dQacc to 200% of Capacity and dPacc to 200%
dQacc = (Saved_FullCapNom/ 2) ;
WriteAndVerifyRegister (0x46, 0x0C80) ; //Write and Verify dPacc
WriteAndVerifyRegister (0x45, dQacc) ; //Write and Verify dQacc
WriteAndVerifyRegister(0x17, Saved_Cycles) ; //WriteAndVerify Cycles
Maxim Integrated Page 12 of 15
Quick Start and Production Test Verification
If the IC is being production tested, use the following steps update the fuel-gauge outputs to a known
state to verify the IC’s proper operation. The sequence for configuring the MAX1726x, as outlined in
the Initialize Registers to Recommended Configuration section, should be followed prior to sending the
quick-start command in order to verify that the device was set up correctly. Set the power supply to
the desired voltage and issue the quick-start command as described below.
Step T1: Set the Quick-Start Bits
Data= ReadRegister(0x2B ; //Read MiscCFG
Data |= 0x0400 ; //Set bits 10 and 12
WriteRegister (0x2B, Data) ; //Write MiscCFG
Step T2: Wait for Quick Start to Complete
//Poll MiscCFG.QS(0x0400) and FSTAT.DNR until they becomes 0 to
confirm Quickstart is finished
While (ReadRegister(0xDB)&0x8000 and ReadRegister(0x3D)&1) Wait(10)
//do not continue quickstart is complete
Step T3: Read and Verify Outputs
The RepCap and RepSOC register locations should now contain accurate fuel-gauge results based on a
battery voltage of 3.900V. The RepSOC (as a percent) is read from memory location 0x06h and the
RepCap (in mAHrs) is read from memory location 0x05h.
RepCap = ReadRegister(0x05) ; //Read RepCap
RepSOC = ReadRegister(0x06) ; //Read RepSOC
Fail the unit if RepCap and RepSOC do not report expected results to within ±1% not including power-
supply tolerance. Note that any error in the voltage forced on VBATT for testing creates a much larger
error in the output results from the fuel gauge.
Option 2: Short Format Option 3: Long Format
Maxim Integrated Page 13 of 15
MAX1726x INI File Format
When high accuracy is needed and when Maxim generates a custom INI file, the INI is in one of the
below formats. The examples below can be used to structure your software to read the custom INI for
your battery. Option 1 (not shown) is the EZ mode, which does not have a custom INI.
Option 2: Short Format
Device=MAX1726X
Title=C:/xxxx/1234_1_111111.csv
ModelVersion=8745 //This keeps track of the version of the INI generator
DesignCap=0x1450
ichgterm=0x333
modelcfg=0x8000
QRTable00=0x1050
QRTable10=0x2012
VEmpty=0xa561
RCOMP0=0x004d
TempCo=0x223e
Option 3: Long Format
Device=MAX1726X
Title= C:/xxxx/1234_1_111111.csv
ModelVersion=8745
DesignCap=0x06ae
fullsocthr=0x5f05
ichgterm=0x100
modelcfg=0x8410
QRTable00=0x1050
QRTable10=0x0014
QRTable20=0x1300
QRTable30=0x0c00
VEmpty=0x965a
RCOMP0=0x0070
TempCo=0x223e
;;; Begin binary data
;;; This is formatted as 16-bit words, each on a new line.
;;; Numbers are formatted in hex, for example: 0x0000
; Ignore the first 16 words. These are used by EVKit software only
; 16 words. Data starts here for Address 0x80 for use in Step 2.3.2
; 16 words. Data starts here for Address 0x90 for use in Step 2.3.2
; Ignore the remaining 48 words.
Maxim Integrated Page 14 of 15
Trademarks
ModelGauge is a trademark of Maxim Integrated Products, Inc.
Revision History
Maxim Integrated Page 15 of 15
Revision History
REVISION
DATE
DESCRIPTION
PAGES
CHANGED
0 3/18 Initial release
1 4/18 Added WriteRegister (0x10, FullCapRep) and WriteRegister (0x45,
DesignCap/2) lines of code to 2.3.5 Write Custom Parameters 8
2 6/18 Updated 2.3.5 Write Custom Parameters 8
©2018 by Maxim Integrated Products, Inc. All rights reserved. Information in this publication concerning the devices, applications, or
technology described is intended to suggest possible uses and may be superseded. MAXIM INTEGRATED PRODUCTS, INC. DOES
NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE INFORMATION, DEVICES, OR
TECHNOLOGY DESCRIBED IN THIS DOCUMENT. MAXIM ALSO DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY
INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED HEREIN OR
OTHERWISE. The information contained within this document has been verified according to the general principles of electrical and
mechanical engineering or registered trademarks of Maxim Integrated Products, Inc. All other product or service names are the
property of their respective owners.

Products related to this Datasheet

IC BATT LIFEPO4/LI-ION 1C 9WLP
IC BATT MON LI-ION 1CELL 9WLP
SGL/MULTI-CELL FUEL GAUGE W/MODE
IC FUEL GAUGE SINGL/MULTI 14TDFN
IC BATT MON LI-ION 1CELL 9WLP
IC BATT LIFEPO4/LI-ION 1C 9WLP
SGL/MULTI-CELL FUEL GAUGE W/MODE
IC BATT MON LI-ION 1CELL 9WLP
EVKIT MODEL GAUGE M5 MAX17260
EVKIT MODEL GAUGE M5 MAX17261
EVAL MAX17263 FUEL GAUGE
KIT FOR MAX17262
IC BATT LIFEPO4/LI-ION 1C 14TDFN
IC BATT LIFEPO4/LI-ION 1C 9WLP
IC BATT MON LI-ION 1CELL 9WLP
EVKIT FOR TDFN STAND-ALONE MODEL
IC BATT MON LI-ION 1CELL 14TDFN
IC BATT MON LI-ION 1CELL 14TDFN
IC BATT LIFEPO4/LI-ION 1C 14TDFN
IC BATT LIFEPO4/LI-ION 1C 9WLP
MAX17261 EVKIT FOR WLP MODELGAUG
SGL/MULTI-CELL FUEL GAUGE W/MODE
IC BATT LIFEPO4/LI-ION 1C 14TDFN
IC BATT LIFEPO4/LI-ION 1C 9WLP
IC BATT MON LI-ION 1CELL 9WLP
IC BATT LIFEPO4/LI-ION 1C 14TDFN