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.

BQ76952: Current Calibration issue

Part Number: BQ76952

I am following the current calibration steps given in the Calibration manual. I am reading the CC2 counts middle two bytes from the READ_CAL1  subcommand. The current readings are not updated.

I: Number of bytes read 14
I: buf_data[0]: 10
I: buf_data[1]: ff
I: buf_data[2]: ff
I: buf_data[3]: ff
I: buf_data[4]: 0
I: buf_data[5]: 0
I: buf_data[6]: 0
I: buf_data[7]: 0
I: buf_data[8]: b8
I: buf_data[9]: c7
I: buf_data[10]: c8
I: buf_data[11]: 3f

This is the reading of the READ_CAL1 subcommand. After waiting for 2 minutes I executed the command again and still the same reading. The "Calibration Data Counter" in the first two bytes have not been incremented.

The reading of the middle two bytes is always -1.

Where am I going wrong??

This is my code to read the READ_CAL1 subcommand:

int32_t current_readCC2(const struct device *dev)
{
int16_t midbyte;
uint8_t buf_data[32];
uint8_t num_bytes;
int ret;

// Loop to read the 3rd and 4th byte of CC2 counts register and exchange the bytes to make into big endian format.
midbyte = 0;

// READ_CAL1 subcommand read a 12 byte register. The CC2 counts register starts at an offset of 2.
ret = bq769x2_subcmd_read_str_call(dev, BQ769X2_SUBCMD_READ_CAL1, buf_data, &num_bytes);
if(ret != 0){
LOG_ERR("Error occured when trying to read the values from the READ_CAL1 subcommand. Return value is %d\n", ret);
return -2;
}
//Print the number of bytes read
LOG_INF("Number of bytes read %d\n", num_bytes);

for(int i = 0;i < num_bytes-2; i++){
LOG_INF("buf_data[%d]: %x", i, buf_data[i]);
}
return 0;

}
  • Hello Ananya,

    After sending the subcommand, you need to wait 2-ms before reading from the 0x40 transfer buffer. 

    The subcommands require some time to complete the operation before reading from it is valid.

    I don't see this delay here?

    Best Regards,

    Luis Hernandez Salomon