<?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>Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62060/power-consumption-using-freertos</link><description>Hi, 
 
 I&amp;#39;m using an application with FreeRTOS , nRF52833, SDK 16. 
 When I&amp;#39;m trying to get it into low power (sleep mode) the system still consumes ~4mA 
 In vPortSuppressTicksAndSleep (port_cmsis_systick.c file) I forced to use WFE instead sd_app_evt_wait</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Jun 2020 06:46:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62060/power-consumption-using-freertos" /><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/254368?ContentTypeID=1</link><pubDate>Thu, 11 Jun 2020 06:46:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7efecca-50f3-41e1-acba-17dbefbae9c9</guid><dc:creator>shai.c</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your answer, I tested it and the&amp;nbsp;behavior looks like using WFE&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/254203?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2020 09:48:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e20454e-daa9-422c-a315-6dbd3271f7ed</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Shai,&lt;/p&gt;
&lt;p&gt;Verified your descritption. You were right. Something is causing the softdevice wakeup too early. Please replace the sd_app_evt_wait with the below code in port_cmsis_systick.c. I have verified my suggestion to improve the power. We will investigate further if this behaviour is same with the coming SD versions to see if we need to fix something.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        if ( xModifiableIdleTime &amp;gt; 0 )
        {
#ifdef SOFTDEVICE_PRESENT
            if (nrf_sdh_is_enabled())
            {
                do{
                  uint32_t err_code = sd_app_evt_wait();
                  APP_ERROR_CHECK(err_code);
                } while (0 == (NVIC-&amp;gt;ISPR[0] | NVIC-&amp;gt;ISPR[1]));
            }&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/254178?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2020 08:44:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:105a6ef8-d4e2-47f8-9c86-729e01725c4b</guid><dc:creator>shai.c</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Attached hrs &lt;span&gt;freertos_hrs&amp;nbsp;&lt;/span&gt;project&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4810.ble_5F00_app_5F00_hrs_5F00_freertos.zip"&gt;devzone.nordicsemi.com/.../4810.ble_5F00_app_5F00_hrs_5F00_freertos.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/254174?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2020 08:39:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b648b61-80bd-42cd-888e-ed8ac07e08dc</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am sorry for coming back late. I am struggling a bit trying to make the SDK16 SES freertos_hrs project run on pca10100.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Just changing the preprocessing defines&lt;/li&gt;
&lt;li&gt;replacing startupfiles to match nrf52833&lt;/li&gt;
&lt;li&gt;and fixing linker values seems not enough.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Can I please get your project that runs on pca10100 on sdk16, so that I flash and see the results in the power profiler.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/253747?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 10:39:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61554f5e-533f-49c9-ae00-284797f24824</guid><dc:creator>shai.c</dc:creator><description>&lt;p&gt;Thanks for your answer, but disabling and then enabling the MWU didn&amp;#39;t change the power consumption&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will be glad if you will test it&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/253742?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 10:16:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49ebdb1e-2813-4ff2-aa77-91977b1ed99d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am sorry, I realized that my new nRF52833 board did not have the SB bridge cut to make the power measurement.&lt;/p&gt;
&lt;p&gt;In your latest reply you say that you see a significant improvement with WFE, then this is something we saw before&lt;/p&gt;
&lt;p&gt;I suspect that this is because of the use of MWU inside of sd, that causes this spike as seen in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/59170/is-mwu-in-softdevice"&gt;this &lt;/a&gt;thread.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Try disabling the MWU before sd_app_event_wait and enabling just after wakeup in the port_cmsis_systick.c file like below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// replace sd_app_evt_wait with
/* MWU Disable */
NRF_MWU-&amp;gt;REGIONENCLR
    = ((MWU_REGIONENCLR_RGN0WA_Clear &amp;lt;&amp;lt; MWU_REGIONENCLR_RGN0WA_Pos) 
     | (MWU_REGIONENCLR_PRGN0WA_Clear &amp;lt;&amp;lt; MWU_REGIONENCLR_PRGN0WA_Pos));

sd_app_evt_wait();

/* MWU Enable */
NRF_MWU-&amp;gt;REGIONENSET
    = ((MWU_REGIONENSET_RGN0WA_Set &amp;lt;&amp;lt; MWU_REGIONENSET_RGN0WA_Pos) 
     | (MWU_REGIONENSET_PRGN0WA_Set &amp;lt;&amp;lt; MWU_REGIONENSET_PRGN0WA_Pos));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have not tested this since myself, but if this did not work, then I can fix my board and try to dig a bit deeper into it tomorrow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/253720?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 09:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae3d18b9-966c-4ee5-b9cc-6fa405e8feee</guid><dc:creator>shai.c</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/aryan"&gt;Susheel Nuguru&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using&amp;nbsp;&lt;span&gt;nRF52833 DK running&amp;nbsp;ble_app_hrs_freertos example.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1. when using the following code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        if ( xModifiableIdleTime &amp;gt; 0 )
        {
#ifdef SOFTDEVICE_PRESENT
            if (nrf_sdh_is_enabled())
            {
#if (__FPU_USED == 1)
             __set_FPSCR(__get_FPSCR() &amp;amp; ~(0x0000009F)); 
             (void) __get_FPSCR();
             NVIC_ClearPendingIRQ(FPU_IRQn);
#endif  __FPU_USED
                uint32_t err_code = sd_app_evt_wait();
                APP_ERROR_CHECK(err_code);
            }
            else
#endif  // SOFTDEVICE_PRESENT
            {
                /* No SD -  we would just block interrupts globally.
                * BASEPRI cannot be used for that because it would prevent WFE from wake up.
                */
                do{
                    __WFE();
                } while (0 == (NVIC-&amp;gt;ISPR[0] | NVIC-&amp;gt;ISPR[1]));
            }
        }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;the average power consumption is: 5.794mA&lt;/p&gt;
&lt;p&gt;&lt;img alt="sd_app_evt_wait" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/sd_5F00_app_5F00_evt_5F00_wait.png" /&gt;&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;&lt;span&gt;when using the following code (forcing to use WFE):&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        if ( xModifiableIdleTime &amp;gt; 0 )
        {
#if 0
#ifdef SOFTDEVICE_PRESENT
            if (nrf_sdh_is_enabled())
            {
#if (__FPU_USED == 1)
             __set_FPSCR(__get_FPSCR() &amp;amp; ~(0x0000009F)); 
             (void) __get_FPSCR();
             NVIC_ClearPendingIRQ(FPU_IRQn);
#endif  __FPU_USED
                uint32_t err_code = sd_app_evt_wait();
                APP_ERROR_CHECK(err_code);
            }
            else
#endif  // SOFTDEVICE_PRESENT
#endif  // if 0
            {
                /* No SD -  we would just block interrupts globally.
                * BASEPRI cannot be used for that because it would prevent WFE from wake up.
                */
                do{
                    __WFE();
                } while (0 == (NVIC-&amp;gt;ISPR[0] | NVIC-&amp;gt;ISPR[1]));
            }
        }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;the average power consumption is: 102uA&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="WFE" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/8765.wfe.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Which example did you test?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks, Shai&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/253705?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 08:40:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5ef4c2d-4074-42a7-b2a0-97cfeff09018</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Shai,&lt;/p&gt;
&lt;p&gt;That seems to be a lot of current from a peripheral keeping the HFCLK ON. That is not normal and is not consistent with the testing I have done here on the examples.&lt;/p&gt;
&lt;p&gt;Are you testing this on nRF52833 DK board or is it a custom board? Have you disabled all tasks in your application and let the idle task run only&amp;nbsp; to see how much current the idle application consumes?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/253698?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 08:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb25e2b8-7449-4653-b448-13c00eafc5b2</guid><dc:creator>shai.c</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/aryan"&gt;Susheel Nuguru&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/253070?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 14:38:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c245deef-27f4-4d0c-b36b-31bdcf2919c8</guid><dc:creator>shai.c</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I checked&amp;nbsp;ERRATA 87 - CPU: Unexpected wake from System ON Idle when using FPU, according to the Workaround the following code need to be added before calling WFE&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if (__FPU_USED == 1)
 _set_FPSCR(_get_FPSCR() &amp;amp; ~(0x0000009F)); 
 (void) __get_FPSCR();
 NVIC_ClearPendingIRQ(FPU_IRQn);
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Does this code need to be added also before calling&amp;nbsp;sd_app_evt_wait? ( I&amp;#39;m using&amp;nbsp;SOFTDEVICE)&lt;/p&gt;
&lt;p&gt;however, I tried to add this before calling&amp;nbsp;sd_app_evt_wait but it didn&amp;#39;t help&lt;/p&gt;
&lt;p&gt;Any other suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption using FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/252978?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 11:35:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f6e0419-ad13-4fc7-9e49-72c5e8992f68</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I cannot think of anything.very specific.&lt;/p&gt;
&lt;p&gt;Please check if you are hit by ERRATA&amp;nbsp; 78 or 87 as mentioned &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52833_Rev1%2FERR%2FnRF52833%2FRev1%2Flatest%2Ferr_833_new.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>