This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ27441-G1: How to configure for a new battery

Part Number: BQ27441-G1
Other Parts Discussed in Thread: BQ28Z610, BQ24295, BQ27510, BQSTUDIO,

I am trying to configure the BQ27441-G1A for a new larger battery (2900 mAh). I have previously had this working with a smaller battery using the default settings.

Based on the quick start guide, it appears that I only need to change 4 register values for this to work.

I followed the pseudo code example in the TRM, section 3.1 (pg 14) "Data Memory Parameter Update Example", to create a bash script (attached) to update these registers.
I have set the 4 parameters using this bash script:
Design Capacity = 2900 mAh
Design Energy = (Design Capacity) * 3.7 = 10,700 mWh
Terminate Voltage = 3200 mV
Taper Rate = (Design Capacity) / (.1 * (Taper Current)) = 98 (.1 Hr rate)

I tested the larger battery with the default values in the BQ27441-G1A, and with the updated values. I am now having problems with the battery gauge accurately reporting the battery percentage. In our tests the battery is jumping from 92% to 100% charged, and then during discharge the battery is dying while still reporting between 17 - 30 percent remaining.

Is there another step to programming the fuel gauge that I missed?

#!/system/bin/sh

#######
#README
#######
#
# Script to modifiy the registers of the TI BQ27441-G1A battery gauge for a new battery configuration
#
# This script is intended to overwrite the default values of 4 important configuration parameters.
# These parameters are:
# Design Capacity - Nominal battery capacity printed on the battery label, or found in the battery data sheet. (in mAh)
# Design Energy - Is equal to Design Capacity x 3.7 for bq27441-G1A
# Terminate Voltage - The minimum operating voltage of your system. This is the target where the gauge typically reports 0% capacity. (mV)
# Taper Rate - Should be set to the current threshold in mA below which your charger IC is set to stop charging once it considers the battery to be full. (Taper Rate = Design Capacity / (0.1 * Taper Current))
#
# Based largely on a pseudo code example in Section 3.1, pg 14 of the TRM Rev. A (http://www.ti.com/lit/ug/sluuac9a/sluuac9a.pdf)
#

#
# See Criticallink Internal Redmine issue #12557
#
# Jarrett Pischera 6/7/2017
# Jpischera@criticallink.com
#

###################################################################
# User Modifiable Device Configuration Parameters (Decimal Numbers) 
###################################################################

# Design Capacity in mAh
USER_Design_Capacity=2900
#Terminate_Voltage in mV
USER_Terminate_Voltage=3200
# Taper Current in mA
USER_Taper_Current=256

#######################################
# Device configuration parameters (hex)
#######################################

# Design capacity convert to hex and calculate MSB and LSB
Design_Capacity=$(printf 0x%X\\n $USER_Design_Capacity)
Design_Capacity_LSB=$(printf 0x%X\\n $(($Design_Capacity % 0x100)))
Design_Capacity_MSB=$(printf 0x%X\\n $(( ($Design_Capacity - $Design_Capacity_LSB) / 256)))

# Design Energy is directly dipendent on the Design Capacity. The factor of 3.7 is from the TRM for the -G1A chips
temp_DE1=$(($Design_Capacity * 3))
temp_DE2=$((($Design_Capacity * 7) / 10 ))
temp_DE3=$(($temp_DE1 + $temp_DE2))
Design_Energy=$(printf 0x%X\\n $temp_DE3)
Design_Energy_LSB=$(printf 0x%X\\n $(($Design_Energy % 0x100)))
Design_Energy_MSB=$(printf 0x%X\\n $(( ($Design_Energy - $Design_Energy_LSB) / 256)))

# The terminate voltage in mV (hex)
Terminate_Voltage=$(printf 0x%X\\n $USER_Terminate_Voltage)
Terminate_Voltage_LSB=$(printf 0x%X\\n $(($Terminate_Voltage % 0x100)))
Terminate_Voltage_MSB=$(printf 0x%X\\n $(( ($Terminate_Voltage - $Terminate_Voltage_LSB) / 256)))

# The taper rate, assuming that the charger taper current is 256 mA. Following the formula above.
Taper_Current=$USER_Taper_Current
Taper_Current_15=$(( ($Taper_Current + ( ($Taper_Current * 15 ) / 100 ) )))
Taper_Rate=$(printf 0x%X\\n $((($Design_Capacity * 10 ) / $Taper_Current_15)))
Taper_Rate_LSB=$(printf 0x%X\\n $(($Taper_Rate % 0x100)))
Taper_Rate_MSB=$(printf 0x%X\\n $(( ($Taper_Rate - $Taper_Rate_LSB) / 256)))

