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.

BQ27426EVM-738: Problem with device configuration mode

Part Number: BQ27426EVM-738
Other Parts Discussed in Thread: BQ27426

Hi everyone,

My customer works with BQ27426EVM-738 and faced with a problem.

They are not able to go into device configuration mode. Bit FLAG_CFGUPMODE (1<<4) is not set in CONTROL_STATUS (0x00) register.

They do the following:

  1. Check blocking status STATUS_SS (1<<13) in CONTROL_STATUS (0x00) register.
  2. Bit is set → remove the bit by writing unseal key (0x8000).
  3. Check STATUS_SS again → it is removed then device is unlocked.
  4. Execute command to go into configuration mode CONTROL_SET_CFGUPDATE (0x0013).
  5. Wait 2-5 seconds for FLAG_CFGUPMODE (1<<4) in CONTROL_STATUS (0x00) register. The bit is not set!
  6. Then anyway device configuring goes ahead - device capacity is set.
  7. Then device capacity is read - incorrect value is returned. We can assume that mistake occurs due to problem in p.5

The customer uses library:

  1. https://github.com/deondavis/lib-BQ27421/blob/master/bq27421.c
  2. https://github.com/sparkfun/SparkFun_BQ27441_Arduino_Library
  3. https://github.com/torvalds/linux/blob/master/drivers/power/supply/bq27xxx_battery.c

Entry points in libraries for device configuration functions:

1. Line 185 - bq27421_i2c_control_write( BQ27421_CONTROL_SET_CFGUPDATE );
2. Line 330 - boolBQ27441::enterConfig(bool userControl)

BQ274xx devices seem similar from registers point of view due to the followings defines:

#define bq27411_regs bq27421_regs
#define bq27425_regs bq27421_regs
#define bq27426_regs bq27421_regs
#define bq27441_regs bq27421_regs
#define bq27621_regs bq27421_regs

Debug console output is attached:

  • Hi Vladimir,

    After you send the unseal key, you also need to send the full access access key to get the gauge to be fully accessible.

    thanks
    Onyx
  • What's the definition for BQ27421_CONTROL_LOW and BQ27421_CONTROL_HIGH in your code?

    The bq27421.h file is missing.

    Keep in mind that the bq27421 uses little endian for sub commands and big endian for data memory.

    So if you want to send sub command 0x0013, you have to write 0x13 to register (cmd) 0x00 followed by 0x00 to register (cmd) 0x01.

    What's the value that your read back from the flags register?

  • Hi Onyx,

    After you send the unseal key, you also need to send the full access access key to get the gauge to be fully accessible.

    Could you please clarify which key do you mean? And which register it should be written in?

    My customer says that he didn't see any additional keys in the available libraries.

    He uses this lib in his project - github.com/.../SparkFun_BQ27441_Arduino_Library

  • Dominik Hartl11 said:

    Keep in mind that the bq27421 uses little endian for sub commands and big endian for data memory.

    So if you want to send sub command 0x0013, you have to write 0x13 to register (cmd) 0x00 followed by 0x00 to register (cmd) 0x01.

    What's the value that your read back from the flags register?

    Thanks for the hint, It has been solved.
    Dominik Hartl11 said:

    What's the definition for BQ27421_CONTROL_LOW and BQ27421_CONTROL_HIGH in your code?

    The bq27421.h file is missing.

    Don't pay attantion to this defines. The customer has modified original code. 
    Dominik could you please have a look at the attachments? 
    There are 2 zip files:
    BQ27426 - modified library
    BQ27421_Basic - test program
    This is used by the customer.
  • the default full access key is 0xffff, 0xffff
  • Onyx, Dominik, thank you very much.

    Issue with  FLAG_CFGUPMODE  is solved.

    2 new questions from the customer related to BQ27426 at that projects.

    1)     The customer uses the following structures to set-up design capacity. These are different and depends on chip:

    static struct bq27xxx_dm_reg bq27421_dm_regs[] = {

    [BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 10, 2, 0, 8000 },

    [BQ27XXX_DM_DESIGN_ENERGY] = { 82, 12, 2, 0, 32767 },

    [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2500, 3700 },

    };

    static struct bq27xxx_dm_reg bq27426_dm_regs[] = {

    [BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 6, 2, 0, 8000 },

    [BQ27XXX_DM_DESIGN_ENERGY] = { 82, 8, 2, 0, 32767 },

    [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 10, 2, 2500, 3700 },

    };

    The customer tries to set-up BQ27426 design capacity with 5300m but the ic returns 5022 (see screenshot below). Is this OK or not?

    2)   Is it possible to replace remaining battery capacity value by user value?

    Now the chip always starts reading remaining battery capacity from 0 despite the fact that battery is fully charged:

    Best regards,

    Dmitry

  • The 5022mAh is the Full Charge Capacity. This will be different from Design Capacity, depending on gauging settings.

    Design Capacity is the nominal capacity for this cell. The gauge treats this as the total charge that can be stored in the cell from cell = full (depth of discharge = 0.0) to cell = empty (depth of discharge = 1.0).

    FCC is the actual total charge that you can withdraw from the cell under the system's load, charge and temperature parameters with cell age also under consideration.

    This will be less than Design Capacity. For example, if the cell isn't charged to DOD = 0.0 but to DOD = 0.05 (for example, charging voltage is not the maximum allowed or taper current is fairly high), FCC will be less. Or if temperature is cold (e.g. 0C), FCC will be less. Or if the system load is high (e.g. C/1), the IR drop due to the high load current will cause the cell voltage to drop below terminate voltage earlier so FCC will be less. Or if the cell is aged, chemical capacity will be reduced and impedance will be increased so FCC will be less.

    If you expect FCC to be closer to Design Capacity (it's fairly far off 5022mAh vs. 5300mAh), I'd check if your charge termination settings are correct for your application and if terminate voltage is adequate and if the load model is correct (this includes load mode/select as well as avg. I/P last run).

  • Thanks Dominik,

    Design Capacity is the nominal capacity for this cell. The gauge treats this as the total charge that can be stored in the cell from cell = full (depth of discharge = 0.0) to cell = empty (depth of discharge = 1.0).

    Am I right:   to avoid reading remaining battery capacity from 0 despite the fact that battery is fully charged I have to store last cell stage and use the figure after system start?

    Best regards,

    Dmitry

     

     

  • If the gauge is powered on, it stores the necessary parameters. If it goes into shutdown, you need to have stored the DF parameters in your host NVM so that it can be loaded back on the gauge after power on.
    thanks
    Onyx