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.

BQ28Z620: The voltage and SOC values read are inaccurate

Part Number: BQ28Z620
Other Parts Discussed in Thread: BQSTUDIO

Tool/software:

Hi teams:

The battery voltage and SOC values we read on the official board are inaccurate. The SOC value returns 0x80, which is 128, and the voltage value returns 0x8000, which is 32768. The code is shown below,
When reading the voltage, we initially used EVK for testing. The value read back by the small terminal was incorrect, while the data read back by the large terminal mode was correct. Therefore, we used the large terminal mode. Do we need to use the small terminal mode in the formal board? If it is 0x0080, the value is also incorrect
Could you please help us identify which part may be the problem? Additionally, when using bq28z620 on the official board, what other issues do we need to pay attention to?

By using logical analysis to capture data, it was found that after reading back, the data bit 0x00+NAK, and sda/scl were both at a low level, and the clock did not continue during the process

Best Regards!

Iris

typedef struct __attribute__((packed)) {
    uint8_t high_byte;  /*buf[0] */
    uint8_t low_byte;  /*buf[1] */
} bq28z620_voltage_t;

typedef struct __attribute__((packed)) {
    uint8_t low_byte;
    uint8_t high_byte;
} bq28z620_reg_t;

static int read_voltage(const msdk_device_t *dev, uint16_t *milli_volts)
{
    bq28z620_voltage_t voltage_data = {0};
    int res = MSDK_STATUS__ERROR;

    res = read_reg(dev, BQ28Z620_CMD__VOLTAGE, (uint8_t *)&voltage_data);

    if (MSDK_STATUS__OK == res){

        *milli_volts = (voltage_data.high_byte << 8) | voltage_data.low_byte;
    }
    MSDK_LOG_DBG("milli_volts: %d", *milli_volts);

    return res;
}

static int read_relative_soc(const msdk_device_t *dev, uint16_t *percent)
{
    bq28z620_reg_t soc_data = {0};
    int res = MSDK_STATUS__ERROR;

    res = read_reg(dev, BQ28Z620_CMD__RELATIVE_STATE_OF_CHARGE,(uint8_t *)&soc_data);

    if (MSDK_STATUS__OK == res){

        *percent = (soc_data.high_byte << 8) | soc_data.low_byte;
    }

    return res;
}