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: Failing to set TEMPS

Part Number: BQ27426

Hello,

I am trying to set the TEMPS register to use the host provided battery temperature, but I'm failing to do so.

I'm writing to the 'registers' subclass using the same procedure that I use (and works) to write to the 'state' and 'ra' subclassess. First I unseal the device, then I set the subclass with offset 0, then I write the 5 bytes of the registers data (using the defaults), set the subclass once again so that the checksum is calculated, and then read the checksum from the device to check that it matches with mine. The BQ27426 is responding to the I2C write with a NACK, and the checksum doesn't match, even though it has been correctly calculated.

This is what I'm writing to the 'registers' subclass (the default values):

[ 0x64, 0x78, 0x0F, 0x9F, 0x23 ]

And the checksum is 0x52.

What am I doing wrong? Does the subclass have hidden registers that are also included in the checksum?

Thanks

  • Yes, the Registers subclass has several private values that will have to be included in the check sum calculation so your method won't work.

    The easiest way is to read the whole block (32 bytes) into a local buffer, change the OpConfig setting for TEMPS, calculate the new check sum over all 32 bytes and write the whole block and the check sum.

    Alternatively you can implement the more complex parameter update sequence from Chapter 4.1, www.ti.com/.../sluubb0.pdf