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: Force reset won't clear the accumulatedcapacity buffer

Part Number: BQ35100
Other Parts Discussed in Thread: BQSTUDIO

Dear TI-Forum users,

As the title describes, a force reset in unsealed mode doesn't clear the 0x02 flash read register.

This is what I do now as referred in 8.2.2.2.1 of the datasheet:

Step 0: Reset the BQ35100, set it to the ACC mode. (GE is high)

Step 1: Set GE high to power up the BQ35100 gauge and wait for ALERT to go low due to INITCOMP = 1.
Step 2: Clear ALERT (read BatteryStatus()) and send GAUGE_START().
Step 3: Read AccumulatedCapacity() for the latest passed discharge data since GAUGE_START().

Running some code here

Step 4: Send GAUGE_STOP() and wait for ALERT to go low due to G_DONE = 1.
Step 5: Read final AccumulatedCapacity() value.
Step 6: Set GE low to power down the BQ35100 device.

Back to step 0 if devices wakes up

The battery is discharging so the AccumulatedCapacity should decrease from its max value to 0.
In the TRM there is no clear explanation about the max value except telling its maximum value is 4.29E9 uAh. It seems like they refer to 2^32 (max value 4 bytes) 
or 4294967295 to be more specific. If so please agree. Also there is no clear way described in the TRM to reset this value.  

Thanks a lot for the help!

Yours Sincerely,

