nRF Fuel gauge SOC calculation issue

Hi!

I'm testing the application with the custom Battery pofile I generated with nPM PowerUP app.
During testing I found the issue with the SOC value calcultation depending on the charger connection state.

In case the MCU (nRF5340) is reset while USB is connected (with active charger), the SOC is calculated as follows (using the nPM1300 sample from the SDK, NCS v2.6.2):

*** Booting nRF Connect SDK v3.5.99-ncs1-3 ***
nRF Fuel Gauge version: 0.9.2
PMIC device ok
V: 4.116, I: -0.163, T: 25.41, SoC: 7.56, TTE: nan, TTF: nan
V: 4.116, I: -0.162, T: 25.41, SoC: 7.57, TTE: nan, TTF: nan
V: 4.121, I: -0.162, T: 25.41, SoC: 7.59, TTE: nan, TTF: nan
V: 4.121, I: -0.162, T: 25.41, SoC: 7.60, TTE: nan, TTF: nan

Yet in case the MCU is reset with USB disconnected, I get correct SOC predictions:

*** Booting nRF Connect SDK v3.5.99-ncs1-3 ***
nRF Fuel Gauge version: 0.9.2
PMIC device ok
V: 4.057, I: 0.007, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.057, I: 0.007, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.057, I: 0.007, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.062, I: 0.007, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.067, I: 0.007, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.140, I: -0.163, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.140, I: -0.163, T: 25.31, SoC: 100.00, TTE: nan, TTF: nan
V: 4.135, I: -0.163, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.145, I: -0.163, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.140, I: -0.163, T: 25.41, SoC: 100.00, TTE: nan, TTF: nan
V: 4.145, I: -0.163, T: 25.41, SoC: 100.00, TTE: nan, TTF: 9963

As you can see, according the the current direction in the log above, I've connected charger after the MCU reset and SOC value remains correct.

This issue leads to the incorrect device behavior during the OTA process, since it requires power supply to be connected (business logic) and perfroms reset to boot new FW.

Is there some bug of the algorithm or should I disable charger to call 

nrf_fuel_gauge_init();
and enable it again after that?

Thanks,
Anton

  • Hi

    There’s an updated Fuel Gauge library available with the latest NCS releases. I suggest upgrading to that version for the best experience.
    https://docs.nordicsemi.com/bundle/ncs-3.0.0-preview2/page/nrfxlib/nrf_fuel_gauge/README.html

    Initializing the Fuel Gauge while the battery is already charging and MCU is resetting can lead to inaccuracies, because the battery voltage response may fluctuate under load or the system might briefly reset both can contribute unfavorablely for initialization.

    It is best to initialize fuel gauge before enabling the charging process (as you already mentioned) or ideally when battery is at some rest condition. Anyway, its worth noting that the Fuel Gauge is designed to correct initialization errors over time as the battery discharges.

    Tharaka

  • Hi Tharaka,

    As I understand, in order to use a newer version of the fueal gauge library I have to upgrade the NCS version as well.
    Since this may lead to some changes/bugs in my codebase, this option is not preferred now.

    It is best to initialize fuel gauge before enabling the charging process (as you already mentioned) or ideally when battery is at some rest condition.

    Currently the charger is enabled in the overlay file:

    npm1300_ek_charger: charger {
    			compatible = "nordic,npm1300-charger";
    			term-microvolt = <4200000>;
    			term-warm-microvolt = <3600000>;
    			current-microamp = <480000>;
    			dischg-limit-microamp = <1000000>;
    			vbus-limit-microamp = <500000>;
    			thermistor-ohms = <10000>;
    			thermistor-beta = <3380>;
    			charging-enable;
    		};

    So will it be anough to leave this configuration (except "charging-enable" option) and activate charger via BCHGENABLESET register?
    Documentation also mentions that the following change must be done:

    "Once charging has started, host software must use register EVENTSBCHARGER0CLR to initialize battery charger events."

    And there might be another issue: once the OTA process is completed, the MCU will always be required to stop charging process, which is not desired.

    Anyway, I tried to disable the charging process just before reading data from nPM1300 and a call to "nrf_fuel_gauge_init()" and activating it again after that, but the results are still not correct.

    Is there anything else I could check? Maybe data processing interval?

    Thanks,
    Anton

  • Hi Anton

    I would like to have look at your battery model file. Can you share it ?  Also if possible the project folder created during the battery profiling process.

    Tharaka

  • Hi Anton

    Thanks for sharing the files. I had a quick look on the data.
    It appears that the battery resistance is unusually high and there’s a sudden 750 mV jump in voltage while charging just enabled during the battery profiling stage.



    Fully charged voltage, just after charge completion,is also 4.04V. 




    This is quite range considering the LiPo battery type you are using.This might also explain why the Fuel Gauge is estimating a lower capacity (around 440 mAh instead of a value quite closer to rated 600 mAh).
    Battery model estimates much higher internal resistance during profiling process.

    This is the reason you are seeing quite strange behaviour in the fuel gauge.

    From my experience this can happen due to several reasons,

    Incorrect Profiling Setup: If the battery was not properly connected to the Fuel Gauge board or if there were large contact/cable resistances, the measured voltage/current data could be distorted.

    Degraded Battery: A worn or damaged battery can exhibit increased internal resistance and abrupt voltage jumps.


    Ideal solution would be to repeat the profiling step with a fresh battery with proper connection to the nPM1300-EK + FG board.

    But not to keep you waiting for an another 48 hours i have attached you similar Pre-Profiled battery models to match your battery spec for early evaluations.

    600mAh_Models.zip


    You can initialize the FG even if the OTA process is completed, and charger is ON with these models.

    Also since you are using a older version of the FG library, i suggest you to call the Fuel Gauge initialization function nrf_fuel_gauge_init() everytime after a charge completion This ensures that the FG calculations are based on a stable, fully charged state, reducing any discrepancies caused by residual conditions from charging using this generic battery model and much accurate for discharge mode fuel gauge estimations.

    You could use the charge completion event (docs.nordicsemi.com/.../charger.html from the NPM1300 BCHGCHARGESTATUS register to trigger the fuel gauge reinitialization (nrf_fuel_gauge_init).

    Let me know if this helps. 

    Thanks !!

    Tharaka

Related