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.

BQ27421: Flash stream file

Other Parts Discussed in Thread: BQ27421-G1

We used the TI BQ27421 gauge (I2C-bus) in the project.

1) The development environment of the gauge

1-1)  According to the Application Report SLUA541A , it describes the flash stream file for the gauge.

1-2) We used "bqtool" to download the flash stream file into the gauge.

1-3) About the Linux driver of the gauge, we downloaded it from the WEB site as follows:

>>          git.ti.com/.../bq27x00_battery.c

1-4) In the SLUUAH7B document (Quickstart Guide for bq27421-G1), Chapter 4 Programming the Configuration, it said:

>>   Most of the defaults can be left alone if desired, but there are four important parameters that should

>>   be configured in order to achieve accurate gauging of the target battery.

>>   These parameters are Design Capacity, Design Energy, Terminate Voltage, and Taper Rate.

2) Download the configuration parameters into the gauge

2-1) The "bqtool" will download the configuration parameters of the flash stream file into the gauge.

2-1-1) About the flash stream file, please refer to the bottom of the post.

2-1-2) But in the flash stream file, we did not find the 4 important parameters (mentioned in the 1-4) above) for

the accurate gauging of the battery.

2-2) In the Linux driver, it contains the configuration parameters of BQ27421 as follows:

static struct dm_reg bq274xx_dm_regs[] = {
{82, 0, 2, 1000}, /* Qmax */
{82, 5, 1, 0x81}, /* Load Select */
{82, 10, 2, 1340}, /* Design Capacity */
{82, 12, 2, 3700}, /* Design Energy */
{82, 16, 2, 3250}, /* Terminate Voltage */
{82, 27, 2, 110}, /* Taper rate */
};

2-2-1) The rom_mode_gauge_dm_init() routine of the driver will write the configuration parameters in

the bq274xx_dm_regs[] structure into the gauge.

2-2-2) The 4 important parameters (mentioned in the 1-4) above) for the accurate gauging of the battery are downloaded

by the driver in the structure above.

3) We have some questions about the 4 important parameters (mentioned in the 1-4) above) for the accurate gauging of the battery.

Q3-1) Should the flash stream file contains the 4 important parameters?

Q3-1-1) If yes, should we remove the codes of driver (in 2-2) above) to let all configuration parameters downloaded by the "bqtool"?

Q3-1-2) If no, how should we download the configuration parameters into the gauge?

Q3-2-1) The option-1

a) Download the flash stream file into the gauge by "bqtool" first.

b) And run the driver to write the configuration parameters in the bq274xx_dm_regs[] structure into the gauge.

Q3-2-2) Or, the option-2

a) Download the flash stream file into the gauge by "bqtool" only (without the 4 important parameters).

b) And remove the codes of driver (in 2-2) above) to skip the configuration parameters in the bq274xx_dm_regs[] structure?

Q-3-2-3) Or, the other option....

4) If we download the flash stream file by "bqtool" first and run driver to write the configuration parameters

in the bq274xx_dm_regs[] structure into the gauge.

Q4-1) Will the driver over-writes the other configuration parameters downloaded by bqtool?

Thank you.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

