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.

BQ34Z100: Query on accessing control subcommands

Part Number: BQ34Z100


Hi,

We are using the BQ34Z100 Fuel Gauge for our Battery Management System design with an STM32 microcontroller. I am not able to access the data of the control subcommands. This is the function being used in the code to access subcommands, please have a look and let me know if this is the way to go-

bool control_read( uint16_t subcommand, uint16_t data )
{
uint8_t i2c_data[2];

i2c_data[0] = 0x00;
i2c_data[1] = (uint8_t)( ( subcommand ) & 0x00FF );

HAL_I2C_Master_Transmit(&hi2c, 0xAA, i2c_data, 2, 10);

i2c_data[0] = 0x01;
i2c_data[1] = (uint8_t)( ( subcommand >> 8 ) & 0x00FF);

HAL_I2C_Master_Transmit(&hi2c, 0xAA, i2c_data, 2, 10);

HAL_I2C_Master_Receive(&hi2c, 0xAA, i2c_data, 2, 10);

data = ( i2c_data[1] << 8 ) | i2c_data[0];

return true;
}

Thanks.