<?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>Can someone explain to me how nordic nrf51822 sleep mode works?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10932/can-someone-explain-to-me-how-nordic-nrf51822-sleep-mode-works</link><description>Hi i&amp;#39;m a newbie in nordic chip. Can someone please explain to me that how to enable and disable sleep in nrf51822 and what kind of setup need to be done?
Example in Arduino :
set_sleep_mode(SLEEP_MODE_PWR_SAVE); 
sleep_enable();
sleep_mode();
sleep_disable</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Nov 2018 09:10:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10932/can-someone-explain-to-me-how-nordic-nrf51822-sleep-mode-works" /><item><title>RE: Can someone explain to me how nordic nrf51822 sleep mode works?</title><link>https://devzone.nordicsemi.com/thread/158340?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 09:10:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b886e06c-78c4-4220-b27d-b73955cf1391</guid><dc:creator>wwwoholic</dc:creator><description>&lt;p&gt;It actually makes sense. Whoever invented that &amp;quot;&lt;span&gt;__SEV(); __WFE(); __WFE();&amp;quot; sequence was seriously confused about the purpose of WFE, IMHO. I mean, if there is a pending event already, why would you hide it by calling SEV? And if there is no pending event then single WFE works exactly as expected.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can someone explain to me how nordic nrf51822 sleep mode works?</title><link>https://devzone.nordicsemi.com/thread/40870?ContentTypeID=1</link><pubDate>Fri, 13 Oct 2017 03:22:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66dee3f8-a9c4-4c57-a37b-944a1c1570cd</guid><dc:creator>tyler</dc:creator><description>&lt;p&gt;I went into the code for sd_app_evt_wait() and the only command in it was a single &lt;code&gt;__WFE();&lt;/code&gt;  Can you explain how it is doing the same thing as the &lt;code&gt;__SEV(); __WFE(); __WFE();&lt;/code&gt; without the SEV() or second WFE()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can someone explain to me how nordic nrf51822 sleep mode works?</title><link>https://devzone.nordicsemi.com/thread/40869?ContentTypeID=1</link><pubDate>Mon, 04 Jan 2016 10:11:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57399e7b-083a-4aa4-90c0-071d20f598ea</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;&amp;quot;NRF_POWER-&amp;gt;SYSTEMOFF = 1&amp;quot; will put the chip in system OFF sleep mode, which means that the chip will only wake up on gpio (this needs to be set up, like in the example). When the chip wakes up from system OFF sleep mode, the system will do a full reset. The RAMON part is to specify which RAM blocks should be on when system is ON, and which RAM blocks should be retained when the system goes to OFF mode. See the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.pdf.rm/nRF51_RM_v3.0.pdf"&gt;Reference Manual&lt;/a&gt; for more information on this part. The example configures 16 KB of RAM to be enabled in ON mode and retained in OFF mode.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what you mean by disable sleep. There is no function for this as it is not needed. If you don&amp;#39;t want to go to sleep, don&amp;#39;t call __WFE/sd_app_evt_wait() or NRF_POWER-&amp;gt;SYSTEMOFF = 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can someone explain to me how nordic nrf51822 sleep mode works?</title><link>https://devzone.nordicsemi.com/thread/40867?ContentTypeID=1</link><pubDate>Mon, 21 Dec 2015 08:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dec633d7-6bf3-40db-a6f1-a8e981ab9d1b</guid><dc:creator>adrianwong</dc:creator><description>&lt;p&gt;Btw, how the sleep is disable too?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can someone explain to me how nordic nrf51822 sleep mode works?</title><link>https://devzone.nordicsemi.com/thread/40868?ContentTypeID=1</link><pubDate>Mon, 21 Dec 2015 08:57:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5d0bda4-e4c4-4d08-b673-a35458111fc6</guid><dc:creator>adrianwong</dc:creator><description>&lt;p&gt;From the example that you sent, this is the line &amp;quot;NRF_POWER-&amp;gt;SYSTEMOFF = 1;&amp;quot; that make the system go into sleep? and what is this line&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_POWER-&amp;gt;RAMON = POWER_RAMON_ONRAM0_RAM0On   &amp;lt;&amp;lt; POWER_RAMON_ONRAM0_Pos
                 | POWER_RAMON_ONRAM1_RAM1On   &amp;lt;&amp;lt; POWER_RAMON_ONRAM1_Pos
                 | POWER_RAMON_OFFRAM0_RAM0Off &amp;lt;&amp;lt; POWER_RAMON_OFFRAM0_Pos
                 | POWER_RAMON_OFFRAM1_RAM1Off &amp;lt;&amp;lt; POWER_RAMON_OFFRAM1_Pos;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;doing? Kindly advice&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can someone explain to me how nordic nrf51822 sleep mode works?</title><link>https://devzone.nordicsemi.com/thread/40866?ContentTypeID=1</link><pubDate>Fri, 18 Dec 2015 11:22:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca9d5632-1267-44bc-9195-2d1eb3be9c71</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;There are two sleep modes on nRF51822, System ON sleep mode and System OFF sleep mode. In System ON sleep mode the CPU will wake up on any event. In System OFF sleep mode the CPU can only wake up on gpio, high value or voltage input crossing a certain value.&lt;/p&gt;
&lt;p&gt;System On sleep mode is the most used one since all peripherals can be active. This sleep mode is entered with the function __WFE() which is short for Wait For Event. However you will often see this code in examples:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;__SEV();
__WFE();
__WFE();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is because if the event flag is set when __WFE() is called, the function will clear the event flag and return immediately, therefore not go to sleep. __SEV() (Set EVent flag) sets the event flag, so __SEV() followed by __WFE() will clear the event flag without going to sleep. Then we are sure that in the next __WFE() the CPU will go to sleep. The SoftDevice function sd_app_evt_wait() will do the same as these calls and put the CPU to System ON sleep mode.&lt;/p&gt;
&lt;p&gt;sd_app_evt_wait() or the SEV WFE calls are often done inside the main while loop. After this call we can add code to be executed when the CPU wakes up from an event. You can also run code inside interrupts connected to the event, as these will run when the specific event happens and the system wakes up.&lt;/p&gt;
&lt;p&gt;See these &lt;a href="https://github.com/NordicSemiconductor/nrf51-powerdown-examples/blob/master/system-off-wakeup-on-gpio/main.c"&gt;examples&lt;/a&gt; on github.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>