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

Parents
  • 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

Reply
  • 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

Children
No Data
Related