Application Report
SLUA502–March2010 Data Flash Programming and Calibrating the bq3060Gas
Gauge
PMP-Battery Monitoring Solutions
ABSTRACT
This application report presents a strategy for high-speed,economical calibration and data flash programming of the bq3060advanced gas gauge.VB6code examples are provided.
Contents
1Introduction (2)
2Writing the Data Flash Image to Each Target Device (3)
2.1Preparing the Data Flash Image Pack (3)
2.2Reading and Saving the Data Flash Image (3)
2.3Writing the Data Flash Image to Each Target Device (4)
3Calibrating the bq3060 (5)
3.1Characterization of Board Offset (5)
3.2Calibration of CC Offset,Temperature,Current,and Pack Voltage (6)
3.3Calibration of Voltage (7)
4Writing Pack-Specific Data Flash Locations (10)
List of Figures
1Software Board Offset Calibration Interface for Characterizing Board Offset (5)
2bq3060Voltage Translation Circuit Diagram (8)
3Typical Voltage Error Band After Software Voltage Calibration;Data Measured at3800mV Each Cell and Across Temperature (8)
4Voltage Error for Post-Calibrated bq803x-Based Devices (9)
List of Tables
1Voltage Accuracy of the Factory-Calibrated Devices (8)
Impedance Track is a trademark of Texas Instruments.
Introduction www.ti 1Introduction
The bq3060is the latest CEDV(Compensated End of Discharge Voltage)advanced gas gauge,built with new silicon hardware technology and an Impedance Track™-like architecture for both data flash access and calibration.The bq3060targets to reduce unit production cost and capital equipment investment.The calibration method is quick and simple because most of the calibration routines,such as calibration of
current,offset,and temperature,are built into the firmware of the target device.The voltage calibration is done in the factory,which provides a level of accuracy that meets the needs of most applications(See Table1).However,if a higher level of voltage accuracy is desired,this document also provides a method of post-factory voltage calibration.
The methods in this document are presented as VB6(Visual Basic6)functions.These functions were
copied directly from working code.In order to read from and write to the data flash,they use five types of SMBus read and write functions.These can be duplicated in any software environment that has SMBus communication capabilities.As used herein,each read/write function is designed for communication with a gas gauge,so the device address(0x16)is omitted for clarity.
1.WriteSMBusInteger()has two arguments–the SMBus command and a signed integer.Internally,this
function separates the integer into two bytes for transmission by the SMBus write-word protocol.
2.WriteSMBusByteArray()has three arguments–the SMBus command,the array of bytes,and an
integer specifying the length of the byte array.Internally,this function separates the byte array into
separate bytes for transmission by the SMBus write-block protocol.
3.WriteSMBusCommand()has only one argument–the SMBus command.
4.ReadSMBusUnsignedInteger has two arguments–the SMBus command and the returned integer.
5.ReadSMBusByteArray()has three arguments–the SMBus command,the returned array of bytes,and
the returned length of the byte array.It is internally implemented with the SMBus read-block protocol.
Also used in these functions is a simple delay routine called DoDelay.VB6code for this procedure is
provided at the end of the document.
Error handling is not implemented in this sample code,because requirements are unique and varied.Also, constants are hard-coded into the functions to improve clarity rather than documenting them in code
elsewhere as would normally be good coding practice.
A good strategy for bq3060production is an eight-step process flow:
3060 ti1.Write the data flash image to each device.This image was created using bqEASY.
2.Calibrate the device.
3.Update any individual flash locations,such as serial number,lot code,and date.
4.Perform any desired protection tests.
5.Connect the cells.
6.Perform additional desired protection tests.
7.Send0x0021to Manufacturer Access0x00command,to enable Lifetime and Permanent Fail
functions.
8.Seal the pack.
In this document,the first three steps are examined in detail.
2Data Flash Programming and Calibrating the bq3060Gas Gauge SLUA502–March2010
2.1Preparing the Data Flash Image Pack
The bq3060ICs are shipped preprogrammed with default parameter values.To create the data flash
image that is used for every production pack,assemble a battery pack with the default firmware,and set the data flash constants for the application.This includes number of serial cells,design capacity,CEDV gauging parameters,to name a few.Alternatively,use bqEASY software to set the desired data flash
constants.In addition,Board Offset needs to be characterized and to be used when creating bq3060data flash image with bqEASY.Refer to Section3.1for more details of Board Offset.
2.2Reading and Saving the Data Flash Image
Note that this step only needs to be done once for a given project.
Function SaveDataFlashImageToFile(sFileName As String)As Long
Dim iNumberOfRows As Integer
Dim lError As Long
Dim yRowData(32)As Byte
Dim yDataFlashImage(&H400)As Byte
Dim iRow As Integer Dim iIndex As Integer
Dim iLen As Integer
Dim iFileNumber As Integer
'//FOR CLARITY,WITHOUT USING CONSTANTS
'//0x400is the data flash size.
'0x400\32=32rows
iNumberOfRows=&H400\32
'//PUT DEVICE INTO ROM MODE
lError=WriteSMBusInteger(&H0,&HF00)
DoDelay0.01
'//READ THE DATA FLASH,ROW BY ROW
For iRow=0To iNumberOfRows-1
'//Set the address for the row.&H9(0x09)is the ROM mode command.
'//0x200is the row number where data flash starts.
'//Multiplication by32gives the actual physical address where each row starts
lError=WriteSMBusInteger(&H9,(&H200+iRow)*32)
'//Read the row.&HC(0x0c)is the ROM mode command.
lError=ReadSMBusByteArray(&HC,yRowData,iLen)
'//Copy this row into its place in a big byte array
For iIndex=0To32-1
yDataFlashImage((iRow*32)+iIndex)=yRowData(iIndex)
Next iIndex
Next iRow
'//WRITE DATA FLASH IMAGE TO FILE
iFileNumber=FreeFile
Open sFileName For Binary Access Write As#iFileNumber
Put#iFileNumber,,yDataFlashImage
Close#iFileNumber
'//EXECUTE GAS GAUGE PROGRAM
lError=WriteSMBusCommand(&H8)
End Function
The following method is fast.It only takes about2seconds to write the entire data flash in this manner.
CAUTION
If power is interrupted during the process,the device may become unusable.
Function WriteDataFlashImageFromFile(sFileName As String)As Long Dim lError As Long Dim iFileNumber As Integer
Dim iNumberOfRows As Integer
Dim iRow As Integer
Dim iIndex As Integer
Dim yRowData(32)As Byte
Dim yDataFlashImage(&H400)As Byte
'//READ THE FLASH IMAGE FROM THE FILE INTO A GLOBAL BYTE ARRAY
iFileNumber=FreeFile
Open sFileName For Binary Access Read As#iFileNumber
Get#iFileNumber,,yDataFlashImage
Close#iFileNumber
'//FOR CLARITY,WITHOUT USING CONSTANTS
iNumberOfRows=&H400\32'32Rows
'//PUT DEVICE INTO ROM MODE
lError=WriteSMBusInteger(&H0,&HF00)
DoDelay0.01
'//ERASE DATA FLASH,ROWS ARE ERASED IN PAIRS
For iRow=0To iNumberOfRows-1Step2
lError=WriteSMBusInteger(&H11,iRow)
DoDelay0.04
Next iRow
'//WRITE EACH ROW
For iRow=0To iNumberOfRows-1
'//Set the row to program into the first element of the33byte array
yRowData(0)=iRow
'//Copy data from the full array to the row array
For iIndex=0To31
yRowData(iIndex+1)=yDataFlashImage((iRow*32)+iIndex)
Next iIndex
'//Write the row.Length is33because first byte is row number
1Error=WriteSMBusByteArray(&H10,yRowData,32+1)
DoDelay0.02
Next iRow
'//EXECUTE GAS GAUGE PROGRAM
lError=WriteSMBusCommand(&H8)
End Function
4Data Flash Programming and Calibrating the bq3060Gas Gauge SLUA502–March2010
www.ti Calibrating the bq3060 3Calibrating the bq3060
In this application report,calibration refers to an action before battery cells are attached.Power supplies should be used to simulate series cells and to supply power to the bq3060.For current calibration,apply the current source directly across the sense resistor.
Before calibration,Board Offset needs to be characterized and to be used when creating bq3060data
flash image with bqEASY.Calibration of bq3060in a step-by-step manner should in general obey the
following sequence:
CC Offset
Voltage(if desired)
Temperature
Current
Pack Voltage(if desired)
In production,however,CC Offset,Temperature,Current,and Pack Voltage calibration can be combined in a single step as detailed in Section3.2;and software Voltage calibration(described in Section3.3),if desired,should be done subsequently.
3.1Characterization of Board Offset
Board offset is a system-level offset,often caused by component mismatch and noise coupling.Like any other offset,board offset varies from system to system and has dependency on temperature.For the
bq3060,there is no need for individual board offset calibration.Instead,board offset needs to be
characterized in the product development phase.The number of boards and measurement samples
should be of sufficient quantity to adequately represent the distribution of board offset.Data analysis
yields the programming value of board offset.
The bq3060evaluation software,bqEVSW,provides board offset measurement on the Calibration screen with the Software Board Offset Calibration button.Before board offset calibration,be sure that the device is powered from the cell inputs and no charger is connected.This ensures that absolutely no current flows through the sense resistor during offset measurement.The default setting of sampling time,located right above the software board offset calibration button,is2seconds.Use the default setting to characterize the board offset.
Figure1.Software Board Offset Calibration Interface for Characterizing Board Offset It is also recommended to take at least10boards for board-offset characterization and make at least5 measurement samples on each board.Of course,more samples always yield better data quality.The
average of all the numbers is calculated and programmed into the Board Offset data flash location.This should be done before using bqEASY to create the production data flash image.
Calibrating the bq3060www.ti 3.2Calibration of CC Offset,Temperature,Current,and Pack Voltage
It only takes about5seconds to accurately calibrate CC offset,temperature,and current.In the bq3060, most calibration routines have been incorporated into firmware algorithms,which can be initiated with
SMBus commands.The hardware for calibration is also simple.One current source,one voltage source(if using resistor divider to simulate the cells),and one temperature sensor are all that is required.The
accuracy of the sources is not important,only their stability.However,accurately calibrated reference measurement equipment should be used for determining the actual arguments to the function.
The elapsed time for calibration can be changed by modifying values in the data flash,but this is not
recommended.Use the default values for the times in DF.Calibration.Config
In the CalibrateAll()function,command0x51is used to setup a current offset,current,and temperature calibration of the device.Pack voltage calibration is generally not performed because it is only used to
detect the presence of a charger,and its accuracy is not required for standard applications.In this case, Pack Voltage refers to a separate measurement of the voltage at the pack terminal through the PACK pin, and is unrelated to the SBS.Voltage()readout.Note that a successful Pack Voltage calibration requires that the pack+terminal be connected to a stable reference voltage
The definition of the bits in command0x51are:
Bit0Coulomb Counter Offset Bit8Pack Gain
Bit1Reserved Bit9Pack Voltage
Bit2ADC Offset Bit10AFE Error
Bit3Temperature,Internal Bit11Reserved
Bit4Temperature,External1Bit12Reserved
Bit5Temperature,External2Bit13Reserved
Bit6Current Bit14Run ADC Task Continuously
Bit7Reserved Bit15Run CC Task Continuously Bits14and15should always be set.These cause the Coulomb Counter and ADC tasks to run
continuously,just as they do in normal operation.This has been found to increase the accuracy of the
calibration.
After command0x51is issued,the calibration sequence is started in the firmware of the gas gauge.The calibrations are run in sequence starting from the least significant bit.Then,command0x52is used to poll these bits,which change from high to low as the tasks are completed.However,bits14and15do not
change;hence,the masking of them in the polling loop.
6Data Flash Programming and Calibrating the bq3060Gas Gauge SLUA502–March2010

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。