SLUUCO5A december 2022 – august 2023 BQ34Z100-R2
The BQ34Z100-R2 data flash is a non-volatile memory that contains BQ34Z100-R2 initialization, default, cell status, calibration, configuration, and user information. The data flash can be accessed in several different ways, depending on in what mode the BQ34Z100-R2 is operating and what data is being accessed.
Commonly accessed data flash memory locations, frequently read by a host, are conveniently accessed through specific instructions described in Chapter 2. These commands are available when the BQ34Z100-R2 is either in UNSEALED or SEALED modes.
Most data flash locations, however, can only be accessible in UNSEALED mode by use of the BQ34Z100-R2 evaluation software or by data flash block transfers. These locations should be optimized and/or fixed during the development and manufacture processes. They become part of a Golden Image File and can then be written to multiple battery packs. Once established, the values generally remain unchanged during end-equipment operation.
To access data flash locations individually, the block containing the desired data flash location(s) must be transferred to the command register locations where they can be read to the host or changed directly. This is accomplished by sending the set-up command BlockDataControl() (code 0x61) with data 0x00. Up to 32 bytes of data can be read directly from the BlockData() command locations 0x40…0x5F, externally altered, then re-written to the BlockData() command space. Alternatively, specific locations can be read, altered, and re-written if their corresponding offsets are used to index into the BlockData() command space. Finally, the data residing in the command space is transferred to data flash, once the correct checksum for the whole block is written to BlockDataChecksum() (command number 0x60).
Occasionally, a data flash class will be larger than the 32-byte block size. In this case, the DataFlashBlock() command is used to designate which 32-byte block in which the desired locations reside. The correct command address is then given by 0x40 + offset modulo 32. For example, to access Terminate Voltage in the Gas Gauging class, DataFlashClass() is issued 80 (0x50) to set the class. Because the offset is 48, it must reside in the second 32-byte block. Hence, DataFlashBlock() is issued 0x01 to set the block offset, and the offset used to index into the BlockData() memory area is 0x40 + 48 modulo 32 = 0x40 + 16 = 0x40 + 0x10 = 0x50; for example, to modify [VOLTSEL] in Pack Configuration from 0 to 1 to enable the external voltage measurement option.
The subclass ID and Offset values are in decimal format in the documentation and in BQSTUDIO. The example below shows these values converted to hexadecimal. For example, the Pack Configuration subclass is d64 = 0x40.
(wr 0x00 0x14 0x04)
(wr 0x00 0x72 0x36)
(wr 0x61 0x00)
(wr 0x3E 0x40)
For example, Pack Configuration (offset = 0) is in the first block so use (wr 0x3F 0x00).
(rd 0x40 old_Pack_Configuration_MSB)
In this example, assume [VOLTSEL] = 0 (default).
(rd 0x60 OLD_checksum)
For example, to write 1-byte new_Pack_Configuration_MSB to Pack Configuration (offset=0) located at 0x40, use command (wr 0x4B new_Pack_Configuration_MSB).
(wr 0x60 NEW_checksum)
The checksum is (255-x) where x is the 8-bit summation of the BlockData() (0x40 to 0x5F) on a byte-by-byte basis.
A quick way to calculate the new checksum is to make use of the old checksum:
(wr 0x00 0x41 0x00)
If previously sealed, the gauge will automatically become sealed again after RESET.
(wr 0x00 0x20 0x00)
Reading and writing subclass data are block operations 32 bytes in length. Data can be written in shorter block sizes, however. Blocks can be shorter than 32 bytes in length. Writing these blocks back to data flash will not overwrite data that extend beyond the actual block length.
None of the data written to memory is bounded by the BQ34Z100-R2: The values are not rejected by the gas gauge. Writing an incorrect value may result in hardware failure due to firmware program interpretation of the invalid data. The data written is persistent, so a power-on reset resolves the fault.