<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126401/npm1300-fuel-gauge-soc</link><description>Hi 
 
 Setup: nPM1300, nRF54L15-based board, SDK 2.9.2 
 
 I am trying to figure out how to use the nPM1300. 
 So far, I have not succeeded. Quite frequently, after power cycling my device, the SoC read from the fuel gauge, after rebooting, is quite different</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 Feb 2026 13:17:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126401/npm1300-fuel-gauge-soc" /><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/560915?ContentTypeID=1</link><pubDate>Wed, 11 Feb 2026 13:17:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e15af3a2-fd68-42a4-9ff6-93d087a556ab</guid><dc:creator>Audun</dc:creator><description>&lt;p&gt;Thanks for the details,&lt;/p&gt;
&lt;p&gt;I do have one more theory of what could have gone wrong. The state blob includes a pointer to the battery model. If this is no longer valid after you have changed the binary, the behavior would change.&lt;/p&gt;
&lt;p&gt;Can you try to update the pointer within the binary blob before passing it on to nrf_fuel_gauge_init()? I assume you have the data in RAM already.&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/sys/byteorder.h&amp;gt;

sys_put_le32(&amp;amp;battery_model, &amp;amp;fuel_gauge_state.fuel_gauge_state_buf[224]);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This API needs to be updated on our side to allow the battery model to be moved around. It&amp;#39;s inconvenient to require this pointer to be static across firmware updates.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Audun&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/560608?ContentTypeID=1</link><pubDate>Mon, 09 Feb 2026 08:12:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c27da90-0a26-4c65-99d1-254c3fa5f415</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Garrett&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry about the late update. Audun will get back to you when we have reproduced this on our end. Thank you for your patience.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/559802?ContentTypeID=1</link><pubDate>Wed, 28 Jan 2026 15:08:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a589ff5f-07e5-44dc-902e-b88942499764</guid><dc:creator>garrettb</dc:creator><description>&lt;p&gt;Hi Audun,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am using SDK 3.1.1. I use the same application when Flashing. Sometimes, I modify the application slightly (e.g. add one debug global variable). Always SDK 3.1.1.&lt;/p&gt;
&lt;p&gt;When I first posted this ticket I was using SDK 2.9.2, but I then upgraded to SDK 3.1.1 to use the&amp;nbsp;&lt;span&gt;nrf_fuel_gauge_state_get() function.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/559756?ContentTypeID=1</link><pubDate>Wed, 28 Jan 2026 09:06:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe15ad29-9892-4109-b290-8254bc1ddc0b</guid><dc:creator>Audun</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any problems with the code, although I have not tried running it yet.&lt;/p&gt;
&lt;p&gt;The `charging_active` boolean looks to be wrong due to the sign change of the current, but this does not look to have any practical implications in this function at least.&lt;/p&gt;
&lt;p&gt;From your previous reply it could be that the issue is due to an incompatibility with the stored state being used in different versions of the fuel gauge library. Could this be the case, or do you see the problem persist even when re-flashing using the same SDK version?&lt;/p&gt;
&lt;p&gt;If you still see the issue I will try running your code and debug further, and I&amp;#39;d like to check the potential version incompatibility of the state structs. You mentioned using SDK 2.9.2, but we did not add the state get/set functionality for fuel gauge until SDK 3.0.0. Did you use a more recent fuel gauge library in your SDK 2.9.2 project, or did I misunderstand the versioning?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Audun&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/559732?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 23:44:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ae7d937-6c3c-4aee-acc5-8c6a70c50dfe</guid><dc:creator>garrettb</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Am I not using the newer convention?&lt;/p&gt;
&lt;p&gt;My code is detailed above, but here is the important part:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret = read_sensors(charger, &amp;amp;voltage, &amp;amp;current, &amp;amp;temp, &amp;amp;chg_status);
	:
current = -current;
	:
soc = nrf_fuel_gauge_process(voltage, current, temp, delta, NULL);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The value &amp;quot;current&amp;quot; is inverted before making the call to&amp;nbsp;nrf_fuel_gauge_process().&lt;/p&gt;
&lt;p&gt;And, as I say, this seems works all the time, except when I re-Flash the system again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/559669?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 11:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0407e86-34cf-4bfe-8330-9f2d2e07e799</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Garrett&lt;/p&gt;
&lt;p&gt;It still seems like you&amp;#39;re using the old convention for the &lt;strong&gt;nrf_fuel_gauge_process&lt;/strong&gt;() function. Please try using a negative current variable and see if the issue still occurs.&lt;/p&gt;
&lt;p&gt;nrf_fuel_gauge_process(voltage, &lt;strong&gt;-&lt;/strong&gt;&lt;strong&gt;current&lt;/strong&gt;, temp, delta, NULL);&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/559409?ContentTypeID=1</link><pubDate>Thu, 22 Jan 2026 20:14:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a8c3687-6aed-49b9-89ac-ca862fabed18</guid><dc:creator>garrettb</dc:creator><description>&lt;p&gt;Hi Audun,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;I think I am using the current properly. Here are the two main functions I use - the init. function, which is called at the start of main (after restoring data from Flash, and initialising the I2C), and the update function, which is called every 5 seconds. Within the update function, there is a backup, of the fuel state data, to Flash every 10 minutes (for now). The code is very messy because I keep adding things / moving things / trying things etc.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int fuel_gauge_init(const struct device *charger, char *status_str, size_t status_str_len)
{
	struct sensor_value value;
	struct nrf_fuel_gauge_init_parameters parameters = {
		.model = &amp;amp;battery_model,
		.opt_params = NULL,
		.state = NULL,
	};
	float max_charge_current;
	float term_charge_current;
	int32_t chg_status;
    bool b_used_buf = false;
	int ret;

    status_str[0] = &amp;#39;\0&amp;#39;;

	ret = read_sensors(charger, &amp;amp;parameters.v0, &amp;amp;parameters.i0, &amp;amp;parameters.t0, &amp;amp;chg_status);
	if (ret &amp;lt; 0) {
		return ret;
	}

	/* Zephyr sensor API convention for Gauge current is negative=discharging,
	 * while nrf_fuel_gauge lib expects the opposite negative=charging
	 */
	parameters.i0 = -parameters.i0;

    /* Optional: low-voltage gate */
    if (parameters.v0 &amp;lt; BATTERY_V_OK_THRESHOLD) {
        LOG_INF(&amp;quot;Battery voltage too low on startup: V=%.3fV. Shutting down&amp;quot;, parameters.v0);
        battery_init_v_low = true;
    }
    
    /* Store charge nominal and termination current, needed for ttf calculation */
	sensor_channel_get(charger, SENSOR_CHAN_GAUGE_DESIRED_CHARGING_CURRENT, &amp;amp;value);
	max_charge_current = (float)value.val1 + ((float)value.val2 / 1000000);
	term_charge_current = max_charge_current / 10.f;

    if ( have valid feul state buffer data restored from Flash...) {
        parameters.state = fuel_gauge_state.fuel_gauge_state_buf;
        b_used_buf = true;
    } else {
        parameters.state = NULL;
    }

	ret = nrf_fuel_gauge_init(&amp;amp;parameters, NULL);
    if (ret &amp;lt; 0 &amp;amp;&amp;amp; parameters.state != NULL) {
        LOG_ERR(&amp;quot;Error: Could not initialise fuel gauge&amp;quot;);
        return ret;
    }
    // Output fuel state buffeR data to RTT:
    log_fuel_gauge_state_buffer(fuel_gauge_state.fuel_gauge_state_buf, sizeof(fuel_gauge_state.fuel_gauge_state_buf));
    LOG_INF(&amp;quot;FG init %s (used buf = %d)&amp;quot;, (parameters.state != NULL) ? &amp;quot;RESUME&amp;quot; : &amp;quot;FRESH&amp;quot;, b_used_buf);

	ret = nrf_fuel_gauge_ext_state_update(NRF_FUEL_GAUGE_EXT_STATE_INFO_CHARGE_CURRENT_LIMIT,
					      &amp;amp;(union nrf_fuel_gauge_ext_state_info_data){
						      .charge_current_limit = max_charge_current});
	if (ret &amp;lt; 0) {
		LOG_ERR(&amp;quot;Error: Could not set fuel gauge state&amp;quot;);
		return ret;
	}

	ret = nrf_fuel_gauge_ext_state_update(NRF_FUEL_GAUGE_EXT_STATE_INFO_TERM_CURRENT,
					      &amp;amp;(union nrf_fuel_gauge_ext_state_info_data){
						      .charge_term_current = term_charge_current});
	if (ret &amp;lt; 0) {
		LOG_ERR(&amp;quot;Error: Could not set fuel gauge state&amp;quot;);
		return ret;
	}

	ret = charge_status_inform(chg_status);
	if (ret &amp;lt; 0) {
		LOG_ERR(&amp;quot;Error: Could not set fuel gauge state&amp;quot;);
		return ret;
	}

	// Reference time, used when calculating elasped time, before next call to nrf_fuel_gauge_process()
	ref_time = k_uptime_get();

    return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int fuel_gauge_update(const struct device *charger, char *status_str, size_t status_str_len)
{
	static int32_t chg_status_prev;

	float voltage;
	float current;
	float temp;
	float soc;
	float tte;
	float ttf;
	float delta;
	int32_t chg_status;
	int ret;
    static uint16_t backup_cntr = 0;
    static bool b_first_time = true;

    status_str[0] = &amp;#39;\0&amp;#39;;

    ret = read_sensors(charger, &amp;amp;voltage, &amp;amp;current, &amp;amp;temp, &amp;amp;chg_status);

	if (ret &amp;lt; 0) {
		printk(&amp;quot;Error: Could not read from charger device\n&amp;quot;);
		return ret;
	}
	/* Zephyr sensor API convention for Gauge current is negative=discharging,
	 * while nrf_fuel_gauge lib expects the opposite negative=charging
	 */
	current = -current;

    /* Charging active: signed current (negative = charging) */
    bool charging_active = (current &amp;lt; -0.005f);   // -5 mA threshold

    // Update vbus connected
    ret = sensor_attr_get(charger, SENSOR_CHAN_CURRENT, SENSOR_ATTR_UPPER_THRESH, &amp;amp;sens_val);
    if (ret &amp;lt; 0) {
        return false;
    }    
	vbus_connected = (sens_val.val1 != 0) || (sens_val.val2 != 0);

    b_usb_connected = vbus_connected;   // TODO: tidy this up!

    ret = nrf_fuel_gauge_ext_state_update(
		vbus_connected ? NRF_FUEL_GAUGE_EXT_STATE_INFO_VBUS_CONNECTED
			       : NRF_FUEL_GAUGE_EXT_STATE_INFO_VBUS_DISCONNECTED,
		NULL);
	if (ret &amp;lt; 0) {
		printk(&amp;quot;Error: Could not inform of state\n&amp;quot;);
		return ret;
	}

	if (chg_status != chg_status_prev) {
		chg_status_prev = chg_status;

		ret = charge_status_inform(chg_status);
		if (ret &amp;lt; 0) {
			printk(&amp;quot;Error: Could not inform of charge status\n&amp;quot;);
			return ret;
		}
	}

	delta = (float)k_uptime_delta(&amp;amp;ref_time) / 1000.f;

	/* Zephyr sensor API convention for Gauge current is negative=discharging,
	 * while nrf_fuel_gauge lib expects the opposite negative=charging
	 */
	soc = nrf_fuel_gauge_process(voltage, current, temp, delta, NULL);
	tte = nrf_fuel_gauge_tte_get();
	ttf = nrf_fuel_gauge_ttf_get();

    // Update globals
    battery_charging = charging_active;
    battery_soc = (uint8_t)soc;
    batt_voltage = voltage;


    // Sanity check
    if (b_first_time) {
        b_first_time = false;
        if ((soc == 0.0f) || (soc == 99.0f)) {
            LOG_INF(&amp;quot;fuel_gauge_update - re-initialising fuel gauge&amp;quot;);
            ret = fuel_gauge_re_init(charger, status_str, status_str_len);
            if (ret &amp;lt; 0) {
                LOG_ERR(&amp;quot;fuel_gauge_update - re-init failed&amp;quot;);
                return ret;
            }
        }
    }

    (void)snprintf(status_str, status_str_len, &amp;quot;dt:%.3f V:%.3f I:%.3f T:%.2f SoC:%.2f TTE:%.0f TTF:%.0f chg:%d st:%d  vbus=%d&amp;quot;,
        (double)delta, (double)voltage, (double)current, (double)temp,
        (double)soc, (double)tte, (double)ttf,
        (int)charging_active, (int)chg_status, vbus_connected);


    backup_cntr = (backup_cntr + 1) % BATTERY_SAVE_CNTR;
    if (backup_cntr == 0) {
	    // Save fuel state data in Flash, every 10 minutes...
        ret = nrf_fuel_gauge_state_get(fuel_gauge_state.fuel_gauge_state_buf, sizeof(fuel_gauge_state.fuel_gauge_state_buf));

        if (ret == 0) {
            fuel_gauge_state.fg_valid = true;
            log_fuel_gauge_state_buffer(fuel_gauge_state.fuel_gauge_state_buf, sizeof(fuel_gauge_state.fuel_gauge_state_buf));
            file_save_fg();
            LOG_INF(&amp;quot;FG state saved (size = %d)&amp;quot;, sizeof(fuel_gauge_state.fuel_gauge_state_buf));
        } else {
            fuel_gauge_state.fg_valid = false;
            LOG_WRN(&amp;quot;FG state_get bad (ret=%d, where 0=success). Not saving.&amp;quot;, ret);
        }
    }

	return 0;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/559331?ContentTypeID=1</link><pubDate>Thu, 22 Jan 2026 09:28:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f977231-6506-4bc0-b422-419be07a3d84</guid><dc:creator>Audun</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/garrettb"&gt;garrettb&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m one of the fuel gauge developers, and I have been trying to recreate the issue based on the state memory you have sent.&lt;/p&gt;
&lt;p&gt;Which polarity are you using for the current measurement? Upstream zephyr changed the convention used in the sensor API, such that negative currents is used for battery &lt;strong&gt;discharging&lt;/strong&gt;.The fuel gauge API still treats negative currents as battery &lt;strong&gt;charging&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I have been able to recreate the behavior (soc = 0.00) by using the old convention:&lt;/p&gt;
&lt;p&gt;(initialization and printouts omitted for code clarity)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Fuel gauge initialization done using provided state memory */

while (true) {
	voltage = 3.847f;
	current = 0.029f;
	temp = 24.79f;
	delta = 5.0f;

	soc = nrf_fuel_gauge_process(voltage, current, temp, delta, NULL);

	k_msleep(100); // Iterate fast to trigger soc=0.00 issue
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1769073877981v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;If I use the new convention I have not been able to trigger the issue:&lt;/p&gt;
&lt;p&gt;(note the negative current in `nrf_fuel_gauge_process()`&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Fuel gauge initialization done using provided state memory */

while (true) {
	voltage = 3.847f;
	current = 0.029f;
	temp = 24.79f;
	delta = 5.0f;

	soc = nrf_fuel_gauge_process(voltage, -current, temp, delta, NULL);

	k_msleep(100); // Iterate fast to trigger soc=0.00 issue
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Could this be the problem on your side?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Audun&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/559218?ContentTypeID=1</link><pubDate>Wed, 21 Jan 2026 06:22:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3cc6780-a167-49bc-a7c4-20e23e2ee12a</guid><dc:creator>garrettb</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;The same thing occurred just now as I tested DFU.&lt;/p&gt;
&lt;p&gt;I flashed my device with an older version of my project (built using SDK 2.9.2).&lt;/p&gt;
&lt;p&gt;With my latest project (SDK 3.1.1), I created two .bin files - the difference being an extra global debug counter which is incremented in one of the functions - just to be different, no other reason.&lt;/p&gt;
&lt;p&gt;I used Nordic&amp;#39;s Device Manager to flash the remote device, with the first .bin file. All went well. SoC remained almost the same (90%). I then reset the device, checked everything, and used Device Manager to send the second .bin file. When the upload was complete, the SoC was now zero.&lt;/p&gt;
&lt;p&gt;I then repeated the above test with two new .bin files (SDK 13.1.1). This time, as well as one of the builds using a debug counter, I also changed the Magic Number used for validating the Fuel Gauge state. So the two .bin files had different magic numbers. I flashed the device (using VSCode) with the 2.9.2 project then used Device Manager to send the first .bin file. All good. SoC is about 90%. I then used Device Manager to send the second bin file. Again, all good. Because this time, the device did NOT use the restored state buffer (256 bytes), when initialising the fuel gauge.&lt;/p&gt;
&lt;p&gt;So it seems, for now, until this is solved, I have to change the magic number associated with teh saved fuel gauge state, every time I send a new .bin file out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/558933?ContentTypeID=1</link><pubDate>Sat, 17 Jan 2026 20:41:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce73a0b6-9cca-4931-b4c2-86bee93d806f</guid><dc:creator>garrettb</dc:creator><description>&lt;p&gt;I upgraded the project to use SDK 3.1.1, so the firmware could take advantage of the nrf_fuel_gauge_state_get() function.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What the firmware does&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For test purposes, once every minute it calls nrf_fuel_gauge_state_get(), saving the contents to a 256 byte buffer.&lt;br /&gt;Whenever the device is going to shutdown (nPM1300, ship mode), it first saves the fuel gauge state information to Flash, and restores this on boot up.&lt;br /&gt;Generally, this setup has been working for a few days for me &amp;ndash; I have observed the same SoC being restored on boot, as was saved on the previous shutdown.&lt;br /&gt;Note: When saving data to Flash before shutdown, there is a 3 second delay after saving, before shutdown (shipmode).&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;However, what I have noticed is that sometimes, after flashing the device, the restored SoC goes to zero.&lt;/p&gt;
&lt;p&gt;This has happened while re-flashing the same hex file as was currently running on the device. See step 8 below.&lt;br /&gt;In this example, the hex file was different (I added a global variable, and incremented it in one function, just to change the memory layout of the code). But I have also observed this phenomenon when re-flashing the same hex file.&lt;br /&gt;Also, notice that the fuel gauge state buffer contents are the same for step6 and step 8.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is what is saved in Flash. The magic number helps the firmware determine if the contents are valid or not.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define FG_MAGIC 12344321u
#define FG_STATE_BUF_SIZE 256
typedef struct
{
    int magic;
    bool fg_valid;
    uint8_t fuel_gauge_state_buf[FG_STATE_BUF_SIZE];
} imme_fuelgauge_state__t;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Saving to Flash:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret = nrf_fuel_gauge_state_get(fuel_gauge_state.fuel_gauge_state_buf, sizeof(fuel_gauge_state.fuel_gauge_state_buf));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Restoring from Flash:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	rc = nvs_read(&amp;amp;fs, FUEL_GAUGE_STATE_ID, &amp;amp;fuel_gauge_state_saved, sizeof(fuel_gauge_state_saved));
	if (rc &amp;gt; 0) { 		
		// item was found, show it
        if (fuel_gauge_state_exists()) {
            LOG_INF(&amp;quot;FUEL_GAUGE_STATE_ID: Saved data valid (rc = %d, magic %d, valid %d) - restoring&amp;quot;, rc, fuel_gauge_state_saved.magic, fuel_gauge_state_saved.fg_valid);
            fuel_gauge_state = fuel_gauge_state_saved;
            log_fuel_gauge_state_buffer(fuel_gauge_state.fuel_gauge_state_buf, sizeof(fuel_gauge_state.fuel_gauge_state_buf));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Initialising the fuel gauge:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	ret = read_sensors(charger, &amp;amp;parameters.v0, &amp;amp;parameters.i0, &amp;amp;parameters.t0, &amp;amp;chg_status);
	if (ret &amp;lt; 0) {
		return ret;
	}
	parameters.i0 = -parameters.i0;

    if (parameters.v0 &amp;lt; BATTERY_V_OK_THRESHOLD) {
        LOG_INF(&amp;quot;Battery voltage too low on startup: V=%.3fV. Shutting down&amp;quot;, parameters.v0);
        battery_init_v_low = true;
    }
    
	sensor_channel_get(charger, SENSOR_CHAN_GAUGE_DESIRED_CHARGING_CURRENT, &amp;amp;value);
	max_charge_current = (float)value.val1 + ((float)value.val2 / 1000000);
	term_charge_current = max_charge_current / 10.f;

    if (fuel_gauge_state.fg_valid &amp;amp;&amp;amp;
        fuel_gauge_state_exists() &amp;amp;&amp;amp;
        (nrf_fuel_gauge_state_size &amp;lt;= sizeof(fuel_gauge_state.fuel_gauge_state_buf))) {
        parameters.state = fuel_gauge_state.fuel_gauge_state_buf;
        b_used_buf = true;
    } else {
        parameters.state = NULL;
    }

	ret = nrf_fuel_gauge_init(&amp;amp;parameters, NULL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The firmware then outputs the contents of fuel_gauge_state.fuel_gauge_state_buf, and I can confirm that the contents are the same, as expected (and the b_used_buf indicates that the fuel gauge state buffer was used in the initialisation).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Can you explain this behaviour / can you see if I am doing anything wrong?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is an example:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Before shipmode, Fuel Gauge state is saved, when SoC was approx. &lt;strong&gt;89.03&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br /&gt;Contents after restore (missed some of the RTT output):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.288,940] &amp;lt;inf&amp;gt; fuel_gauge: [080-095]: 00 00 A0 40 00 00 48 42 00 00 F0 41 33 33 73 3F
[00:00:00.306,518] &amp;lt;inf&amp;gt; fuel_gauge: [096-111]: 66 66 A6 3F 00 00 80 3F 00 00 70 42 00 00 C0 3F
[00:00:00.324,066] &amp;lt;inf&amp;gt; fuel_gauge: [112-127]: 66 66 66 3F 33 33 73 3F 7A 6E 21 BC 00 00 00 00
[00:00:00.341,674] &amp;lt;inf&amp;gt; fuel_gauge: [128-143]: 2B 87 76 40 00 00 C0 7F 7A 6E 21 BC 00 00 C8 41
[00:00:00.359,313] &amp;lt;inf&amp;gt; fuel_gauge: [144-159]: 85 E9 63 3F 00 00 00 00 EC 51 18 3F 00 00 C0 7F
[00:00:00.376,861] &amp;lt;inf&amp;gt; fuel_gauge: [160-175]: 85 E9 63 3F 1B 82 82 46 09 60 A0 B8 00 00 C8 41
[00:00:00.394,470] &amp;lt;inf&amp;gt; fuel_gauge: [176-191]: 00 00 C8 41 01 00 00 00 00 00 40 40 00 00 80 40
[00:00:00.412,048] &amp;lt;inf&amp;gt; fuel_gauge: [192-207]: EE 54 36 3C CB 95 40 3C 00 00 00 00 85 E9 63 3F
[00:00:00.429,656] &amp;lt;inf&amp;gt; fuel_gauge: [208-223]: E9 03 AE 40 E9 03 AE 40 D8 02 AE 40 D8 02 AE 40
[00:00:00.447,296] &amp;lt;inf&amp;gt; fuel_gauge: [224-239]: 78 D2 05 00 34 12 CD AB 00 00 00 00 00 00 00 00
[00:00:00.464,904] &amp;lt;inf&amp;gt; fuel_gauge: [240-255]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;SoC restored at&lt;strong&gt; 89.03&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[00:00:04.736,328] &amp;lt;inf&amp;gt; Charger update: dt:2.470 V:3.906 I:0.018 T:23.98 SoC:&lt;/span&gt;&lt;strong&gt;89.03&lt;/strong&gt;&lt;span&gt;&amp;nbsp;TTE:nan TTF:nan chg:0 st:0 vbus=0, full=0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;br /&gt;One minute later, save state when SoC is approx. &lt;strong&gt;88.80&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:59.776,428] &amp;lt;inf&amp;gt; fuel_gauge: [000-015]: 00 00 80 3F 00 00 00 40 D9 52 24 37 26 60 47 37
[00:00:59.794,067] &amp;lt;inf&amp;gt; fuel_gauge: [016-031]: 00 00 00 00 93 7B DE B6 26 60 47 37 50 8A 74 37
[00:00:59.811,584] &amp;lt;inf&amp;gt; fuel_gauge: [032-047]: 00 00 00 00 97 1F 06 B7 00 00 00 00 00 00 00 00
[00:00:59.829,071] &amp;lt;inf&amp;gt; fuel_gauge: [048-063]: 77 CC 2B 32 00 00 00 00 88 7B DE B6 97 1F 06 B7
[00:00:59.846,557] &amp;lt;inf&amp;gt; fuel_gauge: [064-079]: 00 00 00 00 8F 01 7B 37 A6 9B 44 3B 6F 12 83 3A
[00:00:59.864,044] &amp;lt;inf&amp;gt; fuel_gauge: [080-095]: 00 00 A0 40 00 00 48 42 00 00 F0 41 33 33 73 3F
[00:00:59.881,530] &amp;lt;inf&amp;gt; fuel_gauge: [096-111]: 66 66 A6 3F 00 00 80 3F 00 00 70 42 00 00 C0 3F
[00:00:59.899,017] &amp;lt;inf&amp;gt; fuel_gauge: [112-127]: 66 66 66 3F 33 33 73 3F 7A 6E 21 3C 00 00 00 00
[00:00:59.916,503] &amp;lt;inf&amp;gt; fuel_gauge: [128-143]: 39 B4 78 40 00 00 C0 7F 7A 6E 21 3C 00 00 C8 41
[00:00:59.933,990] &amp;lt;inf&amp;gt; fuel_gauge: [144-159]: 73 2D 63 3F 00 00 00 00 48 E1 65 42 85 E9 63 3F
[00:00:59.951,477] &amp;lt;inf&amp;gt; fuel_gauge: [160-175]: 00 00 C0 7F 00 00 C0 7F 48 DF 69 B8 00 00 C8 41
[00:00:59.968,963] &amp;lt;inf&amp;gt; fuel_gauge: [176-191]: 00 00 C8 41 01 00 00 00 00 00 40 40 00 00 80 40
[00:00:59.986,663] &amp;lt;inf&amp;gt; fuel_gauge: [192-207]: DD 29 14 3C F0 6D 1B 3C 00 00 00 00 73 2D 63 3F
[00:01:00.004,150] &amp;lt;inf&amp;gt; fuel_gauge: [208-223]: E9 03 AE 40 E9 03 AE 40 CC 02 AE 40 CC 02 AE 40
[00:01:00.021,636] &amp;lt;inf&amp;gt; fuel_gauge: [224-239]: 78 D2 05 00 34 12 CD AB 00 00 00 00 00 00 00 00
[00:01:00.039,154] &amp;lt;inf&amp;gt; fuel_gauge: [240-255]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;br /&gt;15 seconds later (SoC approx. &lt;strong&gt;88.59&lt;/strong&gt;), flash in SAME hex file, while device still running.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;br /&gt;On boot, after flash restore, contents:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.209,808] &amp;lt;inf&amp;gt; fuel_gauge: [016-031]: 00 00 00 00 93 7B DE B6 26 60 47 37 50 8A 74 37
[00:00:00.227,447] &amp;lt;inf&amp;gt; fuel_gauge: [032-047]: 00 00 00 00 97 1F 06 B7 00 00 00 00 00 00 00 00
[00:00:00.244,995] &amp;lt;inf&amp;gt; fuel_gauge: [048-063]: 77 CC 2B 32 00 00 00 00 88 7B DE B6 97 1F 06 B7
[00:00:00.262,573] &amp;lt;inf&amp;gt; fuel_gauge: [064-079]: 00 00 00 00 8F 01 7B 37 A6 9B 44 3B 6F 12 83 3A
[00:00:00.280,212] &amp;lt;inf&amp;gt; fuel_gauge: [080-095]: 00 00 A0 40 00 00 48 42 00 00 F0 41 33 33 73 3F
[00:00:00.297,821] &amp;lt;inf&amp;gt; fuel_gauge: [096-111]: 66 66 A6 3F 00 00 80 3F 00 00 70 42 00 00 C0 3F
[00:00:00.315,399] &amp;lt;inf&amp;gt; fuel_gauge: [112-127]: 66 66 66 3F 33 33 73 3F 7A 6E 21 3C 00 00 00 00
[00:00:00.332,977] &amp;lt;inf&amp;gt; fuel_gauge: [128-143]: 39 B4 78 40 00 00 C0 7F 7A 6E 21 3C 00 00 C8 41
[00:00:00.350,555] &amp;lt;inf&amp;gt; fuel_gauge: [144-159]: 73 2D 63 3F 00 00 00 00 48 E1 65 42 85 E9 63 3F
[00:00:00.368,194] &amp;lt;inf&amp;gt; fuel_gauge: [160-175]: 00 00 C0 7F 00 00 C0 7F 48 DF 69 B8 00 00 C8 41
[00:00:00.385,803] &amp;lt;inf&amp;gt; fuel_gauge: [176-191]: 00 00 C8 41 01 00 00 00 00 00 40 40 00 00 80 40
[00:00:00.403,350] &amp;lt;inf&amp;gt; fuel_gauge: [192-207]: DD 29 14 3C F0 6D 1B 3C 00 00 00 00 73 2D 63 3F
[00:00:00.420,928] &amp;lt;inf&amp;gt; fuel_gauge: [208-223]: E9 03 AE 40 E9 03 AE 40 CC 02 AE 40 CC 02 AE 40
[00:00:00.438,568] &amp;lt;inf&amp;gt; fuel_gauge: [224-239]: 78 D2 05 00 34 12 CD AB 00 00 00 00 00 00 00 00
[00:00:00.456,176] &amp;lt;inf&amp;gt; fuel_gauge: [240-255]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;SoC restored to &lt;strong&gt;88.68&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;[00:00:04.727,203] &amp;lt;inf&amp;gt; iCharger update: dt:2.470 V:3.867 I:0.010 T:24.59 SoC:&lt;strong&gt;88.68&lt;/strong&gt; TTE:nan TTF:nan chg:0 st:0 vbus=0, full=0&lt;br /&gt;Step 6&lt;/p&gt;
&lt;p&gt;One minute later, save state when SoC is approx.&lt;strong&gt; 88.33&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:59.767,608] &amp;lt;inf&amp;gt; fuel_gauge: [000-015]: 00 00 80 3F 00 00 00 40 97 45 25 37 56 A0 48 37
[00:00:59.785,095] &amp;lt;inf&amp;gt; fuel_gauge: [016-031]: 00 00 00 00 40 1E E7 B6 56 A0 48 37 AA 20 76 37
[00:00:59.802,612] &amp;lt;inf&amp;gt; fuel_gauge: [032-047]: 00 00 00 00 A7 A3 0A B7 00 00 00 00 00 00 00 00
[00:00:59.820,068] &amp;lt;inf&amp;gt; fuel_gauge: [048-063]: 77 CC 2B 32 00 00 00 00 34 1E E7 B6 A6 A3 0A B7
[00:00:59.837,554] &amp;lt;inf&amp;gt; fuel_gauge: [064-079]: 00 00 00 00 BA AF 78 37 A6 9B 44 3B 6F 12 83 3A
[00:00:59.855,041] &amp;lt;inf&amp;gt; fuel_gauge: [080-095]: 00 00 A0 40 00 00 48 42 00 00 F0 41 33 33 73 3F
[00:00:59.872,772] &amp;lt;inf&amp;gt; fuel_gauge: [096-111]: 66 66 A6 3F 00 00 80 3F 00 00 70 42 00 00 C0 3F
[00:00:59.890,258] &amp;lt;inf&amp;gt; fuel_gauge: [112-127]: 66 66 66 3F 33 33 73 3F 5D 16 93 3C 00 00 00 00
[00:00:59.907,745] &amp;lt;inf&amp;gt; fuel_gauge: [128-143]: EE 7C 77 40 AC 60 64 46 5D 16 93 3C 00 00 C8 41
[00:00:59.925,231] &amp;lt;inf&amp;gt; fuel_gauge: [144-159]: F9 0F 62 3F 00 00 00 00 48 E1 E5 42 85 E9 63 3F
[00:00:59.942,718] &amp;lt;inf&amp;gt; fuel_gauge: [160-175]: 00 00 C0 7F AC 60 64 46 FE B6 81 B8 00 00 C8 41
[00:00:59.960,205] &amp;lt;inf&amp;gt; fuel_gauge: [176-191]: 00 00 C8 41 01 00 00 00 00 00 40 40 00 00 80 40
[00:00:59.977,905] &amp;lt;inf&amp;gt; fuel_gauge: [192-207]: 5F 16 1B 3C 76 A9 26 3C 00 00 00 00 F9 0F 62 3F
[00:00:59.995,391] &amp;lt;inf&amp;gt; fuel_gauge: [208-223]: E9 03 AE 40 E9 03 AE 40 C0 02 AE 40 C0 02 AE 40
[00:01:00.012,878] &amp;lt;inf&amp;gt; fuel_gauge: [224-239]: 78 D2 05 00 34 12 CD AB 00 00 00 00 00 00 00 00
[00:01:00.030,395] &amp;lt;inf&amp;gt; fuel_gauge: [240-255]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 7&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;30 seconds later (SoC approx. &lt;strong&gt;88.11&lt;/strong&gt;), flash in DIFFERENT hex file, while device still running.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 8&lt;/strong&gt;&lt;br /&gt;On boot, after flash restore, contents:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.176,086] &amp;lt;inf&amp;gt; fuel_gauge: [000-015]: 00 00 80 3F 00 00 00 40 97 45 25 37 56 A0 48 37
[00:00:00.193,603] &amp;lt;inf&amp;gt; fuel_gauge: [016-031]: 00 00 00 00 40 1E E7 B6 56 A0 48 37 AA 20 76 37
[00:00:00.211,212] &amp;lt;inf&amp;gt; fuel_gauge: [032-047]: 00 00 00 00 A7 A3 0A B7 00 00 00 00 00 00 00 00
[00:00:00.228,759] &amp;lt;inf&amp;gt; fuel_gauge: [048-063]: 77 CC 2B 32 00 00 00 00 34 1E E7 B6 A6 A3 0A B7
[00:00:00.246,307] &amp;lt;inf&amp;gt; fuel_gauge: [064-079]: 00 00 00 00 BA AF 78 37 A6 9B 44 3B 6F 12 83 3A
[00:00:00.263,885] &amp;lt;inf&amp;gt; fuel_gauge: [080-095]: 00 00 A0 40 00 00 48 42 00 00 F0 41 33 33 73 3F
[00:00:00.281,433] &amp;lt;inf&amp;gt; fuel_gauge: [096-111]: 66 66 A6 3F 00 00 80 3F 00 00 70 42 00 00 C0 3F
[00:00:00.299,011] &amp;lt;inf&amp;gt; fuel_gauge: [112-127]: 66 66 66 3F 33 33 73 3F 5D 16 93 3C 00 00 00 00
[00:00:00.316,558] &amp;lt;inf&amp;gt; fuel_gauge: [128-143]: EE 7C 77 40 AC 60 64 46 5D 16 93 3C 00 00 C8 41
[00:00:00.334,136] &amp;lt;inf&amp;gt; fuel_gauge: [144-159]: F9 0F 62 3F 00 00 00 00 48 E1 E5 42 85 E9 63 3F
[00:00:00.351,684] &amp;lt;inf&amp;gt; fuel_gauge: [160-175]: 00 00 C0 7F AC 60 64 46 FE B6 81 B8 00 00 C8 41
[00:00:00.369,293] &amp;lt;inf&amp;gt; fuel_gauge: [176-191]: 00 00 C8 41 01 00 00 00 00 00 40 40 00 00 80 40
[00:00:00.386,840] &amp;lt;inf&amp;gt; fuel_gauge: [192-207]: 5F 16 1B 3C 76 A9 26 3C 00 00 00 00 F9 0F 62 3F
[00:00:00.404,418] &amp;lt;inf&amp;gt; fuel_gauge: [208-223]: E9 03 AE 40 E9 03 AE 40 C0 02 AE 40 C0 02 AE 40
[00:00:00.422,027] &amp;lt;inf&amp;gt; fuel_gauge: [224-239]: 78 D2 05 00 34 12 CD AB 00 00 00 00 00 00 00 00
[00:00:00.439,605] &amp;lt;inf&amp;gt; fuel_gauge: [240-255]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;SoC is now &lt;strong&gt;zero&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;[00:00:09.708,831] &amp;lt;inf&amp;gt; Charger update: dt:5.000 V:3.847 I:0.029 T:24.79 &lt;strong&gt;SoC:0.00&lt;/strong&gt; TTE:nan TTF:nan chg:0 st:0 vbus=0, full=0&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Step 9&lt;/strong&gt;&lt;br /&gt;Device entered shipmode approx. 1 minute later (firmware logic, because SoC is zero), and FG state buffer contents were:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:54.844,238] &amp;lt;inf&amp;gt; fuel_gauge: [000-015]: 00 00 80 3F 00 00 00 40 FF FF FF 7F FF FF FF 7F
[00:00:54.861,694] &amp;lt;inf&amp;gt; fuel_gauge: [016-031]: FF FF FF 7F FF FF FF 7F FF FF FF 7F FF FF FF 7F
[00:00:54.879,150] &amp;lt;inf&amp;gt; fuel_gauge: [032-047]: FF FF FF 7F FF FF FF 7F FF FF FF 7F FF FF FF 7F
[00:00:54.896,728] &amp;lt;inf&amp;gt; fuel_gauge: [048-063]: FF FF FF 7F FF FF FF 7F FF FF FF 7F FF FF FF 7F
[00:00:54.914,337] &amp;lt;inf&amp;gt; fuel_gauge: [064-079]: FF FF FF 7F FF FF FF 7F 9A 99 99 3E BD 37 86 35
[00:00:54.931,823] &amp;lt;inf&amp;gt; fuel_gauge: [080-095]: 00 00 A0 40 00 00 48 42 00 00 F0 41 33 33 73 3F
[00:00:54.949,279] &amp;lt;inf&amp;gt; fuel_gauge: [096-111]: 66 66 A6 3F 00 00 80 3F 00 00 70 42 00 00 C0 3F
[00:00:54.966,735] &amp;lt;inf&amp;gt; fuel_gauge: [112-127]: 66 66 66 3F 33 33 73 3F 27 BC 84 BC 00 00 00 00
[00:00:54.984,191] &amp;lt;inf&amp;gt; fuel_gauge: [128-143]: 68 91 75 40 00 00 C0 7F 27 BC 84 BC 00 00 C8 41
[00:00:55.001,678] &amp;lt;inf&amp;gt; fuel_gauge: [144-159]: 00 00 00 00 00 00 00 00 68 91 ED 3D 00 00 C0 7F
[00:00:55.019,165] &amp;lt;inf&amp;gt; fuel_gauge: [160-175]: 00 00 00 00 B1 30 59 46 EB 13 9C BB 00 00 C8 41
[00:00:55.036,621] &amp;lt;inf&amp;gt; fuel_gauge: [176-191]: 00 00 C8 41 01 00 00 00 00 00 40 40 00 00 80 40
[00:00:55.054,107] &amp;lt;inf&amp;gt; fuel_gauge: [192-207]: FF FF FF FF FF FF FF FF 00 00 80 BF 00 00 00 00
[00:00:55.071,563] &amp;lt;inf&amp;gt; fuel_gauge: [208-223]: E9 03 AE 40 54 61 D1 3A B4 02 AE 40 B4 02 AE 40
[00:00:55.089,019] &amp;lt;inf&amp;gt; fuel_gauge: [224-239]: 78 D2 05 00 34 12 CD AB 00 00 00 00 00 00 00 00
[00:00:55.106,506] &amp;lt;inf&amp;gt; fuel_gauge: [240-255]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/558358?ContentTypeID=1</link><pubDate>Fri, 09 Jan 2026 08:35:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d03e5e1-6bc0-4d0d-8fad-1a96c206c052</guid><dc:creator>Tharaka</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Could you share the battery model file used and the project folder created during the profiling process? I can first have a look whether the battery model is correct.&lt;br /&gt;&lt;br /&gt;During discharge, the default recommended fuel gauge sampling rate is 1 second. The fuel gauge is designed for ultra-low-power operation when supplied from the battery. &lt;br /&gt;If you can provide the battery capacity and average application currents during discharge, we can suggest an optimized sampling rate.&lt;br /&gt;During charging, using a 100 ms interval is fine since USB power removes power constraints.&lt;br /&gt;&lt;br /&gt;Also, do you use the &lt;a href="https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/charger.html#ariaid-title11"&gt;Battery Discharge Current Limit&lt;/a&gt; feature to limit discharge current and improve current measurement accuracy?&amp;nbsp;Here the&amp;nbsp;&lt;strong&gt;Low&lt;/strong&gt; setting is recommended for better fuel gauge performance and stable current measurement.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Fuel Gauge Initialization&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Initialize only when the battery is at rest and system activity is low. For example, initializing during charging is not recommended.The ideal moment is immediately after reboot, before enabling downstream peripherals or the charger. This ensures minimal load on the battery.&lt;br /&gt;&lt;br /&gt;The nrf_fuel_gauge_init() function uses the first measurement of voltage, current, and temperature.To ensure an accurate baseline, take this measurement when the battery is chemically stable (not charging and not under significant load).&lt;br /&gt;&lt;br /&gt;Some initialization error may still occur, but the algorithm corrects these gradually as the battery discharges.&lt;br /&gt;The fuel gauge library automatically reinitializes after a full-charge event, ensuring accurate SoC near 100% and preventing error accumulation.&lt;br /&gt;&lt;br /&gt;More info &lt;a href="https://docs.nordicsemi.com/bundle/nan_045/page/APP/nan_045/fg_initialization.html"&gt;Fuel Guage initialization &lt;/a&gt;chapter in the fuel gauge app note for more info. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sleep Mode Considerations&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If the host enters sleep (RAM retained), do not reinitialize the fuel gauge upon wakeup. Instead, use nrf_fuel_gauge_idle_set() before sleep to notify the library of idle periods. Provide the expected average current during idle to improve estimation accuracy. When normal activity resumes, call nrf_fuel_gauge_process() to return to active tracking. This significantly accelerates ffuel gauge convergence after period of long inactivity.&lt;br /&gt;See &lt;a href="https://docs.nordicsemi.com/bundle/nan_045/page/APP/nan_045/fg_configuration_sleep.html"&gt;Sleep Current Configuration&lt;/a&gt;&amp;nbsp;and &lt;a href="https://docs.nordicsemi.com/bundle/nan_045/page/APP/nan_045/fg_configuration_memory.html"&gt;Fuel gauge RAM retention&lt;/a&gt; chapter in the fuel gauge app note for more info.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Hope this helps&lt;br /&gt;&lt;br /&gt;Regards&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Tharaka&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/558149?ContentTypeID=1</link><pubDate>Wed, 07 Jan 2026 12:50:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11f13ee2-c577-4c5d-8690-5f0fced0fd5c</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Based on the logs you have provided I&amp;#39;m not sure what values it is you refer to being different before/after a&amp;nbsp;reboot? As far as I know there is no maximum delta where measurements aren&amp;#39;t supported anymore.&lt;/p&gt;
&lt;p&gt;As for why the voltage and current changes that is normal for a running device since it moves between different modes pretty often.&lt;/p&gt;
&lt;p&gt;No, it does not average over time, why would you think that?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As for the state memory, that is indeed used for storing the fuel gauge state so that it can resume from the last known state. As the comment says, on older SDKs this was retrieved using &lt;strong&gt;nrf_fuel_gauge_state_get&lt;/strong&gt;() if moving to NCS v3.1.1 is not an option for you.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300 fuel gauge SoC</title><link>https://devzone.nordicsemi.com/thread/558080?ContentTypeID=1</link><pubDate>Tue, 06 Jan 2026 18:53:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b9f1e82-42ac-467c-b29d-37162962b03e</guid><dc:creator>garrettb</dc:creator><description>&lt;p&gt;I compared SDK 2.9.2 to SDK 3.1.1, and I noticed that in nrf_fuel_gauge_init_parameters() there is a new addition:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/** Optional state memory, previously retrieved using @ref nrf_fuel_gauge_state_get.
* When used, the library resumes from this state and all other parameters are ignored.
* Set to NULL when not used or when initializing the library for the first time.
*/
const void *state;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is this used to save the SoC?&lt;br /&gt;If so, this would probably be useful.&lt;br /&gt;Unfortunately, it is not an option for us, right now, to upgrade out current project to use SDK 3.1.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>