SLUA790 November   2016 BQ34110 , BQ34Z100-G1 , BQ35100

 

  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

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