<?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>How to put nRF52833 to sleep mode? we are not using softdevice.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67989/how-to-put-nrf52833-to-sleep-mode-we-are-not-using-softdevice</link><description>Hi Devzone: 
 I want to make nRF52833 chip enter sleep mode but not deep sleep(SYSTEM OFF) so that real time clock can still wake up the system. We don&amp;#39;t use softdevice. 
 Digging around the forum, it seems to me that if I write my main as follows: 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Nov 2020 09:55:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67989/how-to-put-nrf52833-to-sleep-mode-we-are-not-using-softdevice" /><item><title>RE: How to put nRF52833 to sleep mode? we are not using softdevice.</title><link>https://devzone.nordicsemi.com/thread/278741?ContentTypeID=1</link><pubDate>Fri, 06 Nov 2020 09:55:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53999920-5b5a-45ad-8bf2-15359080a301</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The PMU is always enabled as a part of the system and not really related to the &lt;span&gt;&lt;a title="Power Management library" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_pwr_mgmt.html?cp=7_1_3_36"&gt;Power Management library&lt;/a&gt;. I mentioned the library mainly because it incorporates the FPU workaround. It also includes other features as mentioned in the documentation that you may find useful. It&amp;#39;s however perfectly fine to not use the library. Calling __WFE() directly will have the same result.&lt;/span&gt;&lt;/p&gt;
[quote user="cpeng"]So which way is the correct way? would &amp;quot;nrf_pwr_mgmt_run();&amp;quot; run &amp;quot;_WFE()&amp;quot;?[/quote]
&lt;p&gt;There is not really any difference when you call it from the main loop as I see it, both will make the CPU execute __WFE() until the system enters sleep. Note that the __WFE instruction is conditional and may not enter sleep the first time its called, please refer to the ARM doc here &lt;a href="https://developer.arm.com/documentation/dui0552/a/the-cortex-m3-processor/power-management/entering-sleep-mode"&gt;https://developer.arm.com/documentation/dui0552/a/the-cortex-m3-processor/power-management/entering-sleep-mode&lt;/a&gt; for a more detailed explanation on this.&amp;nbsp; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to put nRF52833 to sleep mode? we are not using softdevice.</title><link>https://devzone.nordicsemi.com/thread/278675?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2020 18:16:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2336480-bfd5-4d59-b1f0-80dd6e4aa7cd</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Vidar:&lt;/p&gt;
&lt;p&gt;Thanks for replying. It sounds like in order to achieve sleep mode, PMU needs to be initialized and used.&lt;/p&gt;
&lt;p&gt;According to the power management example project provided by Nordic, the code to set up sleep mode and enter it seems to be:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void main()
{
...
nrf_pwr_mgmt_init();
...
while (1)
    {
    ...
     nrf_pwr_mgmt_run();
    ...
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I assume&amp;nbsp;&lt;strong&gt;nrf_pwr_mgmt_init()&lt;/strong&gt;&amp;nbsp;and&amp;nbsp;&lt;strong&gt;&amp;nbsp;nrf_pwr_mgmt_run()&lt;/strong&gt; is the PMU you talked about is that right?&lt;/p&gt;
&lt;p&gt;But I was recommended in the past to do this instead:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void main()
{
...

while (1)
    {
    ...
    _WFE();
    _SEV();
    _WFE();
    ...
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can see in the while loop it&amp;#39;s not&amp;nbsp;&lt;strong&gt;nrf_pwr_mgmt_run()&lt;/strong&gt;&lt;span&gt;&amp;nbsp;but it&amp;#39;s a sequence of &lt;strong&gt;WFE and SEV&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So which way is the correct way? would &amp;quot;nrf_pwr_mgmt_run();&amp;quot; run &amp;quot;_WFE()&amp;quot;?&lt;/p&gt;
&lt;p&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: How to put nRF52833 to sleep mode? we are not using softdevice.</title><link>https://devzone.nordicsemi.com/thread/278550?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2020 08:51:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12113252-d0c0-4b3c-9ec8-072ff90814b9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, the device should enter &lt;span&gt;&lt;a title="System ON mode" href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/power.html?cp=4_1_0_4_2_3#unique_46124348"&gt;System ON mode&lt;/a&gt;&lt;/span&gt; &lt;span&gt;when you call __WFE in a loop. This is often all you have to do to get a ~2-3 uA idle idle current because the &lt;a title="Power management unit (PMU)" href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/pmu.html?cp=4_1_0_4_0"&gt;Power management unit (PMU)&lt;/a&gt;&amp;nbsp; takes care of the rest. But there are some exceptions, for instance,&amp;nbsp; when you use peripherals such as TIMER and UART that require a HF clock source to be kept active while in sleep, then you will see a floor current of around 0.5 - 1 mA.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Note that if you use any FPU instructions you should also include the workaround for errata 87: &lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52833_Rev1/ERR/nRF52833/Rev1/latest/anomaly_833_87.html?cp=4_1_1_0_1_5"&gt;[87] CPU: Unexpected wake from System ON Idle when using FPU&lt;/a&gt;. This workaround is already included in most examples as they use the &lt;a title="Power Management library" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_pwr_mgmt.html?cp=7_1_3_36"&gt;Power Management library&lt;/a&gt; to enter sleep.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>