#################
# I2C Information
#################
i2c_bus=0x0
i2c_chip_addr=0x55

#################################
# Register Modification Procedure
#################################

# UNSEAL the device by writing Control() (0x00 and 0x01) with the UNSEAL key 0x8000. ie Control(0x8000)
i2cset -y -f $i2c_bus $i2c_chip_addr 0x00 0x00
i2cset -y -f $i2c_bus $i2c_chip_addr 0x01 0x80
i2cset -y -f $i2c_bus $i2c_chip_addr 0x00 0x00
i2cset -y -f $i2c_bus $i2c_chip_addr 0x01 0x80

# Enter CONFIG UPDATE Mode SET_CFGUPDATE. ie Control(0x0013)
i2cset -y -f $i2c_bus $i2c_chip_addr 0x00 0x13
i2cset -y -f $i2c_bus $i2c_chip_addr 0x01 0x00

# Confirm that CFGUPDATE mode has been set
sleep 1.5
echo "Confirm bit 4 is high for CFGUPDATE:"
i2cget -y -f $i2c_bus $i2c_chip_addr 0x06

# Ensure block data memory control by writing 0x00 using the BlockDataControl() command
i2cset -y -f $i2c_bus $i2c_chip_addr 0x61 0x00

# Access the State subclass (0x52), which contains the configuration parameters, using the DataBlockClass() command
i2cset -y -f $i2c_bus $i2c_chip_addr 0x3E 0x52

# Write the block offset location using DataBlock() command. For data 0 to 31 use 0x00, for data 32-41 use 0x01
i2cset -y -f $i2c_bus $i2c_chip_addr 0x3F 0x00

# Read the 1-byte checksum using the BlockDataChecksum() command
old_chksum=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x60) 

# Read the Design Capacity bytes staring at 0x4A (offset = 10; from TRM) 
old_Design_Capacity_MSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x4A)
old_Design_Capacity_LSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x4B)

# Read the Design Energy bytes starting at 0x4C (offset = 12; from TRM)
old_Design_Energy_MSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x4C)
old_Design_Energy_LSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x4D)

# Read the old Terminate Voltage starting at 0x50 (offset = 16; from TRM)
old_Terminate_Voltage_MSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x50)
old_Terminate_Voltage_LSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x51)

# Read the old Taper Rate starting at 0x5B (offset = 27; from TRM)
old_Taper_Rate_MSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x5B)
old_Taper_Rate_LSB=$(i2cget -y -f $i2c_bus $i2c_chip_addr 0x5C)

# Write the new Design Capacity
i2cset -y -f $i2c_bus $i2c_chip_addr 0x4A $Design_Capacity_MSB
i2cset -y -f $i2c_bus $i2c_chip_addr 0x4B $Design_Capacity_LSB

# Write the new Design Energy
i2cset -y -f $i2c_bus $i2c_chip_addr 0x4C $Design_Energy_MSB
i2cset -y -f $i2c_bus $i2c_chip_addr 0x4D $Design_Energy_LSB

# Write the new Terminate Voltage
i2cset -y -f $i2c_bus $i2c_chip_addr 0x50 $Terminate_Voltage_MSB
i2cset -y -f $i2c_bus $i2c_chip_addr 0x51 $Terminate_Voltage_LSB

# Write the new Taper Rate
i2cset -y -f $i2c_bus $i2c_chip_addr 0x5B $Taper_Rate_MSB
i2cset -y -f $i2c_bus $i2c_chip_addr 0x5C $Taper_Rate_LSB

# DEBUG Read the changes to make sure they worked
echo "the old MSB and LSB of the Design Capacity, read from the register are:"
echo $old_Design_Capacity_MSB
echo $old_Design_Capacity_LSB
echo "MSB and LSB of the Design Capacity, read from the register, should be 0x0B and 0xB8"
i2cget -y -f $i2c_bus $i2c_chip_addr 0x4A
i2cget -y -f $i2c_bus $i2c_chip_addr 0x4B

echo " "

echo "The old MSB and LSB of the Design Energy, read from the register are:"
echo $old_Design_Energy_MSB
echo $old_Design_Energy_LSB
echo "MSB and LSB of the Design Energy, read from the register: "
i2cget -y -f $i2c_bus $i2c_chip_addr 0x4C
i2cget -y -f $i2c_bus $i2c_chip_addr 0x4D

echo " "

