• Menu
  • Product
  • Email
  • PDF
  • Order now
  • Using I2C Communications With the bq34110, bq35100, and bq34z100-G1 Series of Gas Gauges

    • SLUA790 November   2016 BQ34110 , BQ34Z100-G1 , BQ35100

       

  • CONTENTS
  • SEARCH
  • Using I2C Communications With the bq34110, bq35100, and bq34z100-G1 Series of Gas Gauges
  1.   Using I2C Communications With the bq34110, bq35100, and bq34z100-G1 Series of Gas Gauges
    1.     Trademarks
    2. 1 Example 1: Reading Cell Voltage
    3. 2 Example 2: Reading the Firmware Version
      1. 2.1 Standard I2C Commands
      2. 2.2 Extended I2C Commands
      3. 2.3 Control Subcommands
      4. 2.4 Data Flash Access for the bq34z100-G1
    4. 3 Data Flash Access for the bq34110 and bq35100
    5. 4 Summary
    6. 5 Glossary: Control-Bit-Sequence Definitions
  2. IMPORTANT NOTICE
search No matches found.
  • Full reading width
    • Full reading width
    • Comfortable reading width
    • Expanded reading width
  • Card for each section
  • Card with all content

 

APPLICATION NOTE

Using I2C Communications With the bq34110, bq35100, and bq34z100-G1 Series of Gas Gauges

Using I2C Communications With the bq34110, bq35100, and bq34z100-G1 Series of Gas Gauges

This application report provides examples that illustrate the bit-transaction details of I2C commands used with TI's bq34xxx series and bq35xxx series battery fuel gauges. The first two examples provide detailed explanations of using I2C commands to read standard parameters and Control Subcommand parameters. The first example shows how to implement a standard fuel gauge command that interrogates the gauge for reading cell voltage. The second example shows the added bit transitions required to access a Control Subcommand, specifically requesting firmware version information. Other I2C commands can be executed in the same manner, using the methodology of these two examples. The final sections provide step-by-step examples using the bqStudio I2C Master Control Panel to read and write parameters from these gauges.

Trademarks

All trademarks are the property of their respective owners.

1 Example 1: Reading Cell Voltage

I2C commands are always initiated by the host with a START (S) bit sequence, immediately followed by a 7-bit I2C address with the most-significant bit (MSB) sent first. An eighth bit of 0 is sent by the host, indicating that the next byte to be sent will be a write to the gauge. For the bq34xxx series and bq35xxx series of parts, these 8 bits form the byte 0xAA. Once the start bit and address byte have been successfully received by the gauge, the gauge responds with an ACKNOWLEDGE (A) bit sequence. The gauge is now ready for the subsequent command directive from the host. Further descriptions of the control bit sequences are presented in the Glossary: Control-Bit-Sequence Definitions.

fig01_slua790.pngFigure 1. Simple I2C Command Transaction Sequence

After the successful transmission of the I2C address and read or write bit, the gauge command code can be sent by the host, in this case 0x08 for the Voltage( ) command. The command code is actually a base address location within the gauge and must not be confused with the I2C address for the gauge. Once this location is sent by the host, the gauge responds by sending an ACKNOWLEDGE bit sequence and then executing the corresponding command subroutine. Even though two-byte locations are used for many gauge commands, writing to only the single byte is required to start gauge command processing. In this case, only 0x08 was written to the gauge, even though the command consists of the two consecutive command bytes 0x08 and 0x09. Most commands consist of two bytes, because the data is returned to these command locations and are also two bytes – the least-significant byte (LSB) is stored in the lower address (0x08), whereas the MSB is stored in the higher address (0x09). Like the I2C address data, the gauge command is sent MSB-first.

The host initiates the reading of the command data by sending a REPEAT START (Sr) bit sequence. This is immediately followed by the 7-bit I2C address of the gauge plus the read-bit directive (1), which together create the byte 0xAB. The gauge responds with an ACKNOWLEDGE bit sequence, then takes control of the data bus. The first data byte (LSB) is stored at the 0x08 location in the gauge and is strobed out by the gauge MSB-first. If the host responds with an ACKNOWLEDGE bit sequence, the gauge automatically increments the command location to 0x09, then strobes out the MSB stored there. If the host responds with a NO ACKNOWLEDGE (P or NACK) bit transmission, no further data is spooled to the host. The host terminates the present command packet by sending a STOP bit.

2 Example 2: Reading the Firmware Version

Reading the firmware version is an example of using the bq34z100-G1 subcommands. Subcommands are unique, as they represent another level of depth into the gauge command structure. All subcommands are accessed through the paired command locations at 0x00 and 0x01 in the gauge. The subcommands are written LSB-first. Hence, to send the FW_VERSION subcommand (0x0002), the host writes 0x02 to command location 0x00 and 0x00 to 0x01. Again, I2C always writes the MSB first. The format for address/command/data exchange between host and gauge is similar to the previous example and is shown in Figure 2. As in Example 1, the host initiates transmission with a START bit, followed by the gauge I2C address and a WRITE bit of 0 (0xAA). The gauge responds with an ACKNOWLEDGE, then the host specifies the command address of 0x00. Again, the gauge responds with an ACKNOWLEDGE. At this stage, the host must make additional writes to the gauge to set the subcommand code of 0x0002. Hence, the host sends the low byte of the subcommand (0x02). The gauge acknowledges. Then the host sends the high byte of the subcommand (0x00). The gauge issues an ACKNOWLEDGE. The host completes the writing process by issuing the STOP bit sequence. Now the gauge is prepared to return firmware information to the host.

