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.

BQ27220: How to update FCC register

Part Number: BQ27220
Other Parts Discussed in Thread: BQSTUDIO, GAUGEPARCAL, AM62A7

Hello TI,

          I am successfully  able to updated the Design Capacity of bq27220 from 3000mAh to 9000mAh but the FCC "Charge Full" parameter is still 3000mAh. 

One of your posts say that the FCC can not be updated manually, but learn with charging discharging cycle.

whereas the https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/641728/bq27220-simple-step-to-update-bq27220-fcc-value  post suggest that I need to update Learned Full Charge Capacity and Qmax Pack in data memory. But don't know how to update these registers.
 I don't have EVM board to cross verify the FCC parameter on BqStudio. 

Please Guide.

  • The gauge will update FCC automatically. However, it must be manually programmed for the *initial* configuration image. There is nothing unique about programming FCC vs. other parameters. So if you can update Design Capacity, the same basic process will also work for FCC.

  • Hello Dominik, 


    Thanks for your response, now I am able to change my FCC to 9000mAh. Can you please guide me regarding the State of Charge, Can I display my SOC as the battery percent. I have taken the readings for my battery discharge cycle, Bellow are the graphs for my battery discharge cycle.
       

    fig1:  Voltage VS capacity


    fig2 : Time Vs Voltage



    fig3 : time Vs Capacity

    My question is why there is sharp change in my capacity, as it has directly changed from 48 to 7 percent. Can you please guide me how do I calibrate my SOC, Is there any parameter I have to vary in order to get the correct percentage readings.

    Thanks & Regards,
    Monica    

  • You'll have to measure FCC (the gauge provides a coulomb count which you can use or you can integrate your load current over time) from full to empty. Use the register log to create a log file. You can then use software like Excel or Numbers to sum up (integrate) the current from a full charge to voltage dropping to EDV0.

    Once you have FCC then you can calculate the actual state of charge in this log file with SOC = 100*RM/FCC for every line in the log file.

    Look up the voltage for SOC = 7% (=EDV2) and the voltage for SOC = 3% (=EDV1) and write this, together with FCC to the gauge. Disable the CEDV option (automatic compensation of EDV) to 0 for testing.

    Once this works well, you can then program the CEDV coefficients from GAUGEPARCAL for CEDV https://www.ti.com/lit/ug/sluub45b/sluub45b.pdf and enable CEDV.

  • Hello Dominik,

    I calculated the SOC manually, which is coming approximately correct. As I don't have the evolution board for fuel gauge I can not  program the CEDV coefficients through GAUGEPARCAL. Then how should I enable or disable EDV_CMP. Please suggest whether above graphs are right or need calibration.

  • You can't use the automatic EDV compensation if you can't program the CEDV coefficients. Do you have the coefficients from GAUGEPARCAL? If so, you can use your host uC to program the coefficients via I2C. See 6.1 Data Memory Parameter Update Example, www.ti.com/.../sluubd4a.pdf

  • I have set bit SMEN=1, SMEXT=0 in the smoothing Config register (9271) but still didn't observed any smoothing in the graph, got the same response while discharging the capacity droped from 41% to 7%. What else need to be done for smoothing, How will SMTH bit in operation status register be set.


  • Smoothing isn't intended to smooth over a massive mismatch of FCC. If you SOC jumps from 41% to 7% at EDV2, then your FCC is not correct for your EDV2 setting. I recommend measuring passed charge from a full charge to voltage < EDV0. This will be your FCC. And then look up cell voltage for 93% passed charge (the 7% SOC point for EDV2) and 97% passed charge (the 3% SOC point for EDV1).

    This will fix your SOC jump problems.

  • " I recommend measuring passed charge from a full charge to voltage < EDV0." Can you explain in detail about this, The max observed Charge was 8357000 at 93%. Also, How can I read the values of smoothing config register. Please, tell me register address to read for smoothing config register.

  • 1. Start a full register log in bqStudio.

    2. Charge the cell to full. Make sure that the gauge detects a full charge (see TRM, 4.4.1 Detecting Charge Termination).

    3. Discharge the cell to EDV0.

    4. FCC is the raw coulomb count from a full charge to cell voltage = EDV0. You can get this info from the register log file.

    5. In a spreadsheet program (e.g. Excel), calculate the percentage of passed charge to FCC for each log line. Look up EDV2 (percentage = 93% passed charge) and EDV1 (percentage = 97% passed charge).

    CEDV smoothing configuration is available at these addresses:

  • Hi Dorminik,
    Whenever I try to setting SMTH bit in gauging config the FCC value do not gets updated or if FCC gets updated then SMTH bit is not set and viceversa. In the driver code I have followed the 16 steps in data memory parameter update for setting FCC and again 16 steps for smoothing Config and so on, for other parameters, Is this the correct way or can I set all the parameters altogether.

  • You can set consecutive parameters in one transaction but it's usually simpler to write a function on the host uC that performs updates for each parameter.

    This is a problem on your host uC, not bqStudio, right?

  • Hello Dominik,
       After setting parameters one by one i.e after entering and exiting the configuration update, the IC is not able to go to unseal after seal access.Which results in setting one parameter and not setting other,  

  • What are you doing in exact sequence?

  • Bellow is the log of the write operations :

    [    4.955207] bq27xxx_i2c: bq27xxx_battery_i2c_probe start...
    [    4.955239] bq27xxx_i2c: Name  - bq27541-0
    [    4.955247] bq27xxx_i2c: ID  - 0
    [    4.955254] bq27xxx_i2c: bq27xxx_battery_setup device already unsealed // Step 1
    [    5.109612] bq27xxx: Write Sequence - 0h ffh      // Step 2
    [    5.161218] bq27xxx: Write Sequence - 1h ffh
    [    5.212115] bq27xxx: Write Sequence - 0h ffh
    [    5.263239] bq27xxx: Write Sequence - 1h ffh
    [    5.315568] bq27xxx: Write Sequence - 0h 90h 0h  // Step 3 & 4
    [    5.784145] bq27xxx: Write Sequence - 3eh 9dh  // Step 5
    [    5.835316] bq27xxx: Write Sequence - 3fh 92h   // Step 6
    [    6.343722] bq27xxx: Write Sequence - 40h 1bh  // Step 10
    [    6.571091] bq27xxx: Write Sequence - 41h 58h

    [    6.801276] bq27xxx: Write Sequence - 60h 8dh  // Step 12
    [    7.004111] bq27xxx: Write Sequence - 61h 24h   // Step 13

    If I give step no. 14, 15 and 16 for the above sequence for FCC then, my DCAP is set to 9000mAh but FCC fails to set, giving FCC as 3000mAh instead of 9000mAh.


    [    7.213432] bq27xxx: Write Sequence - 0h 14h 4h
    [    7.214522] bq27xxx: Write Sequence - 0h 72h 36h
    [    7.369769] bq27xxx: Write Sequence - 0h ffh
    [    7.420911] bq27xxx: Write Sequence - 1h ffh
    [    7.472088] bq27xxx: Write Sequence - 0h ffh
    [    7.523318] bq27xxx: Write Sequence - 1h ffh
    [    7.577634] bq27xxx: Write Sequence - 0h 90h 0h
    [    7.784596] bq27xxx: Write Sequence - 3eh 9fh
    [    7.785205] bq27xxx: Write Sequence - 3fh 92h
    [    8.278369] bq27xxx: Write Sequence - 40h 1bh
    [    8.505673] bq27xxx: Write Sequence - 41h 58h
    [    8.734810] bq27xxx: Write Sequence - 60h f1h
    [    8.936107] bq27xxx: Write Sequence - 61h 24h
    [    9.037258] bq27xxx: Write Sequence - 0h 91h
    [    9.037867] bq27xxx: Write Sequence - 1h 0h
    [    9.038491] bq27xxx: Write Sequence - 0h 92h 0h
    [    9.092071] bq27xxx: Write Sequence - 0h 30h 0h
    [    9.248168] bq27xxx: Write Sequence - 0h 14h 4h
    [    9.249116] bq27xxx: Write Sequence - 0h 72h 36h
    [    9.360215] bq27xxx_i2c: bq27xxx_battery_setup returned 0

    After reading the operation status register I got to know that once the device gets sealed the FCC fails to set,I have to reboot the H/W in order to make FCC set.
              These modification's are made in the bq27xxx_battery.c driver code, with AM62A7 processor. Unable to Smooth the SOC, makes this fuel guage useless.



  • Hey Monica,

    Dominik is currently out of office, he will get back to you next week.

    Regards,

    Nick Richards

  • Hello,
    Any Update ?

  • Hey Monica,

    Dominik is still currently out of office, he should get back to you tomorrow.

    Regards,

    Nick Richards

  • The correct sequence to update FCC to 9000mAh is:

    9000mAh = 0x2328

    FCC is at address 0x929d

    Using your write format:

    1. Unseal the gauge.
    2. ENTER_CFG_UPDATE:
        0h 90h 0h
    3. Wait 100ms (or wait until CFGUPDATE bit in Operation Status is set)
    4. Write the following bytes starting at I2C register (command) 0x3e: FCC address in little endian followed by 9000mAh in hex big endian:
        3eh 9dh 92h 23h 28h
    5. Calculate the check-sum = 0xff - (0x9d + 0x92 + 0x23 + 0x28) & 0xff = 0xff - 0x7a = 0x85
    6. Write the check-sum and the total length starting at I2C register (command) 0x60:
        60h 85h 06h
    7. EXIT_CFG_UPDATE_REINIT
        0h 91h 0h

  • FCC got updated, please guide for Smoothing as well,  how will the SMTH bit set i.e setting FCC and smoothing bit together.

  • You can set any non-OTP and non-ROM register with the same sequence (which makes it easy to write a universal parameter update function for the gauge).

    Smoothing registers start at 0x9271. SMTH is a status bit that indicates if the gauge is scaled by the smoothing algorithm. You cannot set this bit directly.

    However, you can enable smoothing with Smoothing Config[SMEN] and select options in the same register (0x9271). See TRM 1.1.13 CEDV Smoothing, https://www.ti.com/lit/ug/sluubd4a/sluubd4a.pdf

  • i have set the SMTH bit at 0x9271 but still there is drop in state of charge ,it went 38 to 21 %

    Timestamp: 2024-05-08 18:50:21
    Voltage Now: 3617000          
    Capacity: 40                  
    Charge Full: 3000000          
    Charge Full Design: 3000000   
    Charge Now: 1176000           
                                  
    Timestamp: 2024-05-08 18:53:21
    Voltage Now: 3615000          
    Capacity: 39                  
    Charge Full: 3000000          
    Charge Full Design: 3000000   
    Charge Now: 1160000           
                                  
    Timestamp: 2024-05-08 18:56:22
    Voltage Now: 3613000          
    Capacity: 39                  
    Charge Full: 3000000          
    Charge Full Design: 3000000   
    Charge Now: 1145000           
                                  
    Timestamp: 2024-05-08 18:59:22
    Voltage Now: 3612000          
    Capacity: 38                  
    Charge Full: 3000000          
    Charge Full Design: 3000000   
    Charge Now: 1129000           
                                  
    Timestamp: 2024-05-08 19:02:22
    Voltage Now: 3609000          
    Capacity: 38                  
    Charge Full: 3000000          
    Charge Full Design: 3000000   
    Charge Now: 1114000           
                                  
    Timestamp: 2024-05-08 19:05:22
    Voltage Now: 3608000          
    Capacity: 21                  
    Charge Full: 3000000          
    Charge Full Design: 3000000   
    Charge Now: 622000            
                                  
    Timestamp: 2024-05-08 19:08:22
    Voltage Now: 3606000          
    Capacity: 21                  
    Charge Full: 3000000          
    Charge Full Design: 3000000   
    Charge Now: 606000          


    Is there any other bit(register) that can be set to reduce the drop in state of charge and make it stable?

  • There is no SMTH bit in 0x9271. Smoothing has many options, which is why I referred to the TRM. Please determine what smoothing features you like to use and I can confirm what bits you need to set.

  • SMTH bit is in operational status Register




    I have attached Smoothing bit which taken from TRM below, to avoid sudden drop 
    How and what to set?

  • Yes, SMTH is in Operation Status. It's a status bit, which the gauge sets when the smoothing algorithm starts scaling remaining capacity (and therefore SOC). It is not a configuration bit, hence you cannot set it.

    Your Smoothing Config is 0x08, which means that SMEN = 0 and smoothing is disabled.

    You need to set SMEN = 1 at the very least and choose SMEXT and SME0 depending on your application. See table 3-1 in the TRM. 

  • Hi Dominik we are following the same procedure as above

    (For FCC - 929d)

    : ENTER_CFG_UPDATE
        0h 90h 0h
    3. Wait 100ms (or wait until CFGUPDATE bit in Operation Status is set)
    4. Write the following bytes starting at I2C register (command) 0x3e: FCC address in little endian followed by 9000mAh in hex big endian:
        3eh 9dh 92h 23h 28h
    5. Calculate the check-sum = 0xff - (0x9d + 0x92 + 0x23 + 0x28) & 0xff = 0xff - 0x7a = 0x85
    6. Write the check-sum and the total length starting at I2C register (command) 0x60:
        60h 85h 06h
    7. EXIT_CFG_UPDATE_REINIT
        0h 91h 0h

    (For Gauging - 929b)
    1. Unseal the gauge.
    2. ENTER_CFG_UPDATE:
        0h 90h 0h
    3. Wait 100ms (or wait until CFGUPDATE bit in Operation Status is set)
    4. Write the following bytes starting at I2C register (command) 0x3e: FCC address in little endian followed by 9000mAh in hex big endian:
        3eh 9bh 92h 00h 08h
    5. Calculate the check-sum = 0xff - (0x9b + 0x92 + 0x00 + 0x08) & 0xff 
    6. Write the check-sum and the total length starting at I2C register (command) 0x60:
        60h 85h 06h
    7. EXIT_CFG_UPDATE_REINIT
        0h 91h 0h

    (For Fixed EDV2 - 2.99v)
    1. Unseal the gauge.
    2. ENTER_CFG_UPDATE:
        0h 90h 0h
    3. Wait 100ms (or wait until CFGUPDATE bit in Operation Status is set)
    4. Write the following bytes starting at I2C register (command) 0x3e: FCC address in little endian followed by 9000mAh in hex big endian:
        3eh bah 92h 23h 28h
    5. Calculate the check-sum = 0xff - (0xba + 0x92 + 0xob + 0xae) & 0xff

    6. Write the check-sum and the total length starting at I2C register (command) 0x60:
        60h 85h 06h
    7. EXIT_CFG_UPDATE_REINIT
        0h 91h 0h

    (FOR Fixed EDV1 - 2.75v)
    1. Unseal the gauge.
    2. ENTER_CFG_UPDATE:
        0h 90h 0h
    3. Wait 100ms (or wait until CFGUPDATE bit in Operation Status is set)
    4. Write the following bytes starting at I2C register (command) 0x3e: FCC address in little endian followed by 9000mAh in hex big endian:
        3eh b7h 92h 0ah beh
    5. Calculate the check-sum = 0xff - (0xb7 + 0x92 + 0x0a + 0xbe) & 0xff 
    6. Write the check-sum and the total length starting at I2C register (command) 0x60:
        60h 85h 06h
    7. EXIT_CFG_UPDATE_REINIT
        0h 91h 0h

    And same for FIxed EDV0 - 2.55v But while taking the discharge cycle my H/W gets rebooted at 3.387V, Sometimes it ets rebooted at 3.501V which shows that it is taking the default values of EDV and not the programmed value. 

    After running the above sequence in the i2c script, Sometimes some reg values are set and some are not and thus,takes default values. 
    Need proper guidences for setting multiple values.

  • Are you only using the observation that your H/W reboots as an indicator that the values haven't been written?

    You can update multiple parameters while the gauge is in CFG UPDATE mode (you do not have to exit cfg update mode after one parameter was updated).

    This gauge will automatically revert to default values if it resets (either via command or due to voltage dropping below a reset threshold).

    Please add code to read back the values after EXIT_CFG_UPDATE_REINIT.

    You can read a value with this simple sequence (the gauge does not have to be in CFG UPDATE mode but it must be unsealed):

    1. Write the address of the parameter to 0x3E and 0x3F
    2. Read the value from 0x40++

  • Thanks for help I am able to set the values and reading the same from 40/41 location, I have set Smoothing config register as (0x0f00),

    Smoothing Delta vlt as 100mV and Smoothing start voltage as 4.1V in my above code.

    But still the smoothing is not enabled and the SOC is dropping from 41% to 7%. How can we reduce the drop in state of charge, Please provide some proper solution. 

  • 41% to 7% is too high for the smoothing algorithm. It's intended to smooth a small gap. If your battery reaches EDV2 while the gauge thinks that SOC is still 41% then you will have to either change the Low Batt % (from 7% to 41%) or EDV2 or reduce FCC.

    See TRM, 1.1.3 for details.

  • How do I change Low Batt voltage from 7% to 41% ? Is there any register address or it read only 

  • You can write to the Battery Low % register under CEDV Configuration (0x9251). I don't recommend changing this to 41%. I recommend setting the FCC register and the EDV2 register to values that match the characteristics of your cell (so that SOC reaches 7% when cell voltage drops to EDV2).

    You can determine this by looking at the data from discharge from full to empty. Add up total passed charge (e.g. reading the raw coulomb count) from a full charge to the time that cell voltage drops to EDV0. This value is FCC. And then you look up the voltage when total passed charge was 93% of FCC. This is the 7% SOC point and the voltage at that point is EDV2. You can set EDV1 with the same method but total passed charge is 97% of FCC.

  • Tried setting Battery Low voltage to 30% for EDV2=3.5V but still showed 7% at 3.5V 

  • Did it jump to 7% or did it reach 7% at 3.5V?

  • It jumped from 50% to 7% Vlt at 50% was 3.564V and 7% was 3.558V

  • Please attach the full configuration.