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.

Bq27220: Can not update data memory parameter

Part Number: BQ27220

Hello,

I am programming the bq27220 with I2C commands, I followed the example of the technical reference manual to modify the Design Capacity (doc. SLUUBD4 page 65) and I can't get it working.

First problem : each register has an offset of 0x0020. If I read the register 0x929F, I get the default value of 0x92BF. If I read 0x92A3, I get the default value of 0x92C3 etc...

Second problem : The gauge is unsealed and in full access, I checked the OperationStatus flags. I can read the default value of Design Capacity (3000) with the register offset seen previously (0x927F) but when I try to write the new value with the new checksum (with the formula given by the step 11 of the example) and data length, the value is not updated.

How the ckecksum is calculated ? The checksum (255 - x) where x is the 8-bit summation of the BLockData (0x40 to 0x5F) does not correspond with the checksum read at 0x60 register. The register 0x61 MadDataLen returns 36, but the blockData is 32 bytes. What are these 4 bytes used for the checksum ? 

Here is the blockData (0x40 to 0x5F) : 0b b8 03 84 0e 74 00 64 0e 9f 00 95 03 63 0f be 01 3c 09 00 00 0b d7 01 0d 39 01 0d ad 01 10 4d

I get checksum = 0xD2 and the checksum read at register 0x60 is 0xB5. I don't understand how this checksum is calculated.

I don't have the bq27220 EVM to read and write the registers.

Thank you for your help,

Best Regards,

Jonathan

UPDATE : Got it working ! There is an error in the example, after the step 8, you need to repeat the steps 5 and 6 else there is an offset of 0x0200 in the parameter address. When you read dataLen the address pointer change and you are not anymore at the right position. The TI documentation for writing the data memory is very poor, it is difficult to understand how it is working because the paragraph "3.1 Accessing the Data Memory" is wrong, it is just a copy/paste from others battery fuel gauge...