fig02_slua790.pngFigure 2. I2C Subcommand Initiation Sequence

To start the reading process, the host proceeds in a manner similar to Example 1, by issuing a START (S) bit sequence, immediately followed by the 7-bit I2C address of the gauge and the eighth bit of 0 (altogether, 0xAA for the bq34z100-G1 device). The gauge responds with an ACKNOWLEDGE bit sequence. The host sends the Control( ) command of 0x00, and the gauge acknowledges. The gauge address location has now been set. To retrieve the data at 0x00 and 0x01, the host proceeds as before. It initiates the reading of the command data by sending a REPEATED START bit sequence. This is immediately followed by the 7-bit I2C address of the gauge plus the read-bit directive (1), which together create the byte 0xAB. The gauge responds with an ACKNOWLEDGE bit sequence, then takes control of the data bus. The first data byte (LSB) is stored at the 0x00 location in the gauge and is strobed out by the gauge MSB-first. If the host responds with an ACKNOWLEDGE bit sequence, the gauge automatically increments the command location to 0x01, then strobes out the MSB stored there. The host terminates the entire command process by sending a STOP bit.

fig03_slua790.pngFigure 3. I2C Read Subcommand Sequence

2.1 Standard I2C Commands

We will use the Voltage as an example. Its command code is 08/09. Use the I2C Master Control Panel section to read the flash.

ENTER: Start Register 08, Number of Bytes to Read 2 and PRESS the Read button.

fig04_slua790.pngFigure 4. Standard I2C Command Reading Voltage

Byte swap the data and convert it to decimal. 3C8C is 15500 mV.

2.2 Extended I2C Commands

Read these like Standard Commands. As an example, use the State-of-Health (SOH), its command code is 2E/2F.

Use the I2C Master Control Panel section to read the flash.

ENTER: Start Register 2E, Number of Bytes to Read 2, and PRESS the Read button.

fig05_slua790.pngFigure 5. Extended I2C Command Reading State-of-Health

Byte swap the data and convert it to decimal. 0062 is 98% SOH.

2.3 Control Subcommands

Example 1:

DEVICE_TYPE Control() Subcommand 0001 and the correct answer is 0100 for the bq34z100-G1.

Use the I2C Master Control Panel section to read the flash.

ENTER: Start Register 00, Bytes to Write 0100 and PRESS the Write button.

The I2C words occur in the following order in the data stream: AA, 00, 01, 00.

ENTER: Start Register 00, Number of Bytes to Read 2 and PRESS the Read button.

The I2C words occur in the following order in the data stream: AA, 00, AB, 00, 01.

The device returns 0001, which is Little Endian for 0100. This is the DEVICE_TYPE for the bq34z100-G1.

fig06_slua790.pngFigure 6. I2C Control Subcommand Reading DEVICE_TYPE

Example 2:

CHEM_ID Control() Subcommand 0008 and the correct answer is 0107 for the bq34z100-G1.

Use the I2C Master Control Panel section to read the flash.

ENTER: Start Register 00, Bytes to Write 0800 and PRESS the Write button.

The I2C words occur in the following order in the data stream: AA, 00, 08, 00.

ENTER: Start Register 00, Number of Bytes to Read 2 and PRESS the Read button.

The I2C words occur in the following order in the data stream: AA, 00, AB, 07, 01.

The device returns 0701, which is Little Endian for 0107. This is the default ChemID for the bq34z100-G1.

fig07_slua790.pngFigure 7. I2C Control Subcommand Reading CHEM_ID

Example 3:

FW_VERSION Control() Subcommand 0002 returns both the DEVICE_NUMBER and the FW_VERSION on the bq34110 and bq35100. You must read 4 bytes of data.

Use the I2C Master Control Panel section to read the flash.

ENTER: Start Register 3E, Bytes to Write 0200 and PRESS the Write button.

The I2C words occur in the following order in the data stream: AA, 3E, 02, 00.

ENTER: Start Register 40, Number of Bytes to Read 4 and PRESS the Read button.

The I2C words occur in the following order in the data stream: AA, 40, AB, 01, 00, 01, 02.

The device returns 0100 0102 and it is not returned Little Endian. The DEVICE_NUMBER is 0100 for the bq35100 and the FW_VERSION is 0102.

fig08_slua790.pngFigure 8. I2C Control Subcommand Reading FW_VERSION

 

Texas Instruments

© Copyright 1995-2025 Texas Instruments Incorporated. All rights reserved.
Submit documentation feedback | IMPORTANT NOTICE | Trademarks | Privacy policy | Cookie policy | Terms of use | Terms of sale