Jorg 

  • Jorg,

    Setting GE pin low or issuing the reset command does not clear the accumulated passed charge. That is an intended feature. If you send the Gauge_stop command any charge accumulated will be saved into flash so the next time you boot it will start there. 

    If you want to start at 0 every time, do not issue the gauge stop command and just read accumulated charge right before powering GE down. Likewise you can issue the "New Battery" command which will clear out the accumulated charge in Flash and should start you from 0.

    Thanks,

    Eric Vos

  • Hey Eric Vos,

    Thank you for the fast response. I tried clearing the accumulated charge using the new battery command, but nothing happens. Same as reading the accumulated charge before powering GE down. Before step 1 I set the gauge in ACC mode and reset the battery. Then my code looks as followed:

    ///Step 1: Set GE high to power up the BQ35100 device and wait for ALERT to go low due to INITCOMP = 1
    enableGauge();
    controlStatusRet = 0;
    do
    {
    controlStatusRet = readControlStatus();
    } while ( ( ( controlStatusRet >> 7 ) & 0x1 ) == 0 );
    
    ///Step 2: Clear ALERT (read BatteryStatus()) and send GAUGE_START()
    I2cRead( &I2c, c_BQ35100I2CAddr, BQ35100_READ_BATTERY_STATUS, bufferSOH );
    DelayMs( 100 );
    controlSubCmd( BQ35100_GAUGE_START );
    ///Step 3: Read AccumulatedCapacity() for the latest passed discharge data since GAUGE_START().
    stateOfHealthACC();
    
    Running code here...
    Skip step 4 (gauge stop)
    
    ///Step 5: Read final AccumulatedCapacity() value
    stateOfHealthACC();
    ///Step 6: Set GE low to power down the BQ35100 device
    disableGauge();
    
    

    What am I doing different?

    Yours sincerely,

    Jorg 

  • Jorg,

    I don't understand the issue here. Reading above you want to just start each active gauge section with 0 charge in the accumulated charge register. If so you should do the below

    GE_High

    Send Gauge Start

    (Do stuff)

    read 0x02 (Accumulated Charge)

    GE_Low 

    This process will not commit the charge you counted to flash so the next time you boot you will start with 0. If right before GE_Low you send gauge stop command this will update flash and the next cycle will start with the previous value.

    The New Battery command will erase anything stored into flash. 

    Please add more details on what you are wanting the system to do. 

  • Hey Eric Vos,

    Every time the device (microcontroller) starts I want to begin with a new battery. After that it should be reading the accumulated capacity only for the active states. So right before the device is in sleep, I set the GE_Low for the gauge. When the device wakes I set the GE_High followed by the gauge start command. Before GE is Low I read the accumulated capacity again and so on. 

    The problem is that while starting the device (microcontroller) the new battery command seems to have no effect. Because I have been sending a gauge stop command before (thought I had to send the gauge stop command before setting GE_Low), and that data will not disappear.  

    Thank you,

    Jorg

  • Jorg,

    I just confirmed in the lab on my EVM. Sending the "New Battery Command" (Manufacturer Access Command (i2cWriteBlock(0xAA, 0x3E, [0x13, 0xA6])) will set the Accum charge register to 0. I tested in unsealed/sealed mode and with/without data stored in flash. This is also without needing a reset. 

    I think at this point you should check your setup to make sure the correct commands are being sent. 

    In addition i confirmed that skipping the [Gauge Stop] command will not commit any accumulated charge into flash, thus when GE pin goes low the device will boot without anything in the charge accum register. 

    Thanks,

    Eric Vos

  • Dear Eric Vos,

    Onyx told me the accumulated charge should increase. But for some reason unknown my accumulated capacity register begins at about 4.29e9 and then slowly discharges (decreases) every time current is used from the battery. I think this makes my problem more clear too. There are no errors or overflows found in the control register, so what is going wrong?

    Greetz,

    Jorg

  • Jorg,

    Please send me the full srec you are using. I have verified the functionality on the bench and do not fully understand the issue you are seeing.

    the accumulation counter will count up and down depending on the current direction. While primary cells should not see charge current in Accumulation mode the gauge does not care. 

    thanks,

    Eric Vos

  • Dear Eric Vos,

    The clear battery command works now! (timing issue...),

    But after the first discharge the accumulated charge value changes from 0 to 4294967287.

    Is it right to take that discharge value of 4294967287 off from 42949667295? (2^32-1)? To see how much charge is used.
    It makes sense since a uint32_t value is form 0 to 42949667295 and since discharging means decreasing, the accumulated charge wouldn't be able to be negative so then it decreases from 42949667295 to 0? If this assumption is right the problem is solved.

    Thanks for the help! 

    Jorg

  • Jorg,

    I would check your SRN/SRP connections if they are backwards or not (or maybe your calibration is reversed). it should count up for Dsg current. 

    Thanks,

    Eric Vos

  • Dear Eric Vos,

    Since I have no permissions to PM, I should answer over here again. I have checked the connections and they are correct. I have done no calibration yet, because there is no example code.  I'm using the typical application of the BQ35100.pdf. The battery is connected between BAT+ and the sense resistor. The microcontroller (load) is connected between BAT+ and PACK-. Since the CHEM_ID doesn't matter in ACC mode, I'm only changing the values of the battery to 17Ah to calculate the percentage left. It is a non rechargeable battery. The config A is changed to ACC mode. 

    This is the code for reading the AccumulatedCapacity(): 0x02/0x05 register:

    For reading a direct read command I use:

    uint16_t readRegister( uint8_t readRegister, uint8_t *bufferRead, uint16_t readRegisterSize )
    {
        uint16_t pData[2] = { 0 };
        pData[0] = readRegister & 0xFF;
        pData[1] = ( readRegister >> 8 ) & 0xFF;
    
        if ( I2cReadBuffer( &I2c, c_BQ35100I2CAddr, (uint16_t) ( pData[0] + pData[1] ), bufferRead,
                readRegisterSize )== FAIL )
        {
            printf( llerror, "readfromDataRegister: reading the register failed" );
            return FAIL;
        }
        DelayMs( 100 );
        return *bufferRead;
    }

    Then I use the read command in the following code:

    //Read the accumulated capacity
    uint8_t capacity[4] = { 0 };
    uint32_t accumulatedCapacity = 0;
    
    readRegister( BQ35100_READ_ACCUMALETED_CAPACITY, capacity, 4 );
    DelayMs( 100 );
    accumulatedCapacity = (( ( (uint8_t) capacity[3] << 24 ) + ( (uint8_t) capacity[2] << 16 ) + ( (uint8_t) capacity[1] << 8 ) + capacity[0] ));
    printf( lldebug, "Accumulated capacity read: %u uAh", (uint32_t) accumulatedCapacity );

    The "funny" thing is that the amount it decreases is pretty accurate. This is exactly the charge used by the BQ35100 + microcontroller. With some coding the IC is still useful. But because it should be increase, I don't trust it...

    I have been reading that there are more people with this problem:
    https://e2e.ti.com/support/power-management/f/196/t/793885?tisearch=e2e-sitesearch&keymatch=read%252525252520acc%252525252520bq35100
    But since Onyx only told him about the CHEM-ID is not needed for ACC mode, this forum is not useful for me. 

    Thank you for all the help!,

    Jorg

  • Jorg,

    The bq35100 will accumulate in both ways charge and discharge. Yes there is max value that it will roll around to if going in the reverse direction. Please connect a charge current for a while and see it counts one way, then apply a discharge current and see it counts the reverse side. 

    I would also connect to bqStudio and verify the values you are getting match the bqStudio values. 

    Thanks,

    Eric Vos