This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

bq27510-G2 Writing to Dataflash

Other Parts Discussed in Thread: BQ27510-G2

I am currently using bq Evalution Software for programming .dfi file to battery gauge IC. And its works properly.

But for production purpose this procedure is quite time consuming.

I found from the datasheet of bq27510-g2 that it is possible to change few parameters like battery capacity by few I2C commands.

There is also one example of accessing Terminate Voltage given in the datasheet on Page:15. But the steps are not much clear to me.

So is there any Application note/Tutorial on this?

  • This shows an example of the command sequence used to modify a dataflash parameter while device firmware is still running.  It can be used to update one or more parameters without going to ROM mode and loading a new dataflash image (.dfi or .dffs file). 

     

    For this example, the WRTEMP bit of the OpConfigB register of the bq27520-G3 will be changed from 0 to 1.

    Note that subclass ID and Offset values in the dataflash tables of the datasheets and technical reference manuals are in decimal format.  The example below has converted these to hexadecimal.  For example, the OpConfigB subclass is d64 = 0x40.

    1.  Unseal the device by using the Control()(0x00/0x01) command if the device is SEALED.

    Write the first 2-bytes of the UNSEAL key using the Control(0x0414) command.  (wr 0x00 0x14 0x04)

    Write the second 2-bytes of the UNSEAL key using the Control(0x3672) command. (wr 0x00 0x72 0x36)

    2.  Write 0x00 using BlockDataControl() command (0x61) to enable block data flash control.  (wr 0x61 0x00)

    3.  Write 0x40 (OpConfigB SubClass) using the DataFlashClass() command (0x3E) to access the Registers subclass.  (wr 0x3E 0x40)

    4.  Write the block offset location using DataFlashBlock() command (0x3F).  To access data located at offset 0 to 31 use offset = 0x00.  To access data located at offset 32 to 41 use offset = 0x01.

    For example OpConfigB (offset = 11) is in the first block so use (wr 0x3F 0x00)

    5. To read the data of a specific offset use address 0x40 + mod(offset, 32).

    For example OpConfigB (offset = 11) is located at 0x4B, read 1 bytes starting at 0x4B address.                                                                                       (rd 0x4B old_OP_CONF_B_BYTE)

    In our example, assume WRTEMP(MSB) is cleared.

    6.  To read the 1 byte checksum use the BlockDataChecksum() command (0x60).    (rd 0x60 OLD_checksum).

    7.  In this example, set WRTEMP by setting the most-significant bit of OP_CONF_B_BYTE.

    8.  The new value for OP_CONF_B_BYTE can be written by writing to the specific offset location.

    For example to write 1-byte OP_CONF_B_BYTE new value with MSB set to OpConfigB (offset=11) located at 0x4B, use command      (wr 0x4B new_OP_CONF_B_BYTE)

    9.  The data is actually transferred to the data flash when the correct checksum for the whole block (0x40 to 0x5F) is written to BlockDataChecksum() (0x60)                                (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:

    1. temp = mod( 255 - OLD_checksumold_OP_CONF_B_BYTE), 256)
    2. NEW_checksum = 255 - mod( temp + new_OP_CONF_B_BYTE, 256)

     

    10. RESET the gauge to ensure the new dataflash parameter goes into effect by using Control(0x0041).

    (wr 0x00 0x41 0x00)

    If previously sealed then the gauge will automatically become sealed again after RESET.

    11. If not previously sealed, then SEAL the gauge by using Control(0x0020).       (wr 0x00 0x20 0x00)