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.

BQ27426: writing Ra table and generating checksum

Part Number: BQ27426

Hi Team,

we are in a position where we need to overwrite the Ra tables on the BQ27426 on ocassion.   We understand the flashstream format and know how to write the values.   What we're confused about is if we are generating the checksum properly and then, where to write it.

We did review SLUA801 and found the following code:

//check_sum: calculate check sum for block transfer
//pData: pointer to data block
//nLength: length of data block
unsigned char check_sum(unsigned char *pData, unsigned char nLength)
{
unsigned char nSum = 0x00;
unsigned char n;
for (n = 0; n < nLength; n++)
nSum += pData[n];
nSum = 0xFF - nSum;

return nSum;
}

1) Is this the correct procedure for calculating the checksum?  

2) Where should this value be written - again if the block transfer is for Ra table?

Thanks,

Sal

  • This is the correct procedure. The check sum must be written to address 0x60 after writing the block data.
    Please make sure that the gauge is in configuration update mode (check CFGUPMODE (bit 4) in the flags register of the bq27426. It must be set. If it is not set, issue SET_CFGUPDATE and then poll this bit until it is 1 before writing data to the gauge.