echo "The old MSB and LSB of the Terminate Voltage, read from the register are:"
echo $old_Terminate_Voltage_MSB
echo $old_Terminate_Voltage_LSB
echo "MSB and LSB of the Terminate Voltage, read from the register:"
i2cget -y -f $i2c_bus $i2c_chip_addr 0x50
i2cget -y -f $i2c_bus $i2c_chip_addr 0x51

echo " "

echo "The old MSB and LSB of the Taper Rate, read from the register are: "
echo $old_Taper_Rate_MSB
echo $old_Taper_Rate_LSB
echo "MSB and LSB of the Taper Rate, read from the register:"
i2cget -y -f $i2c_bus $i2c_chip_addr 0x5B
i2cget -y -f $i2c_bus $i2c_chip_addr 0x5C

echo " "

# Calculate the new Checksum
#	 The maxvar variable deals with the issue of taking the modulus of a negative number in bash
#	 (number of bytes changed * 0x100) + 0xff
maxvar=$(((0x10 * 0x100) + 0xff))
temp_var1=$((($maxvar - $old_chksum - $old_Design_Capacity_MSB - $old_Design_Capacity_LSB - $old_Design_Energy_MSB - $old_Design_Energy_LSB - $old_Terminate_Voltage_MSB - $old_Terminate_Voltage_LSB - $old_Taper_Rate_MSB - $old_Taper_Rate_LSB) % 0x100))
temp_var2=$((($temp_var1 + $Design_Capacity_MSB + $Design_Capacity_LSB + $Design_Energy_MSB + $Design_Energy_LSB + $Terminate_Voltage_MSB + $Terminate_Voltage_LSB + $Taper_Rate_MSB + $Taper_Rate_LSB) % 0x100))
dec_chksum=$((0xff - $temp_var2))
new_chksum=$(printf 0x%X\\n $dec_chksum)

# Write the new Checksum to BlockDataChecksum()
i2cset -y -f $i2c_bus $i2c_chip_addr 0x60 $new_chksum

# DEBUG Read the changes to the checksum ot make sure they worked
echo "The old checksum was:"
echo $old_chksum
echo "The new calculated checksum is:"
echo $new_chksum
echo "Read the saved checksum from the register"
i2cget -y -f $i2c_bus $i2c_chip_addr 0x60

# Exit CFGUPDATE
i2cset -y -f $i2c_bus $i2c_chip_addr 0x00 0x42
i2cset -y -f $i2c_bus $i2c_chip_addr 0x01 0x00

# Confirm that CFGUPDATE had been exited by polling Flags() register until bit 4 cleared
sleep 1.5
echo "Confirm bit 4 is low, CFGUPDATE has been exited:"
i2cget -y -f $i2c_bus $i2c_chip_addr 0x06

