<?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>GPIO wakeup from system OFF under FreeRTOS restarts at address 0x00000A80</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55486/gpio-wakeup-from-system-off-under-freertos-restarts-at-address-0x00000a80</link><description>Hello - 
 
 We are using SDK 15.3.0, FreeRTOS and the nRF52840-DK board with SES. We implemented wakeup from System Off sleep using the nrf_gpio_cfg_sense_input() API, which seems to work: 
 
 
 When we run our debug build and wakeup from System Off sleep</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Dec 2019 15:30:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55486/gpio-wakeup-from-system-off-under-freertos-restarts-at-address-0x00000a80" /><item><title>RE: GPIO wakeup from system OFF under FreeRTOS restarts at address 0x00000A80</title><link>https://devzone.nordicsemi.com/thread/225212?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 15:30:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc0816ff-8df8-4f05-bc05-d26f7a125997</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Brian,&lt;/p&gt;
&lt;p&gt;The emulated SYSTEM_OFF mode and the emulated wakeup from RAM_RETENTION memory might not go well together.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="bfriedk1"] I found that if I press the reset button instead of the sense button the first time I run the app, I can then press the sense button after the next SYSTEM_OFF and I don&amp;#39;t end up in the hard fault handler.[/quote]
&lt;p&gt;&amp;nbsp;This makes sense. The pin reset or the reset button should bring the device out out of debug mode. And hence the SYSTEM_OFF mode will not be emulated there after. And that explains why there are no hardfaults after pressing the reset button.&lt;/p&gt;
&lt;p&gt;Like you already figured out, I do not think this is going to affect your actual release version of your product. It is just that the SYSTEM_OFF + RAM_RETENTION (emulation) are not designed to work together with the debugger.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO wakeup from system OFF under FreeRTOS restarts at address 0x00000A80</title><link>https://devzone.nordicsemi.com/thread/225053?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 02:02:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbbbf508-641d-4e36-87c3-5d0d14c5cb54</guid><dc:creator>bfriedk1</dc:creator><description>&lt;p&gt;Susheel -&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the quick reply and additional details. Much appreciated. I wasn&amp;#39;t aware that system OFF mode was emulated in debug mode, though that does make sense.&lt;/p&gt;
&lt;p&gt;I also now see that the ram_retention example enters an&amp;nbsp;infinite loop after calling SYSTEM_OFF mode. I did the same in my application, but unfortunately I am still ending up in the hard fault handler after pressing the sense button. After some experimentation I found that if I press the reset button instead of the sense button the first time I run the app, I can then press the sense button after the next SYSTEM_OFF and I don&amp;#39;t end up in the hard fault handler. Our test app repeatedly enters SYSTEM_OFF after a delay.&lt;/p&gt;
&lt;p&gt;Because the ram_retention app doesn&amp;#39;t have this behavior, I suspect the failure is due to our app running under FreeRTOS. The SYSTEM_OFF is called from a FreeRTOS task. Are there additional calls required to achieve the same behavior as the ram_retention app from debug builds running FreeRTOS?&lt;/p&gt;
&lt;p&gt;I do understand that release builds should behave properly. We are working towards getting our release build up and running.&amp;nbsp;Just a little concerned that the behavior we are experiencing is different under FreeRTOS.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Brian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO wakeup from system OFF under FreeRTOS restarts at address 0x00000A80</title><link>https://devzone.nordicsemi.com/thread/224910?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 12:19:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b890ae3-4b0f-43b9-bd8d-f4247c37c3be</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The&amp;nbsp; System OFF mode does not work in debug mode. It is just emulated as mentioned &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&amp;amp;cp=4_0_0_4_2_2_0&amp;amp;anchor=unique_142049681"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So it is recommended that if have an infinite while loop just after calling the SYSTEM_OFF mode in your application. That way when you start your program in debug mode, the instructions after the SYSTEM_OFF call are also executed. Most likely in your application the main function is exited causing the CPU to execute illegal instructions causing hardfault. Address&amp;nbsp;&lt;span&gt;0x00000A80 seems to be the hardfault handler address inside the MBR in the softdevice.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;but in non debug mode, the instructions after the SYSTEM_OFF call are never reached.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>