<?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>nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120331/nrf-fuel-gauge-soc-calculation-issue</link><description>Hi! I&amp;#39;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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Apr 2025 13:10:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120331/nrf-fuel-gauge-soc-calculation-issue" /><item><title>RE: nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/thread/530016?ContentTypeID=1</link><pubDate>Tue, 01 Apr 2025 13:10:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39217b84-1d8b-4100-af63-23897cab3a77</guid><dc:creator>Tharaka</dc:creator><description>&lt;p&gt;Glad that you have found a workaround for MCU reset and everything is working properly now.&amp;nbsp;&lt;br /&gt;Good luck with your project !!&lt;/p&gt;
&lt;p&gt;Regards&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Tharaka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/thread/530009?ContentTypeID=1</link><pubDate>Tue, 01 Apr 2025 12:59:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8a16ce4-c6ff-4d15-8e5c-ca57d9f1c61e</guid><dc:creator>AntonZ</dc:creator><description>&lt;p&gt;Hi Tharaka,&lt;br /&gt;&lt;br /&gt;Thanks for the reply and the explanations related to the battery model.&lt;br /&gt;This also explains wrong SOC (with my model it shows 100% at around 4.05V) while LP model you suggested shows 88.7% which I believe is more accurate.&lt;br /&gt;&lt;br /&gt;As for the issue with the MCU reset while charger is connected, the reasom is other.&lt;br /&gt;I did some more testing and found out that the first reading I get from the nPM1300 through Zephyr driver gives me voltage and current as if charger was active, so the model is not able to estimate battery level properly.&lt;br /&gt;This might also be a bug in the example for the nPM1300.&lt;br /&gt;&lt;br /&gt;As a workaround, at the initialization stage of the Fuel gauge algorithm, I disabled charging functinality and did two readings from the nPM1300 so as to &amp;quot;flush&amp;quot; first voltage/current values from it.&lt;br /&gt;Please check the following log (MCU is reset with charger connected):&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:02.196,228] &amp;lt;inf&amp;gt; app: *****:: nRF Fuel Gauge version: 0.9.2
[00:00:02.197,631] &amp;lt;inf&amp;gt; app: *****:: Charger init (regs: SET: 0x1; CLR: 0x1)
[00:00:02.199,645] &amp;lt;inf&amp;gt; app: *****:: Charger disabled (regs: SET: 0x0; CLR: 0x0)
[00:00:02.704,589] &amp;lt;wrn&amp;gt; app: *****:: (init) NPM1300 data: 4.042000V, -0.471000A, 25.102783&amp;#176;C
[00:00:03.209,533] &amp;lt;wrn&amp;gt; app: *****:: (init) NPM1300 data: 3.857000V, 0.000000A, 25.205627&amp;#176;C
[00:00:03.214,752] &amp;lt;inf&amp;gt; app: *****:: Charger enabled (regs: SET: 0x1; CLR: 0x1)
[00:00:03.219,848] &amp;lt;inf&amp;gt; app: *****:: NPM1300 data: 3.862000V, 0.000000A, 25.205627&amp;#176;C, 52.964569%
[00:00:04.224,975] &amp;lt;inf&amp;gt; app: *****:: NPM1300 data: 3.862000V, -0.046000A, 25.102783&amp;#176;C, 52.964569%
[00:00:05.230,102] &amp;lt;inf&amp;gt; app: *****:: NPM1300 data: 4.047000V, -0.467000A, 25.102783&amp;#176;C, 52.964569%
[00:00:06.235,229] &amp;lt;inf&amp;gt; app: *****:: NPM1300 data: 4.047000V, -0.467000A, 25.102783&amp;#176;C, 52.980389%
[00:00:07.240,356] &amp;lt;inf&amp;gt; app: *****:: NPM1300 data: 4.042000V, -0.467000A, 25.102783&amp;#176;C, 52.995975%&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can see, first reading from the nPM1300 after disabling charger shows incorrect values.&lt;br /&gt;&lt;br /&gt;I guess that it might be related to the&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/core_components/saadc/doc/frontpage.html#ariaid-title4"&gt;Automatic measurements during charging&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So, with such modification I&amp;#39;m now able to get more accurate SOC when restarting MCU with connected charger.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Anton&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/thread/529924?ContentTypeID=1</link><pubDate>Tue, 01 Apr 2025 08:38:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:989826cd-3081-4a58-ae6b-2c91fe74c14b</guid><dc:creator>Tharaka</dc:creator><description>&lt;p&gt;Hi Anton&lt;br /&gt;&lt;br /&gt;Thanks for sharing the files. I had a quick look on the data.&lt;br /&gt;It appears that the battery resistance is unusually high and there&amp;rsquo;s a sudden 750 mV jump in voltage while charging just enabled during the battery profiling stage. &lt;br /&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/pastedimage1743495247577v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Fully charged voltage, just after charge completion,is also 4.04V.&amp;nbsp;&lt;br /&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/pastedimage1743495331538v2.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;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&amp;nbsp;a value quite closer to rated 600 mAh).&lt;br /&gt;Battery model estimates much higher internal resistance during profiling process.&lt;br /&gt;&lt;br /&gt;This is the reason you are seeing quite strange behaviour in the fuel gauge.&lt;br /&gt;&lt;br /&gt;From my experience this can happen due to several reasons,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Incorrect Profiling Setup:&lt;/strong&gt; 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.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Degraded Battery&lt;/strong&gt;: A worn or damaged battery can exhibit increased internal resistance and abrupt voltage jumps.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ideal solution would be to repeat the profiling step with a fresh battery with proper connection to the nPM1300-EK + FG board. &lt;br /&gt;&lt;br /&gt;But not to keep you waiting for an another 48 hours i have attached you&amp;nbsp;similar &lt;strong&gt;Pre-Profiled battery models&lt;/strong&gt; to match your battery spec for early evaluations.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/600mAh_5F00_Models.zip"&gt;devzone.nordicsemi.com/.../600mAh_5F00_Models.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can initialize the FG even if the OTA process is completed, and charger is ON with these models.&lt;br /&gt;&lt;br /&gt;Also since you are using a older version of the FG library, i suggest you to call the Fuel Gauge initialization function &lt;strong&gt; nrf_fuel_gauge_init()&amp;nbsp;&lt;/strong&gt;everytime after a charge completion&amp;nbsp;This ensures that the&amp;nbsp;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.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;You could use the charge completion event (&lt;a href="https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/charger.html#ariaid-title46)"&gt;docs.nordicsemi.com/.../charger.html&lt;/a&gt; from the NPM1300 BCHGCHARGESTATUS register to trigger the fuel gauge reinitialization (nrf_fuel_gauge_init).&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Let me know if this helps.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thanks !!&lt;br /&gt;&lt;br /&gt;Tharaka&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/thread/529909?ContentTypeID=1</link><pubDate>Tue, 01 Apr 2025 07:48:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88e8276e-c723-496f-bf85-d4034e11b563</guid><dc:creator>AntonZ</dc:creator><description>&lt;p&gt;Hi Tharaka,&lt;br /&gt;&lt;br /&gt;Sure, here it is:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Battery.zip"&gt;devzone.nordicsemi.com/.../Battery.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/thread/529855?ContentTypeID=1</link><pubDate>Mon, 31 Mar 2025 17:09:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56f0d87d-a025-4a3f-8e50-a70b41c63ae3</guid><dc:creator>Tharaka</dc:creator><description>&lt;p&gt;Hi Anton&lt;br /&gt;&lt;br /&gt;I would like to have look at your battery model file. Can you share it ? &amp;nbsp;Also if possible the project folder created during&amp;nbsp;the battery profiling process.&lt;/p&gt;
&lt;p&gt;Tharaka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/thread/529850?ContentTypeID=1</link><pubDate>Mon, 31 Mar 2025 15:43:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5868e7c-1336-4a1d-8472-926bf3640229</guid><dc:creator>AntonZ</dc:creator><description>&lt;p&gt;Hi Tharaka,&lt;br /&gt;&lt;br /&gt;As I understand, in order to use a newer version of the fueal gauge library I have to upgrade the NCS version as well.&lt;br /&gt;Since this may lead to some changes/bugs in my codebase, this option is not preferred now.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="132444" url="~/f/nordic-q-a/120331/nrf-fuel-gauge-soc-calculation-issue/529849"]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.[/quote]
&lt;p&gt;Currently the charger is enabled in the overlay file:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;npm1300_ek_charger: charger {
			compatible = &amp;quot;nordic,npm1300-charger&amp;quot;;
			term-microvolt = &amp;lt;4200000&amp;gt;;
			term-warm-microvolt = &amp;lt;3600000&amp;gt;;
			current-microamp = &amp;lt;480000&amp;gt;;
			dischg-limit-microamp = &amp;lt;1000000&amp;gt;;
			vbus-limit-microamp = &amp;lt;500000&amp;gt;;
			thermistor-ohms = &amp;lt;10000&amp;gt;;
			thermistor-beta = &amp;lt;3380&amp;gt;;
			charging-enable;
		};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So will it be anough to leave this configuration (except &amp;quot;charging-enable&amp;quot; option) and activate charger via&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/charger.html#ariaid-title18"&gt;BCHGENABLESET&lt;/a&gt;&amp;nbsp;register?&lt;br /&gt;Documentation also mentions that the following change must be done:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;quot;Once charging has started, host software must use register&amp;nbsp;&lt;a class="xref" href="https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/core_components/ctrl_reg/doc/main-registers.html#register.EVENTSBCHARGER0CLR" data-bundleid="ps_npm1300" data-navpath="chapters/core_components/ctrl_reg/doc/main-registers.html"&gt;EVENTSBCHARGER0CLR&lt;/a&gt;&amp;nbsp;to initialize battery charger events.&amp;quot;&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;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.&lt;em&gt;&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;Anyway, I tried to disable the charging process just before reading data from nPM1300 and a call to &amp;quot;&lt;span&gt;nrf_fuel_gauge_init()&lt;/span&gt;&amp;quot; and activating it again after that, but the results are still not correct.&lt;br /&gt;&lt;br /&gt;Is there anything else I could check? Maybe data processing interval?&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Anton&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Fuel gauge SOC calculation issue</title><link>https://devzone.nordicsemi.com/thread/529849?ContentTypeID=1</link><pubDate>Mon, 31 Mar 2025 15:26:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e1506a2-07ca-4149-bac0-86cc7f3e46ef</guid><dc:creator>Tharaka</dc:creator><description>[quote userid="126614" url="~/f/nordic-q-a/120331/nrf-fuel-gauge-soc-calculation-issue"] [/quote]
&lt;p&gt;Hi &lt;br /&gt;&lt;br /&gt;There&amp;rsquo;s an updated Fuel Gauge library available with the latest NCS releases. I&amp;nbsp;suggest upgrading to that version for the best experience.&lt;br /&gt;&lt;a id="" href="https://docs.nordicsemi.com/bundle/ncs-3.0.0-preview2/page/nrfxlib/nrf_fuel_gauge/README.html"&gt;https://docs.nordicsemi.com/bundle/ncs-3.0.0-preview2/page/nrfxlib/nrf_fuel_gauge/README.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;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&amp;nbsp;worth noting that the Fuel Gauge is designed to correct initialization errors over time as the battery discharges.&lt;br /&gt;&lt;br /&gt; Tharaka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>