<?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-EK + NRF5 SDK: Is It Possible?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/113111/npm1300-ek-nrf5-sdk-is-it-possible</link><description>Hey, 
 I&amp;#39;m currently working on a legacy project that uses the NRF5 SDK. Rewriting the project to use the nRF Connect SDK would be tedious, time consuming and likely to introduce more bugs, causing me to miss my deadline. Is there a way to use the NRF5</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Aug 2024 13:36:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/113111/npm1300-ek-nrf5-sdk-is-it-possible" /><item><title>RE: nPM1300-EK + NRF5 SDK: Is It Possible?</title><link>https://devzone.nordicsemi.com/thread/497845?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2024 13:36:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38b6a062-4e81-437b-a195-c2c68ffdc82a</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Glad you were able to make something work on your end. In the &lt;strong&gt;nrf_fuel_gauge&lt;/strong&gt; process, the &lt;strong&gt;t_delta&lt;/strong&gt;&amp;nbsp;parameter refers to the time difference since the previous processed measurement.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;t_delta&amp;nbsp;&lt;/strong&gt;&lt;span&gt;&lt;span dir="ltr"&gt;should reflect the actual time delta from the previous call to &lt;strong&gt;nrf_fuel_gauge_process&lt;/strong&gt;(). However, the algorithm will consider the current consumption in between calls to &lt;strong&gt;nrf_fuel_gauge_process&lt;/strong&gt;() to be an average between the two. If &lt;strong&gt;t_delta&lt;/strong&gt; is large due to the system being in an idle state, it is better to use &lt;strong&gt;nrf_fuel_gauge_idle_set&lt;/strong&gt;() function prior to entering the idle period. The next time &lt;strong&gt;nrf_fuel_gauge_process&lt;/strong&gt;() is called, use the actual &lt;strong&gt;t_delta&lt;/strong&gt; as normal.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Also note that &lt;strong&gt;t_delta&lt;/strong&gt; is a floating point value, so it would have to be&amp;nbsp;&lt;em&gt;very large&lt;/em&gt; for anything to start overflowing.&lt;/span&gt;&lt;/span&gt;&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-EK + NRF5 SDK: Is It Possible?</title><link>https://devzone.nordicsemi.com/thread/497740?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2024 08:03:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42ca6b4e-3ffe-4539-80a9-e493d45988d9</guid><dc:creator>J0sh1101</dc:creator><description>&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;Hi Simon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;Thanks for the answer. I manage to make it work.( For anyone doing the same.)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;To make it work you need to include:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;- add the nrf_fuel_gauge.h header to your project, which is located in the zephyr drivers.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;- Tell the linker to include the library libnrf_fuel_gauge.a into your build, which is located at nrfxliby\nrf_fuel_gauge.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;- Add the battery model to your project, you can get it from nPM PowerUP.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;- Include the library like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    static const struct battery_model battery_model = {
        #include &amp;quot;battery_model.inc&amp;quot;
    };    
    
    uint32_t err_code;
    struct nrf_fuel_gauge_init_parameters parameters = {
          .model = &amp;amp;battery_model,
          .opt_params = NULL,
    };
    
    
    /* Store charge nominal and termination current, needed for ttf calculation */
    max_charge_current = 0.15; 
    term_charge_current = max_charge_current / 10.f;
    
    /* update the fuel gauge values */
    parameters.v0 = bms_end_data.voltage;
    parameters.i0 = bms_end_data.current;
    parameters.t0 = bms_end_data.temp;
    nrf_fuel_gauge_init(&amp;amp;parameters, NULL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;- Call feul_gauge_process() to get the state of charge (SOC):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  uint32_t err_code;

  // read the bms parameters
  err_code = drv_bms_read_data();
  VERIFY_SUCCESS(err_code);


  delta_in_s = ((float)app_timer_cnt_diff_compute(app_timer_cnt_get(),ticks_latest_delta) / (float)TICKS_IN_ONE_SECOND);
  ticks_latest_delta = app_timer_cnt_get();


  static float soc = nrf_fuel_gauge_process(bms_end_data.voltage, bms_end_data.current, bms_end_data.temp, delta_in_s, NULL);

  return NRF_SUCCESS;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What I don&amp;#39;t understand is the delta_in_s. Is this representing the time that has elapsed between SOC measurements or is it just how fast I measure to use this delta for some other estimation?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If I would go to low power for say 2 days then the delta_in_s would be very large as the SOC wouldn&amp;#39;t be triggered, then I could get an overflow which would create an error in the estimate, right?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nPM1300-EK + NRF5 SDK: Is It Possible?</title><link>https://devzone.nordicsemi.com/thread/495156?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2024 08:41:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e69a3140-35a0-4dab-a312-75b02547fff2</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;No, the nRF5 SDK does not support the nPM1300 EK by default, but it is possible to implement on your own, but you will be on your own in doing so. Here is a non-zephyr example that supports bare metal operation:&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/npmx-zephyr/tree/main/samples/fuel_gauge"&gt;https://github.com/NordicSemiconductor/npmx-zephyr/tree/main/samples/fuel_gauge&lt;/a&gt;&amp;nbsp;Note that this example uses Zephyr as a wrapper, but since the function calls all are independent of the Zephyr framework, it should be pretty straight-forward to port somewhere else.&lt;/p&gt;
&lt;p&gt;Best of luck and 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-EK + NRF5 SDK: Is It Possible?</title><link>https://devzone.nordicsemi.com/thread/494441?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2024 22:03:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1a16551-fc6b-467d-a965-471d090bc9ab</guid><dc:creator>Michal</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I will check this internally and I&amp;#39;ll get back to you.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>