# Reseal the device
i2cset -y -f $i2c_bus $i2c_chip_addr 0x00 0x20
i2cset -y -f $i2c_bus $i2c_chip_addr 0x01 0x00

  • Have you updated the Chem_ID (You're using a new battery) followed by a successful learning cycle ?

    Chem_ID: http://www.ti.com/tool/GPCCHEM

    Learning Cycle: www.ti.com/.../slua597.pdf

    Check out those links. Having the correct chem_id match (or close enough), and successful learning cycle is essential to having a proper working
    IT fuel gauge.

    Hope this helps,
  • The Learning Cycle paper that you linked to references the command IT_ENABLE, which is not mentioned in the TRM for this chip. This paper also references a QEN Flag bit, which is not present.

    How do I begin the learning cycle?
  • Hi Jarrett

    Pls use this app note instead. the 441 has IT enabled by default. it is never turned off.

    4857.1586.LearningCycleOverview_bq274xx.pdf

    thanks

    Onyx

  • Hi Onyx,
    With reference to above attached app note .
    Can i generalize following values for other gauge also ?
    • ChargeCurrentthreshold:C/13.3
    • DischargeCurrentthreshold:C/16.7
    • QuitCurrentthreshold(relaxationmode):C/25.0

    I am using Bq28z610,If these value should be chemistry or application dependent ?
  • Can you clarify if you are using the bq27441 or the bq28z610? If using the bq28z610, reference the app note below:
    www.ti.com/.../getliterature.tsp
    Those values for quit for chg, dsg and quit seem ok. Make sure the taper current is greater than the charge current threshold.

    thanks
    Onyx
  • Hi Onyx ,

    Thanks for update , I am using BQ27441 as well as BQ28z610 both in two differnt application.As of now we are not perfroming learning cycle on Bq27441 as we don't have sufficient memory on host side for writing driver to upload Golden image file on every gauge reset .

    At present I have to create golden image file of for Bq28z610, i will follow reffered documents , and update you.
  • Hello, I performed a learning cycle . However, when I attempted to do a full charge and discharge with my unit at it's full current draw the battery died while the gauge was still reporting 17% battery remaining. Have you seen this before? I have attached two graphs of the discharge. Note that the x axis is time in minutes.

  • Jarret,

    It wouldn't be unusual for a burst of current to crater your battery causing it to go down to the terminate voltage you programmed in your data flash. Since truee FCC is dependent on current, due to the IR drop due to the internal resistance of the battery, the SOC can drop to empty if you have a large current draw occur closer to the end of discharge of the battery.

    thanks
    Onyx
  • We are now trying to do the Chem ID profiling for our battery. We are using the bq24295 charger. According to the procedure (for the Chem ID), our taper rate should be C/100, which would be 29 mA for our battery. But, the charger ITERM value can only be set as low as 128 mA.
    Is it ok to use this charger for the Chem ID profiling?
  • You can set taper current to C/20 which is 145 mA for your battery and check to see if FC bit will get set when you charge battery to full.
    Best regards,
    Haidar
  • I have completed the Chem ID profiling for the battery. I submitted two sets of data for analysis by the online tool, one was the full log of the data collected, and the other was trimmed so that the final rest period was only 5 hours. Attached are the reports which I received back. In these logs I see the warning "Warning: difference between initial and final DOD is less than 90% dDOD_%=  90 Try to decrease the discharge rate".  Is this because I discharged at slightly over C/10? and will discharging slower change the Chem ID that I get for the battery? 

    Is there a way to tell if the BQ27441-G1A that I am using is similar to any of the recommended gauges?

    Chemistry ID selection tool, rev=2.24		
    		
    Configuration used in present fit:		
    ProcessingType=2		
    NumCellSeries=1		
    ElapsedTimeColumn=3		
    VoltageColumn=2		
    CurrentColumn=1		
    TemperatureColumn=0		
    		
    Best chemical ID : 198	Best chemical ID max. deviation, % : 3.65	
    		
    		
    		
    Summary of all IDs with max. DOD deviation below 3%		
    		
    Chem ID	max DOD error, %	Max R deviation, ratio
    0	0	0
    		
    Warning: Deviation is above recommended level. New chem ID needs to be released for this cell. Please contact your TI representative to send the cell to Dallas for characterization		
    		
    		
    Selection of best generic ID for ROM based devices like bq274xx		
    		
    		
    Device / Family #1		
    Generic Chem ID	Device/ Voltage/ Chemistry	max DOD error, %
    3142	bq27421-G1D: 4.4V LiCoO2	7.44
    354	bq27411-G1C: 4.35V LiCoO2	8.56
    128	bq27421-G1A: 4.2V LiCoO2	12.15
    312	bq27421-G1B: 4.3V LiCoO2	17.73
    Best generic ID 3142		
    Warning: Deviation for best generic ID is above recommended level for this device / family. Consider using another device, flash based gauge or RAM programming of custom ID.		
    		
    		
    Device / Family #2		
    Generic Chem ID	Device/ Voltage/ Chemistry	max DOD error, %
    1202	bq27621: (default) 4.2V LiCoO2	6.82
    354	bq27621:  (ALT_CHEM2) 4.35V LiCoO2	8.56
    1210	bq27621:  (ALT_CHEM1) 4.3V LiCoO2	8.58
    Best generic ID 1202		
    Warning: Deviation for best generic ID is above recommended level for this device / family. Consider using another device, flash based gauge or RAM programming of custom ID.		
    		
    		
    Device / Family #3		
    Generic Chem ID	Device/ Voltage/ Chemistry	max DOD error, %
    1202	bq27426: (ALT_CHEM1) 4.2V LiCoO2	6.82
    3142	bq27426: (ALT-CHEM2) 4.4V LiCoO2	7.44
    3230	bq27426: (default) 4.35V LiCoO2	10.63
    Best generic ID 1202		
    Warning: Deviation for best generic ID is above recommended level for this device / family. Consider using another device, flash based gauge or RAM programming of custom ID.		
    		
    		
    Warning: difference between initial and final DOD is less than 90% dDOD_%=  88 Try to decrease the discharge rate		
    Warning: difference between initial and final DOD is less than 90% dDOD_%=  88 Try to decrease the discharge rate		
    

    Chemistry ID selection tool, rev=2.24		
    		
    Configuration used in present fit:		
    ProcessingType=2		
    NumCellSeries=1		
    ElapsedTimeColumn=3		
    VoltageColumn=2		
    CurrentColumn=1		
    TemperatureColumn=0		
    		
    Best chemical ID : 138	Best chemical ID max. deviation, % : 3.54	
    		
    		
    		
    Summary of all IDs with max. DOD deviation below 3%		
    		
    Chem ID	max DOD error, %	Max R deviation, ratio
    0	0	0
    		
    Warning: Deviation is above recommended level. New chem ID needs to be released for this cell. Please contact your TI representative to send the cell to Dallas for characterization		
    		
    		
    Selection of best generic ID for ROM based devices like bq274xx		
    		
    		
    Device / Family #1		
    Generic Chem ID	Device/ Voltage/ Chemistry	max DOD error, %
    3142	bq27421-G1D: 4.4V LiCoO2	7.5
    354	bq27411-G1C: 4.35V LiCoO2	8.63
    128	bq27421-G1A: 4.2V LiCoO2	12.16
    312	bq27421-G1B: 4.3V LiCoO2	16.67
    Best generic ID 3142		
    Warning: Deviation for best generic ID is above recommended level for this device / family. Consider using another device, flash based gauge or RAM programming of custom ID.		
    		
    		
    Device / Family #2		
    Generic Chem ID	Device/ Voltage/ Chemistry	max DOD error, %
    1202	bq27621: (default) 4.2V LiCoO2	6.9
    354	bq27621:  (ALT_CHEM2) 4.35V LiCoO2	8.63
    1210	bq27621:  (ALT_CHEM1) 4.3V LiCoO2	8.65
    Best generic ID 1202		
    Warning: Deviation for best generic ID is above recommended level for this device / family. Consider using another device, flash based gauge or RAM programming of custom ID.		
    		
    		
    Device / Family #3		
    Generic Chem ID	Device/ Voltage/ Chemistry	max DOD error, %
    1202	bq27426: (ALT_CHEM1) 4.2V LiCoO2	6.9
    3142	bq27426: (ALT-CHEM2) 4.4V LiCoO2	7.5
    3230	bq27426: (default) 4.35V LiCoO2	10.68
    Best generic ID 1202		
    Warning: Deviation for best generic ID is above recommended level for this device / family. Consider using another device, flash based gauge or RAM programming of custom ID.		
    		
    		
    Warning: difference between initial and final DOD is less than 90% dDOD_%=  90 Try to decrease the discharge rate		
    Warning: difference between initial and final DOD is less than 90% dDOD_%=  90 Try to decrease the discharge rate		
    

  • Hi Jarret,
    Bqstudio did indeed return results to you in the two files. Can you confirm that the cells were charged to and discharged to the recommended voltages in the cell manufacturer data sheet? Based on the results returned, it shows that the default chem id preprogrammed in the device for the A and B versions, 128 and 312 respectively, you can't use this gauge because will expect to get at least 12% error. That is why both your charging and discharging are having issues. You will have to use one of our flash based gauges that will allow you program a custom chem id on it like the bq27510 or bq27520.

    thanks
    Onyx
  • I can confirm that the cell was charged to and discharged to the recommended voltages in the datasheet.
    The results sheet mentions a DOD parameter. What is this parameter?
    If we switch to a flash based gauge, what would we set the chem ID to, as the results specify that there is not a chem ID within 3% DOD deviation?
  • hi Jarrett,

    Since there isn't one with less than 3% deviation, you will have to send your cells to Dallas for characterization and chem id generation. The process currently takes about 2 months. I will contact you offline on how to send batteries. in the meanwhile you can start your evaluation using either 138 or 198 which the tool returned on your flash based gauge. Let me know if you have further questions.

    thanks
    Onyx
  • Thanks onyx,
    I am still curious as to what the DOD percent error is, and how that affects the battery gauge.

    thanks
  • Sorry, I missed that part of the question. DoD stands for depth of discharge... In simple terms DOD=100%-SOC, where SOC is state of charge.
    So DOD error essentially translates into SOC error.
  • Onyx Ahiakwo said:
    hi Jarrett,

    Since there isn't one with less than 3% deviation, you will have to send your cells to Dallas for characterization and chem id generation. The process currently takes about 2 months. I will contact you offline on how to send batteries. in the meanwhile you can start your evaluation using either 138 or 198 which the tool returned on your flash based gauge. Let me know if you have further questions.

    thanks
    Onyx

    Onyx, Posting in case someone comes across this post with similar issues.

    The reason our battery chem id testing didn't match anything was that we collected the data from the battery gauge which was not directly connected to the cell but instead through the protection circuit.  All of TI's chem id testing is done without the protection circuit.  After testing without protection circuit our battery was found to be a close match for the BQ27441-G1 which we already were using.