<?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>Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81569/questions-about-low-power-deep-sleep</link><description>I am porting our system to NRF52840. I would appreciate if someone can clarify some questions regarding deep sleep. 
 1. Based on some Q&amp;amp;A, before &amp;quot;WFI&amp;quot; the sub power mode can be &amp;quot;Constant Latency&amp;quot; and &amp;quot;Low-power&amp;quot;. And low-power will turn off high frequency</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Nov 2021 08:21:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81569/questions-about-low-power-deep-sleep" /><item><title>RE: Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/thread/339758?ContentTypeID=1</link><pubDate>Fri, 19 Nov 2021 08:21:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b98b4e8-257f-4c51-b7a8-ad81084fa28a</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Libertas"]1. So if I keep the radio on and&amp;nbsp;&lt;span&gt;&amp;nbsp;execute&amp;nbsp;&lt;/span&gt;&lt;span&gt;__WFI/__WFE to wait for incoming RF packet, your chip is smart enough to keep the HFXO on for quick wakeup, which according to some users&amp;#39; post is around 10us&lt;/span&gt;[/quote]
&lt;p&gt;HFXO must be (there is no smartness in this as this is a must condition) ON for radio to work to wait for incoming packets and according to &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fclock.html&amp;amp;cp=4_0_0_4_3_3_1&amp;amp;anchor=unique_106537914"&gt;this&lt;/a&gt;&amp;nbsp;data, the standby current can be anywhere between 80-900uA depending on the vendor of the XO you are using.&lt;/p&gt;
[quote user="Libertas"]2. On the another hand, if my device is a battery powered sensor and I turn off the radio and other peripherals,&amp;nbsp; while only keep the RTC interrupt enabled, then execute&amp;nbsp;__WFI/__WFE, the chip is smart enough to turn off&amp;nbsp;HFXO&amp;nbsp;to conserve the battery with uA level of current draw.[/quote]
&lt;p&gt;Yes, turning of the peripherals will trigger the internal clock/regulator logic to be able smartly turn ON only those regulators that are needed for the enabled peripherals. In your use case, having only RTC enabled and calling __WFI/__WFE with other peripheral that use HFCLK disabled will disable the HFCLK in idle sleep (WFE/WFI)&lt;/p&gt;
[quote user="Libertas"]I believe I also need to use&amp;nbsp;CONSTLAT for above case 1 and&amp;nbsp;LOWPWR for case 2.[/quote]
&lt;p&gt;Yes, that fits fine for the given cases.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/thread/338848?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2021 16:04:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4617135b-d0b4-407f-bfb9-d1a6846a2e19</guid><dc:creator>Libertas</dc:creator><description>[quote userid="6207" url="~/f/nordic-q-a/81569/questions-about-low-power-deep-sleep/338734#338734"]Some of the base resources are kept active in sleep when &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fchapters%2Fpmu%2Fdoc%2Foperationmodes%2Fsystem_on_mode.html&amp;amp;resultof=%22%43%4f%4e%53%54%4c%41%54%22%20%22%63%6f%6e%73%74%6c%61%74%22%20"&gt;CONSTLAT &lt;/a&gt;is enabled. HFCLK might still be off but the regulator for that might be kept active.&amp;nbsp;[/quote]
&lt;p&gt;Thanks again. One more question:&lt;/p&gt;
&lt;p&gt;On page 87 of the specs of NRF52840, it states that &amp;quot;The HFXO must be running to use the RADIO...&amp;quot;.&lt;/p&gt;
&lt;p&gt;1. So if I keep the radio on and&amp;nbsp;&lt;span&gt;&amp;nbsp;execute&amp;nbsp;&lt;/span&gt;&lt;span&gt;__WFI/__WFE to wait for incoming RF packet, your chip is smart enough to keep the HFXO on for quick wakeup, which according to some users&amp;#39; post is around 10us.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. On the another hand, if my device is a battery powered sensor and I turn off the radio and other peripherals,&amp;nbsp; while only keep the RTC interrupt enabled, then execute&amp;nbsp;__WFI/__WFE, the chip is smart enough to turn off&amp;nbsp;HFXO&amp;nbsp;to conserve the battery with uA level of current draw.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I believe I also need to use&amp;nbsp;CONSTLAT for above case 1 and&amp;nbsp;LOWPWR for case 2.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please confirm that it is the case.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/thread/338734?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2021 09:56:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb6a0d77-3d36-49b6-85f1-ea919364a13a</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Libertas"]1. About idle sleep, my understanding is that &amp;quot;sub-power modes&amp;quot; will affect the HFCLK on &lt;span&gt;__WFI/__WFE. If&amp;nbsp;TASKS_CONSTLAT is set,&amp;nbsp;__WFI/__WFE won&amp;#39;t turn off&amp;nbsp;HFCLK. Please confirm.&lt;/span&gt;[/quote]
&lt;p&gt;Some of the base resources are kept active in sleep when &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fchapters%2Fpmu%2Fdoc%2Foperationmodes%2Fsystem_on_mode.html&amp;amp;resultof=%22%43%4f%4e%53%54%4c%41%54%22%20%22%63%6f%6e%73%74%6c%61%74%22%20"&gt;CONSTLAT &lt;/a&gt;is enabled. HFCLK might still be off but the regulator for that might be kept active.&amp;nbsp;&lt;/p&gt;
[quote user="Libertas"]2. If I am build my own wireless mesh protocol, there is only RADIO HAL API in nRF SDK. I will need to manage HFCLK by myself. Please confirm.&amp;nbsp;[/quote]
&lt;p&gt;If you are writing a low level proprietary stack&amp;nbsp;and you are using XTAL HFCLK then you need to have control on starting and turning it off.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/thread/338634?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 15:49:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7488b800-9596-49b0-a2ab-8b79ebca6f11</guid><dc:creator>Libertas</dc:creator><description>&lt;p&gt;Hello Susheet,&lt;/p&gt;
&lt;p&gt;Thanks for clarification. Coming from CM3 world, this kind of sleep is already pretty deep &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f600.svg" title="Grinning"&gt;&amp;#x1f600;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Just two quick questions:&lt;/p&gt;
&lt;p&gt;1. About idle sleep, my understanding is that &amp;quot;sub-power modes&amp;quot; will affect the HFCLK on &lt;span&gt;__WFI/__WFE. If&amp;nbsp;TASKS_CONSTLAT is set,&amp;nbsp;__WFI/__WFE won&amp;#39;t turn off&amp;nbsp;HFCLK. Please confirm.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. If I am build my own wireless mesh protocol, there is only RADIO HAL API in nRF SDK. I will need to manage HFCLK by myself. Please confirm.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/thread/338552?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 12:08:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab300773-c993-463f-98be-cac497688606</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Qingjun,&lt;/p&gt;
[quote user="Libertas"]1. Before entering the deep sleep (calling __WFI), I need to call&amp;nbsp;nrfx_clock_hfclk_stop(). This will stop HFXO and HFINT will be used to keep the code running.[/quote]
&lt;p&gt;Just a clarification, __WFE/__WFI are called &amp;quot;idle sleep&amp;quot;&amp;nbsp; (not &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/51648/how-to-put-nrf52840-to-deep-sleep-system-off"&gt;deep sleep&lt;/a&gt;) which will make the CPU go to sleep. All peripherals that are not active/enabled will have their clocks released and if all the peripherals that use HFCLK are disabled then the HFCLK will be stopped when CPU goes to sleep.&lt;/p&gt;
&lt;p&gt;Normally, calling __WFI/__WFE will turn of HFCLK if you have no peripherals like TIMERS/UART etc that depend on HFCLK are running.&lt;/p&gt;
[quote user="Libertas"]2.&amp;nbsp;&lt;span&gt;calling __WFI in &amp;quot;low-power&amp;quot; mode&amp;nbsp;will put the system in deep sleep with HFCLK turned off.&lt;/span&gt;[/quote]
&lt;p&gt;Not guaranteed, but yes if all other peripherals that use HFCLK are disabled. Then the only peripheral that uses HFCLK will be CPU calling WFE/WFI will make the CPU go to low power and release the HFCLK and if no other peripherals use the HFCLK at that time, then the HFCLK is stopped automatically.&lt;/p&gt;
[quote user="Libertas"]3. RTC or external pin interrupt will wake up from deep sleep.[/quote]
&lt;p&gt;only four things mentioned &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&amp;amp;cp=4_0_0_4_2_2&amp;amp;anchor=unique_170248612"&gt;here&lt;/a&gt;&amp;nbsp;(deep sleep = System off mode) can wake the chip with a reset. I think you mean to ask this for idle sleep. In that case yes, RTC or external pin interrupts can wake the chip. FreeRTOS port works with SEVONPEND bit set in ARM core registers. That means that the interrupt does not need to be even enabled in the NVIC, if the peripheral generates interrupt, and the correct INTENSET bit is set in that peripheral, then that interrupt will wake the system from idle sleep.&lt;/p&gt;
[quote user="Libertas"]4. I need to call&amp;nbsp;nrfx_clock_hfclk_start() to start HFXO and wait for&amp;nbsp;HFXO debounce time for HFXO to stabilize. Because I need the radio I will need the HFXO.[/quote]
&lt;p&gt;Normally all the device drivers and libraries in our SDK handle the clocks they use properly. I strongly recommend you to use the drivers and libraries for peripheral so that their clocks can be automatically requested/released when needed. You can ofcourse request the hfclk in your application but your application will then bear the responsibility to release this clock before going to sleep.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/thread/338432?ContentTypeID=1</link><pubDate>Wed, 10 Nov 2021 16:28:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04470a74-a559-4090-bbaa-e1087941028e</guid><dc:creator>Libertas</dc:creator><description>&lt;p&gt;Hello Simon,&lt;/p&gt;
&lt;p&gt;Thanks for your response. I am using nRF5 SDK and FreeRTOS. I am building a novel OS layer on top of FreeRTOS.&lt;/p&gt;
&lt;p&gt;I think I&amp;#39;ve found the code in nrfx_clock.c.&amp;nbsp;Here is my understanding:&lt;/p&gt;
&lt;p&gt;Assuming I take care of all other peripherals, let&amp;#39;s concentrate on the clocks here.&lt;/p&gt;
&lt;p&gt;1. Before entering the deep sleep (calling __WFI), I need to call&amp;nbsp;nrfx_clock_hfclk_stop(). This will stop HFXO and HFINT will be used to keep the code running.&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;&lt;span&gt;calling __WFI in &amp;quot;low-power&amp;quot; mode&amp;nbsp;will put the system in deep sleep with HFCLK turned off.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. RTC or external pin interrupt will wake up from deep sleep.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4. I need to call&amp;nbsp;nrfx_clock_hfclk_start() to start HFXO and wait for&amp;nbsp;HFXO debounce time for HFXO to stabilize. Because I need the radio I will need the HFXO.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will appreciate if you can confirm my understanding is correct or wrong.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Qingjun&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about low-power deep sleep</title><link>https://devzone.nordicsemi.com/thread/338398?ContentTypeID=1</link><pubDate>Wed, 10 Nov 2021 14:13:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e077def-612a-45d4-8e3c-ebdc726ac66d</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Are you going to work on the &lt;a href="https://infocenter.nordicsemi.com/topic/struct_sdk/struct/sdk_nrf5_latest.html"&gt;nRF5 SDK&lt;/a&gt; or the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html"&gt;nRFConnect SDK&lt;/a&gt; based on the Zephyr stack?&lt;/p&gt;
&lt;p&gt;1. If you&amp;nbsp;&lt;strong&gt;just&amp;nbsp;&lt;/strong&gt;call __WFI this will not automatically turn off all peripherals and HF sources, as these must be disabled somehow first. In our SDK we do have various wrapper functions regarding sleep/sub power modes that will prepare the device for sleep before calling __WFI/__WFE so that all high current consuming sources are disabled first. An example is the &lt;strong&gt;idle_state_handle()&lt;/strong&gt; function in the nRF5 SDK.&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;Ramp-up times and behavior for the internal oscillators are stated in the &lt;a href="https://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.5.pdf"&gt;nRF52840 product specification&lt;/a&gt;. If you are interested in current consumption in general, please check out our &lt;a href="https://devzone.nordicsemi.com/power/w/opp"&gt;Online Power profiler&lt;/a&gt; which can give you an idea of what current consumption you can expect in various situations.&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></channel></rss>