** The content of the flash stream file downloaded to the gauge by the "bqtool"

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;--------------------------------------------------------
;Verify Existing Firmware Version
;--------------------------------------------------------
W: AA 00 01 00
C: AA 00 21 04
W: AA 00 02 00
C: AA 00 08 01
;--------------------------------------------------------
;SET_CFGUPDATE
;--------------------------------------------------------
W: AA 00 13 00
X: 1100
W: AA 3E 02 00
W: AA 40 02 26 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 A5
X: 10
W: AA 3E 02 00
C: AA 60 A5
W: AA 3E 24 00
W: AA 40 00 19 28 63 5F FF 62 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 69
X: 10
W: AA 3E 24 00
C: AA 60 69
W: AA 3E 30 00
W: AA 40 0E 10 FD FF 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 AD
X: 10
W: AA 3E 30 00
C: AA 60 AD
W: AA 3E 31 00
W: AA 40 0A 0F 02 05 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 AD
X: 10
W: AA 3E 31 00
C: AA 60 AD
W: AA 3E 40 00
W: AA 40 25 F8 0F 00 00 14 04 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 B2
X: 10
W: AA 3E 40 00
C: AA 60 B2
W: AA 3E 44 00
W: AA 40 05 00 32 01 C2 14 14 00 03 08 98 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 39
X: 10
W: AA 3E 44 00
C: AA 60 39
W: AA 3E 50 00
W: AA 40 02 BC 01 2C 00 1E 00 C8 C8 14 08 00 3C 0E 10 00 0A 46 05 14 05 0F 03 20 00 64 46 50 0A 01 90 00
W: AA 60 BB
X: 10
W: AA 3E 50 00
C: AA 60 BB
W: AA 3E 50 01
W: AA 40 64 19 DC 5C 60 00 7D 00 04 03 19 25 0F 14 0A 78 60 28 01 F4 00 00 00 00 00 00 43 80 04 01 14 00
W: AA 60 2A
X: 10
W: AA 3E 50 01
C: AA 60 2A
W: AA 3E 50 02
W: AA 40 0B 0B B8 01 2C 0A 01 0A 00 00 00 C8 00 64 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 C1
X: 10
W: AA 3E 50 02
C: AA 60 C1
W: AA 3E 51 00
W: AA 40 00 A7 00 64 00 FA 00 3C 3C 01 B3 B3 01 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 8A
X: 10
W: AA 3E 51 00
C: AA 60 8A
W: AA 3E 52 00
W: AA 40 40 00 00 00 00 81 0E DB 0E A8 05 3C 13 60 05 3C 0C 80 00 C8 00 32 00 14 03 E8 01 00 64 10 04 00
W: AA 60 AC
X: 10
W: AA 3E 52 00
C: AA 60 AC
W: AA 3E 52 01
W: AA 40 0A 10 5E FF CE FF CE 00 01 02 BC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 2E
X: 10
W: AA 3E 52 01
C: AA 60 2E
W: AA 3E 53 00
W: AA 40 01 28 10 63 E5 E5 E8 E7 EA EA EC EC EE EE F0 F1 F1 EF EB EC ED F0 F6 F7 F9 F9 FB FC FC FF FF FE
W: AA 60 FF
X: 10
W: AA 3E 53 00
C: AA 60 FF
W: AA 3E 53 01
W: AA 40 FB F6 F4 EE EB F6 FA E1 F6 DF 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 1B
X: 10
W: AA 3E 53 01
C: AA 60 1B
W: AA 3E 54 00
W: AA 40 FF 2B 05 01 01 00 00 FF FF 00 00 FE FE FE FF 01 03 09 05 FD FE FF FF FF FF FE FD FC F5 EE F2 F4
W: AA 60 0E
X: 10
W: AA 3E 54 00
C: AA 60 0E
W: AA 3E 54 01
W: AA 40 FE 04 02 02 06 08 FE FB 9C 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 D5
X: 10
W: AA 3E 54 01
C: AA 60 D5
W: AA 3E 55 00
W: AA 40 FF BA 00 00 F9 E5 28 17 D1 1F 07 08 01 09 13 E0 EA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 43
X: 10
W: AA 3E 55 00
C: AA 60 43
W: AA 3E 6C 00
W: AA 40 FF 00 00 00 F2 08 CE DB E6 C2 D3 E5 12 FF 2E 65 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 3F
X: 10
W: AA 3E 6C 00
C: AA 60 3F
W: AA 3E 59 00
W: AA 40 00 66 00 66 00 63 00 6B 00 48 00 3B 00 3E 00 3F 00 35 00 2F 00 3C 00 46 00 8C 01 71 02 4C 00 00
W: AA 60 33
X: 10
W: AA 3E 59 00
C: AA 60 33
W: AA 3E 70 00
W: AA 40 80 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
W: AA 60 FF
X: 10
W: AA 3E 70 00
C: AA 60 FF
;--------------------------------------------------------
;Exit CFGUPDATE
;--------------------------------------------------------
W: AA 00 00 00
W: AA 00 42 00
X: 2000

  • We need to modify the Linux driver for the battery on the project.
    Could you do us a favor to tell us your comment?

    Thank you.
  • Q3-1) Should the flash stream file contains the 4 important parameters?

    Yes. Subclass State (0x52), offset 10, 12, 16, 27 and 29:

    W: AA 3E 52 00
    W: AA 40 40 00 00 00 00 81 0E DB 0E A8 05 3C 13 60 05 3C 0C 80 00 C8 00 32 00 14 03 E8 01 00 64 10 04 00

    Design Capacity = 0x053C = 1340 mAh
    Design Energy = 0x1360 = 4960 mWh
    Terminate Voltage = 0x0C80 = 3200 mV
    Taper Rate = 0x0064 = 100 .1 Hr rate
    Taper Voltage = 0x1004 = 4100 mV

    Q3-1-1) If yes, should we remove the codes of driver (in 2-2) above) to let all configuration parameters downloaded by the "bqtool"?

    This is up to you. If you use bqtool to load a flash stream file then having the driver set these parameters is redundant.

    Q3-1-2) If no, how should we download the configuration parameters into the gauge?

    N/A

  • Thank you for your kind support.

    1) About the Qmax Cell 0 (Subclass 82, offset 0) in the data memory
    1-1) In the Technical Reference of bq27421-G1, in page-41, Chapter 6.4.2.3.1 Qmax Cell 0, it said:
    >> Qmax contains the maximum chemical capacity of the cell, and is determined by comparing states
    >> of charge before and after applying the load with the amount of charge passed.
    >> It corresponds to capacity at low rate (~C/20) of discharge.
    >> For high accuracy, this value is periodically updated by the gauge during operation.
    >> The Impedance Track™ algorithm updates this value and maintains it.

    Q1-2) Is the "Qmax Cell 0" parameter in the data memory dynamically changed or static (not changed)?

    Thank you.
  • Qmax Cell 0 will change when the gauge detects a qualifying charge or discharge. It is not static.
  • Thank you for your kind help.
    We got it.

    Please do us a favor to close this case.