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 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.