<?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>Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101974/controller-sleep-mode-and-wake-up</link><description>Dear Sirs! 
 I use SDK 12.2. I need without RTOS to put controller in sleep mode (but not OFF mode) and be able to wake it up by pressing button, connected to GPIO. 
 GPIO with interrupt. I am confused how to do it? Please explain how to set it in deep</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Aug 2023 07:28:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101974/controller-sleep-mode-and-wake-up" /><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/441510?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2023 07:28:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:762bd387-7dae-414a-89ce-edc746a38c28</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Please look at the /peripheral examples how it is used. Typically the 3 lines of code is executed in an infinite for(;;) loop in main, to ensure that the chip in system ON idle while waiting for interrrupts or events to wakeup the chip.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/441404?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2023 13:29:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcca625d-d16a-42a4-b8dc-477b0fde37a2</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;Thank you. But can you please explain more detailed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I need to enter to sleep mode? shall I call this?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;// Clear the event register.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;__SEV();&lt;/span&gt;&lt;br /&gt;&lt;span&gt;__WFE();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What will happen when any interrupt? Instruction after&amp;nbsp;__WFE(); will be performed?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/441399?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2023 13:13:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:914c6241-9a83-4be1-9b2a-30160306726d</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;The chip will enter system ON idle by calling&amp;nbsp;sd_app_evt_wait() if you are using an application with a softdevice, or if you are not using a softdevice you can use:&lt;/p&gt;
&lt;p&gt;// Wait for an event.&lt;br /&gt; __WFE();&lt;/p&gt;
&lt;p&gt;// Clear the event register.&lt;br /&gt; __SEV();&lt;br /&gt; __WFE();&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/440420?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 08:13:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f582579f-3358-4f6d-8e1e-e42f3c2f1bca</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;OFF mode is a very good solution, but what shall I do if I need to remain controller in ON mode to allow using of RTC? How can I send controller to sleep, but ON mode?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/438846?ContentTypeID=1</link><pubDate>Sat, 29 Jul 2023 10:36:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3040e5dc-1680-4a40-8952-879f98fe6b6a</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437782?ContentTypeID=1</link><pubDate>Mon, 24 Jul 2023 06:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d65d4a6-938a-4d3a-a391-db4982ea2e6c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, &amp;#39;POWER&amp;#39; includes two general purpose retention registers&amp;nbsp;(see&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html#register.GPREGRET"&gt;GPREGRET&lt;/a&gt;).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437757?ContentTypeID=1</link><pubDate>Sun, 23 Jul 2023 07:28:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d80299d-95dd-40f7-bd0b-51d53d64d647</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;But regarding to all this there is additional question. Is in nRF52832 any general purpose register that I can init with any value before software reset and after software reset read correct value from this register. I need it&amp;nbsp; to prevent OFF mode after firmware upgrade via BLE&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437756?ContentTypeID=1</link><pubDate>Sun, 23 Jul 2023 06:29:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a713403-4315-4a14-9428-6fec8087944e</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;Thanks. It was a good idea. It works&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437144?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2023 07:35:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5dd3f56-e407-4e09-b409-0ae3a2d91c64</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The GPIO configurations, including the pull-up setting are retained in system OFF.&amp;nbsp; &lt;span&gt;Please try the code I posted and read the linked documentation.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437132?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2023 06:41:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3b4c373-f88a-4401-a7ad-7064ef85f838</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;And additional question. What happen with internal pull up resistors in OFF mode? Will it work or I need to add external pull up resistor?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437039?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 13:21:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06823f7b-1d2c-4692-959a-9b576f40dc38</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;This may be a good solution. But when device wake up from OFF mode, what happen? Reset with&amp;nbsp;RESETREAS register bit&amp;nbsp;RW OFF = 1 ? Is it correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437029?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 13:03:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65703eef-7c46-40a8-9c91-719cb010d4ac</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You can have the device wake-up from a&amp;nbsp;GPIO input event in&amp;nbsp;&lt;a title="System OFF mode" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=5_2_0_17_1#unique_2047546596"&gt;System OFF mode&lt;/a&gt;. The implementation may look something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;nrf_gpio.h&amp;quot;


void enter_system_off(void) 
{
    /* Configure wake-up pin */
    nrf_gpio_cfg_sense_input(BUTTON_1, GPIO_PIN_CNF_PULL_Pullup, NRF_GPIO_PIN_SENSE_LOW);

    NRF_POWER-&amp;gt;SYSTEMOFF = 1;
    while(1);
}

/**@brief Application main function.
 */
int main(void)
{
    /* Enter system OFF mode after POR/BOR reset and wait for button press to trigger wake-up */
    if (NRF_POWER-&amp;gt;RESETREAS == 0)
    {
        enter_system_off();
    }
    ...&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437010?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 12:25:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dffff6f2-dcd1-49d9-86fc-f976bb846517</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;Because as I know in OFF mode chip cannot wake up from GPIO interrupt. Only reset. May be I am wrong. Please explain&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437008?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 12:22:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d85c7601-1d80-4f6a-b991-87de93231104</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for the clarification. But&amp;nbsp;can you also explain why&amp;nbsp;you don&amp;#39;t want the chip to enter System OFF mode?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/437007?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 12:17:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ac54663-deb7-40cc-b4ab-95531ad2049c</guid><dc:creator>PMichael</dc:creator><description>&lt;p&gt;Thank you. But function&amp;nbsp;&lt;/p&gt;
&lt;p&gt;static void power_manage(void)&lt;br /&gt;{&lt;br /&gt; uint32_t err_code = sd_app_evt_wait();&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;call softdevice function. I need to do it really in the beginning of start immediately after battery insertion. I need to set controller in sleep mode until button pressed. Pressing button shall switch the device on.&lt;/p&gt;
&lt;p&gt;I cannot call any soft device functions.&lt;/p&gt;
&lt;p&gt;How to do it without RTOS and without soft device functions?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controller sleep mode and wake up</title><link>https://devzone.nordicsemi.com/thread/436978?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 11:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87a90bbd-fc43-404c-ae73-ccc5d8efe30c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Regarding the SCB register, please see my reply in this post:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/90910/nrf_pwr_mgmt_run-impact-of-scb_scr_sleepdeep_msk/381524"&gt;RE: nrf_pwr_mgmt_run impact of SCB_SCR_SLEEPDEEP_Msk&lt;/a&gt;&amp;nbsp;. SCB is an ARM Cortex-specific register. Therefore, it is covered by the ARM documentation and not by our product specification.&lt;/p&gt;
[quote user=""]GPIO with interrupt. I am confused how to do it? Please explain how to set it in deep sleep?.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can call power_manage() from your main loop as we do in our examples. This will make the chip enter&amp;nbsp;&lt;a title="System ON mode" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=5_2_0_17_2#unique_1905852297"&gt;System ON mode&lt;/a&gt;&amp;nbsp;when there is no work to do.&lt;/p&gt;
[quote user=""]Will controller perform next instruction after wake up and interrupt processing?[/quote]
&lt;p&gt;The program will return to the code following your sleep function after processing the interrupt(s).&lt;/p&gt;
[quote user=""]In all examples I see code&amp;nbsp;[/quote]
&lt;p&gt;Isn&amp;#39;t it only in the FreeRTOS example? Setting this bit is redundant anyway.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>