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: Seal does not take effect

Part Number: BQ27426
Other Parts Discussed in Thread: BQSTUDIO

Tool/software:

Hi,

We got a problem when try to set CHEM_ID with 0x0008 on BQ27426.

The problem is occured when running the following line after finishing "Seal" process:

ret = bq27426_write(di, BQ27426_DM_CLASS, buf->class, true);

And the ret is equal to 0x8202.

So, we assumed "Seal" process isn't work well.

And then printing some messages to have a investigation:

00> <info> app: [BQ27426] [bq27426_battery_unseal]: SEAL STATE: 0x208C

00> <info> app: [BQ27426] [bq27426_battery_unseal]: SEAL STATE: 0x200C

00> <info> app: [BQ27426] [bq27426_battery_seal]: SEAL STATE: 0x200C

00> <info> app: [BQ27426] [bq27426_battery_unseal]: SEAL STATE: 0x200C

00> <info> app: [BQ27426] [bq27426_battery_seal]: SEAL STATE: 0x200C

00> <info> app: [BQ27426] [bq27426_battery_unseal]: SEAL STATE: 0x208C

00> <info> app: [BQ27426] [bq27426_battery_seal]: SEAL STATE: 0x208C

The state is changed after seconds later.

Could you please help to provide a solution to ensure the state can be changed immediately?

Thanks a lot!

  • Hello, 

    You can only change the chemID by changing bits 3 and 4 in the Operation Configuration D register. The BQ27426 is a ROM gauge, and you only have 3 options for the chemIDs that you can set on the gauge. You cannot program a custom chemID onto the BQ27426. 

    Regards, 

    Robert. 

  • Hi Robert,

    Please let me explain the problem again:

    The 1st task in our code:

    We followed "4.2 Chemistry Profile Change Example" of the TRM to set the chemID,

    The chemID that we set is 0x3142 currently.

    The 2nd task in our code:

    The chemID is also set via configuring "OpConfigD".

    Before configuring the standard data memory register,

    The steps in "Figure 1. Flow Chart for Updating Default Gauge Parameters Configurations" of the Quick-Start guide are also followed.

    But when trying to do the following line, the error has been occurred:

    ret = bq27426_write(di, BQ27426_DM_CLASS, buf->class, true);

    The ret is equal to 0x8202 at the moment.

    So, is there any notice that we should take care between the 2 tasks?

    Thanks,

    Kyle.

  • Hello Kyle, 

    Are you unsealing the gauge before trying to write to the gauge? 

    Regards, 

    Robert. 

  • Hi Robert,

    The access steps which described in TRM all are followed,

    And the related code we programmed as below,

    Please help to check, thanks.

    Set chemID with 0x0008:

    static int16_t bq27426_battery_set_chemid(struct bq27426_device_info *di)
    {
        BQ27426_LOG_INFO("[%s]: Start", __func__);

        int16_t ret = bq27426_battery_unseal(di);
        if(ret < 0)
        {
            BQ27426_ErrLog("[%s]: Unseal Failed", __func__);
            return ret;
        }

        ret = bq27426_write(di, BQ27426_REG_CTRL, SUB_CMD_CHEM_ID, false);
        if(ret < 0)
        {
            BQ27426_ErrLog("[%s]: Sent CHEM_ID subcommand Failed", __func__);
            return ret;
        }

        ret = bq27426_battery_set_cfgupdate(di);
        if(ret < 0)
        {
            BQ27426_ErrLog("[%s]: Set CFG Failed", __func__);
            return ret;
        }

        ret = bq27426_write(di, BQ27426_REG_CTRL, 0x32, false);    // 0x3142
        if(ret < 0)
        {
            BQ27426_LOG_ERROR("[%s]: Write CHEM_ID Failed", __func__);
            return ret;
        }

        nrf_delay_ms(1);
        ret = bq27426_battery_soft_reset(di);
        if(ret < 0)
        {
            BQ27426_ErrLog("[%s]: Soft Reset Failed", __func__);
            return ret;
        }

        nrf_delay_ms(25);
        ret = bq27426_read(di, 0, false);
        if(ret < 0)
        {
            BQ27426_LOG_ERROR("[%s]: Get CHEM_ID Failed", __func__);
            return -1;
        }

        bq27426_battery_seal(di);

    }

    And calling the following function:

    static void bq27426_battery_set_config(struct bq27426_device_info *di,
        struct power_supply_battery_info *info)
    {
        struct bq27426_dm_buf bd = BQ27426_DM_BUF(di, BQ27426_DM_DESIGN_CAPACITY);
        struct bq27426_dm_buf bt = BQ27426_DM_BUF(di, BQ27426_DM_TERMINATE_VOLTAGE);
        struct bq27426_dm_buf bo = BQ27426_DM_BUF(di, BQ27426_DM_OPCONFIGD);
        struct bq27426_dm_reg *reg = &di->dm_regs[BQ27426_DM_OPCONFIGD];
        bool updated;
        bool same = true;
        uint16_t *prev;
        uint8_t opcfd;

        BQ27426_DbgLog("[%s]: Start", __func__);
        if(bq27426_battery_unseal(di) < 0)
        {
            return;
        }

        if(info->charge_full_design_uah != -EINVAL &&
        info->energy_full_design_uwh != -EINVAL)
        {
            bq27426_battery_read_dm_block(di, &bd);

    Finally, the error occurred in the function:

    static int16_t bq27426_battery_read_dm_block(struct bq27426_device_info *di,
    struct bq27426_dm_buf *buf)
    {
        int16_t ret = 0;

        if(!diag_log)
        {
            BQ27426_DbgLog("[%s]: Start", __func__);
        }

        buf->has_data = false;

        ret = bq27426_write(di, BQ27426_DM_CLASS, buf->class, true);    // Error occurred here
        if(ret < 0)
        {
            goto out;
        }

    ... ...

    Sincerely,

    Kyle

  • Hi Robert,

    There's another phenomenon may be also important for the case.

    As my previous description,  the following line was abnormal after we programmed the chemID by "ret = bq27426_write(di, BQ27426_REG_CTRL, 0x32, false);    // 0x3142":

    ret = bq27426_write(di, BQ27426_DM_CLASS, buf->class, true);

    But this problem will be disappeared after rebooting the system.

    So, we found this problem can be duplicated when we teared down the battery and installed it back again.

    Sincerely,

    Kyle

  • Hello Kyle, 

    I cannot test your code on my end to give you a for sure answer whether your code is correct. Are you able to use bqStudio to try to communicate to the gauge?

    Regards, 

    Robert. 

  • Hi Robert,

    Unfortunately, we didn't have the EVM.

    Because the chemID is set via the following step:

    wr 0x00 0x32 0x00;

    The new chemID is applied via the following steps:

    wr 0x00 0x42 0x00;

    rd 0x06 Flags_register;

    And then Seal process is followed the step:

    wr 0x00 0x20 0x00;

    But the following step occurred an error after above steps and Unseal process:

    wr 0x3E 0x52;

    So cannot we try to converge this issue between these steps?

    Thanks,

    Kyle

  • Hello Kyle, 

    Please follow the procedure outlined in section 5.1.15 of the bq27426 Technical Reference Manual. Additionally, you can follow the exact steps/commands from section 4.2 Chemistry Profile Change Example from the bq27426 Technical Reference Manual, as this gives a step-by-step procedure for changing the chemistry. 

    Regards, 

    Robert.