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: Abnormal reading of current, reading data is 0

Part Number: BQ28Z620
Other Parts Discussed in Thread: BQ25798, BQSTUDIO

Tool/software:

At present, we have applied your company's BQ28Z620 chip to our actual project, working together with the BQ25798 chip. However, we have discovered an issue where our board should have a current of 70-80mA when turned on, but the data we read back with bq28z620 is 0, and our EE colleague's data read back on BQStudio is 80mA

After a period of time, the current is shown in the figure
May I ask what possible reasons may have caused it
The relevant code and data read by the logic analyzer are as follows

#define  BQ28Z620_CMD__CURRENT  0x0C

static int read_reg(const msdk_device_t *dev, uint8_t reg, uint8_t *value, uint8_t size)
{
    int ret = MSDK_STATUS__ERROR;

    const bq28z620_cfg_t *const dev_config = (const bq28z620_cfg_t *const)dev->config;

    ret = msdk_i2c_read_reg(dev_config->i2c_dev, dev_config->i2c_addr, reg, value, size);

    return ret;
}

static int read_current(const msdk_device_t *dev, int16_t *milli_ampere)
{
    uint8_t current_data[2] = {0};
    int res = MSDK_STATUS__ERROR;

    res = read_reg(dev, BQ28Z620_CMD__CURRENT, current_data, sizeof(current_data));

    if (MSDK_STATUS__OK == res) {
        uint16_t raw_value = (current_data[0] << 8) | current_data[1]; 
        
        if(!(raw_value & 0x8000)) {
            *milli_ampere = (int16_t)raw_value;  
        } else {
            *milli_ampere = -(int16_t)(raw_value & 0x7FFF); 
        }
    }

    return res;
}
msdk_status_t bq28z620_property_get(const msdk_device_t *dev,
    msdk_fuel_gauge_property_t prop,
    msdk_fuel_gauge_propval_t *val)
{
    MSDK_ASSERT(dev != NULL);
    MSDK_LOG_DBG("bq28z620_property_get: dev 0x%08x, prop %d", dev, prop);
    int res = MSDK_STATUS__ERROR;

    switch(prop) {

    case MSDK_FUEL_GAUGE_PROP_CURRENT: {
            int16_t mA = 0;
            res =read_current(dev, &mA);
            val->current = (int32_t)mA;
        }
        break;
    	
    default:
        res = MSDK_STATUS__NOT_SUPPORTED;
        break;
    }

    return res;
}

Best Regards!

Iris

  • Please make sure that the Current Deadband is lower than the value that you want to measure. The gauge will report any current that's smaller than this threshold as 0mA.

  • Hi Dominik,

    We set it to be less than 10mA, which will display 0, and once it is greater than 10mA, the current can be seen
    In addition, we detected a current value of 32700mA after a period of time, which is not quite accurate and too high. When our board is turned on, the current will be between 70-80mA
    Could you please help check if there are any issues with the code or if it is caused by other problems?

    Best Regards!

    Iris

  • I don't have the bandwidth to review code. Another reason why the gauge may report 0mAh is if the gauge entered sleep mode and started the auto-cal process. Please check if this behavior correlates with sleep mode.