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.

BQ35100: Getting Incorrect Measurements in Accumulator Mode

Part Number: BQ35100

Hello,

I am having trouble with the measurements I am getting from the BQ35100 Fuel Gauge.  I am using the device in the default configuration (Accumulator Mode).  The software performs the following steps:

  1. Device powers up
  2. Fuel gauge enable pin is set high
  3. Device waits for nAlert pin to go low due to INITCOMP = 1 (with a 1 second timeout)
  4. CMD Battery Status and Battery Alert is read to clear the alert flag
  5. Device waits for nAlert to go high again (with a 1 second timeout)
  6. Gauge start command is sent to fuel gauge
  7. Device performs simple task using the modem to check the current time
  8. Gauge stop command is sent to fuel gauge
  9. CMD Battery Status and Battery Alert is read to clear the alert flag
  10. Device waits for nAlert pin to go low due to GDONE = 1 (with a 1 second timeout)
  11. CMD Battery Status and Battery Alert is read to clear the alert flag
  12. Device waits for nAlert to go high again (with a 1 second timeout)
  13. Device requests Accumulated Capacity value
  14. Device performs 0xFFFFFFFF - Accumulated Capacity to get charge used during test
  15. Fuel gauge enable pin is set low
  16. Device goes back to sleep

I just took two measurements, where for the first measurement I had the modem installed in my device (largest power sink on the device) and for the second measurement the modem was removed.  There are no wait cases or retries if the modem does not respond, so the device should do the exact same thing whether the modem is connected or not.  In the first case with the modem installed, the device indicated 13954uAH were used and in the second case without the modem the device indicated 14151uAH were used.

The device was not calibrated, so it is using the default calibration and the default mode (accumulator mode).  Are there any steps I am missing to getting an accumulated capacity used measurement from the fuel gauge?  Is the 1 second timeout on the nAlert pin state too short?

  • Hello Chris,

    On an uncalibrated device there may be an (offset) current that will show up on no load.

    Refer section 5.1.1 in the TRM

    When the GE pin is asserted, the device will update AccumulatedCapacity() from the value stored in data flash. When ControlStatus() [GA] is set, the device adds each coulomb counter measurement to the value of AccumulatedCapacity().

    The value that was read therefore includes the previously accumulated value + the new one.

  • That makes sense.  I had done some testing previously and thought that the counter was reseting every time, but it looks like it isn't.  Is there a way to set the accumulated capacity number when a new battery is installed?  The number 0xFFFFFFFF or 4294967295uAH is way more than my batteries can hold.  I have tried updating the value stored at 0x41FE (Cell Design Capacity mAH) and I could read that the value had changed, but the value in Accumulated Capacity was unaffected.

  • Hello Chris,

    Refer the Technical reference manual(TRM) for bq35100

    Set design parameters in Data memory to match the battery.

    To start with a fresh cell try NEW_BATTERY command. Otherwise use the reset command and then send NEW_BATTERY command.

  • I am able to update the Cell Design Capacity in the data flash at 0x41FE to match the batteries capacity I am using in mAh.  After doing this, I send the new battery command and the reported Accumulated Capacity in uAh is still too big.

    I will try using the reset command, but per the Technical Reference Manual, I have to unseal the device in order to reset it.

  • My fuel gauge init routine is now set to the following:

    1. Fuel gauge enable pin is set high
    2. Device waits for nAlert pin to go low due to INITCOMP = 1 (with a 1 second timeout)
    3. CMD Battery Status and Battery Alert is read to clear the alert flag
    4. Device waits for nAlert to go high again (with a 1 second timeout)
    5. Gauge start command is sent to fuel gauge
    6. Write the Cell Capacity Flash Address to MAC followed by the new updated capacity in mAh
    7. Write the complement and length plus four to MAC DATA SUM
    8. Write the Cell Capacity Flash Address to MAC again
    9. Read MAC to confirm the address is set correctly
    10. Read MAC Data to confirm the flash memory was updated to the new capacity value correctly
    11. Write the Unseal Key address to MAC
    12. Read MAC to confirm the address is set correctly
    13. Read MAC Data to read the unseal keys into memory
    14. Write the first unseal key in little endian order to Control
    15. Write the second unseal key in little endian order to Control
    16. Write a reset in little endian order to control
    17. Write a new battery in little endian to control
    18. Read the Design Capacity command and confirm it is set to the updated value
    19. Read accumulated capacity command and confirm it is now set to 0.

    I can get the device to read the correct design capacity but I cannot get the device to read the correct accumulated capacity

  • Copied below is a printout log from my device as it runs

    i2cfuelgauge_app_init() complete with flag 0

    Writing new capacity value 38000 to flash

    Message structure is FE, 41, 94, 70

    i2cfuelgauge_app_init() flash write complement BC and length 6 with flag 0

    i2cfuelgauge_app_init() flash write flag 0

    i2cfuelgauge_app_init() write complement and length plus 4 with flag 0

    i2cfuelgauge_app_init() reset flash address flag 0

    i2cfuelgauge_app_init() read flash address with address 0x41FE and flag 0

    i2cfuelgauge_app_init() read flash with value 0x9470 and flag 0

    change flash address to unseal register with flag 0

    i2cfuelgauge_app_init() read flash address with address 0x41CC and flag 0

    i2cfuelgauge_app_init() read flash with value 0x4143672 and flag 0

    unseal1 complete with flag 0

    unseal2 complete with flag 0

    reset complete with flag 0

    new battery complete with flag 0

    Battery Design Capacity =  38000

    Battery Accumulated Capacity = 0uAH

  • Hello Chris,

    There are 2 parts to using the bq35100

    1. Initialization and writing parameters - This is done once right after battery is attached. This is the last "init routine" that you have mentioned. At the end of this you have initially got 0 which is correct.

    2. Operation with load: This is where Accumulator mode takes measurements and updates data. This is the procedure that was posted first in this thread. This is done by the host system to read Accumulated Capacity. This is repeated for every discharge

  • Is there a way to write a value to the data flash to set the starting value of Accumulated Capacity?

  • Hello Chris,

    The accumulated capacity register is read only.

    Sincerely,

    Wyatt Keller

  • Is there a way to have the chip change the Accumulated Capacity register to match the Design Capacity when I use the New Battery command?  So I can have the counter match the mAH of a new battery?

  • Hello Chris,

    If you need this kind of functionality I would recommend doing the offset on the host side. When the new battery command is received it will always clear the accumulation register. Take the design capacity - the accumulated charge

    Sincerely,

    Wyatt Keller