SLUUCG7 April 2024 BQ76922
The BQ76922 device includes support for direct commands and subcommands. The direct commands are accessed using a 7-bit command address that is sent from a host through the device serial communications interface and either triggers an action, or provides a data value to be written to the device, or instructs the device to report data back to the host. Subcommands are additional commands that are accessed indirectly using the 7-bit command address space and provide the capability for block data transfers. When a subcommand is initiated, a 16-bit subcommand address is first written to the 7-bit command addresses 0x3E (lower byte) and 0x3F (upper byte). The device initially assumes a read-back of data may be needed, and auto-populates existing data into the 32-byte transfer buffer (which uses 7-bit command addresses 0x40–0x5F), and writes the checksum for this data into address 0x60. If the host instead intends to write data into the device, the host will overwrite the new data into the transfer buffer, a checksum for the data into address 0x60, and the data length into address 0x61. As soon as address 0x61 is written, the device checks the checksum written into 0x60 with the data written into 0x40-0x5F, and if this is correct, it proceeds to transfer the data from the transfer buffer into the device's memory. The checksum is the 8-bit sum of the subcommand bytes (0x3E and 0x3F) plus the number of bytes used in the transfer buffer, then the result is bitwise inverted. The verification cannot take place until the data length is written, so the device realizes how many bytes in the transfer buffer are included. The checksum and data length must be written together as a word in order to be valid. The data length includes the two bytes in 0x3E and 0x3F, the two bytes in 0x60 and 0x61, and the length of the transfer buffer. Therefore, if the entire 32-byte transfer buffer is used, the data length will be 0x24.
Some subcommands are only used to initiate an action and do not involve sending or receiving data. In these cases, the host can simply write the subcommand into 0x3E and 0x3F, it is not necessary to write the length and checksum or any further data.
The commands supported in the device are described in Commands and Subcommands. Single-byte commands are direct commands, while two-byte commands are subcommands. Data formats are described in Data Formats.
The most efficient approach to read the data from a subcommand (to minimize bus traffic) is shown below:
An easier approach that is less efficient on bus traffic is:
Note: 0x61 provides the length of the buffer data plus 4 (that is, length of the buffer data plus the length of 0x3E and 0x3F plus the length of 0x60 and 0x61).
The checksum is calculated over 0x3E, 0x3F, and the buffer data, it does not include the checksum or length in 0x60 and 0x61.
If the checksum and length are read together, this can trigger an auto-increment in some cases, in which case the buffer will be populated with another block's data. So, generally the checksum and length should not be read together unless the buffer has already been read, or if auto-incrementing is intended.
Command or subcommand bits denoted RSVD_0 should only be written as a "0", while bits denoted RSVD_1 should only be written as a "1".