<?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>detect wake up reason from deep sleep.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38405/detect-wake-up-reason-from-deep-sleep</link><description>Hello, 
 i have a application with two operating states state1: device is in deep sleep state 2: device is running 
 i wake up the device from deep sleep via gpio interrupt. this is working very well so far. 
 after flashing the firmware the device should</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Sep 2018 15:14:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38405/detect-wake-up-reason-from-deep-sleep" /><item><title>RE: detect wake up reason from deep sleep.</title><link>https://devzone.nordicsemi.com/thread/148251?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 15:14:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c588a87-ffe1-4687-8dbc-dd924c7806f2</guid><dc:creator>MaxRPEng</dc:creator><description>&lt;p&gt;Thats the solution. Great thank you so much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: detect wake up reason from deep sleep.</title><link>https://devzone.nordicsemi.com/thread/148245?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 14:52:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb001b79-292c-41e9-8076-07afbcfaacd1</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Likely my mistake, from the description of the register:&lt;br /&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=2_1_0_17_8_2#register.RESETREAS"&gt;http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=2_1_0_17_8_2#register.RESETREAS&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt;A field is cleared by writing &amp;#39;1&amp;#39; to it&lt;/span&gt;&amp;quot;.&amp;nbsp;So, then the procedure to clear the register is:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;int32_t reset_reason = 0;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;reset_reason = NRF_POWER-&amp;gt;RESETREAS;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;NRF_LOG_PRINTF(&amp;quot;reset_reason: 0x%08x.\n&amp;quot;,reset_reason );&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;NRF_POWER-&amp;gt;RESETREAS = NRF_POWER-&amp;gt;RESETREAS;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Make sure to write to RESETREAS before for instance softdevice is enabled.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: detect wake up reason from deep sleep.</title><link>https://devzone.nordicsemi.com/thread/148209?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 13:00:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad09cf5a-c140-4904-bc58-aaa3cc774934</guid><dc:creator>MaxRPEng</dc:creator><description>&lt;p&gt;Hello, thank you for your anwser. If i put this in my the top of my main.&lt;br /&gt;The device hangs up.&lt;/p&gt;
&lt;p&gt;Is there any example available?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: detect wake up reason from deep sleep.</title><link>https://devzone.nordicsemi.com/thread/148200?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 12:36:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eecfdeae-cef9-4071-9ab5-a2acff0abc99</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;You need to also clear the RESETREAS, else the value will be cumulative. So try with:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;int32_t reset_reason = 0;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;reset_reason = NRF_POWER-&amp;gt;RESETREAS;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;NRF_POWER-&amp;gt;RESETREAS = 0; // Edit: Wrong!&amp;nbsp;A field is cleared by writing &amp;#39;1&amp;#39; to it.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;NRF_LOG_PRINTF(&amp;quot;reset_reason: 0x%08x.\n&amp;quot;,reset_reason );&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>