<?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>Any simple method of setting sense input at 1st power cycle?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3441/any-simple-method-of-setting-sense-input-at-1st-power-cycle</link><description>I&amp;#39;d like to use the pin sense function as the power switch of my NRF51822 device. That is to say, after the very first power cycle (reset or battery change), the device goes into power off mode directly and wait for button input. Clicking the button will</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Aug 2014 04:51:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3441/any-simple-method-of-setting-sense-input-at-1st-power-cycle" /><item><title>RE: Any simple method of setting sense input at 1st power cycle?</title><link>https://devzone.nordicsemi.com/thread/12462?ContentTypeID=1</link><pubDate>Mon, 18 Aug 2014 04:51:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3820c8c-196a-4a7b-a27e-90c504211f5d</guid><dc:creator>scytulip</dc:creator><description>&lt;p&gt;Thanks. I found NRF_POWER-&amp;gt;RESETREAS is very useful.  (1) Reset Pin Pressed, NRF_POWER-&amp;gt;RESETREAS == 0x1; (2) Battery changed, NRF_POWER-&amp;gt;RESETREAS == 0; (3) Wakeup from GPIO, NRF_POWER-&amp;gt;RESETREAS == 0x1000; (4) Debug mode, NRF_POWER-&amp;gt;RESETREAS == 0x100. And when you access this register, don&amp;#39;t forget to clear it before next reset.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any simple method of setting sense input at 1st power cycle?</title><link>https://devzone.nordicsemi.com/thread/12461?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2014 12:35:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:107a1bd6-4b14-48e5-8f90-691604b8d93f</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;By switching off the power (either by switch or pulling battery), you will cause a Brownout reset.
After a brownout reset, none of the registers will be retained, not even RESETREAS.&lt;/p&gt;
&lt;p&gt;You will not be able to configure the SENSE at the very first cycles as the chip will first execute the startup procedure (clear RAM etc), but you can do this in the top of your main.&lt;/p&gt;
&lt;p&gt;Try using the reset-value of RESETREAS (see chapter 11.2.1) to your advantage to check if it&amp;#39;s a power-on-reset (ie: chip powered from 0 -&amp;gt; VDD).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
{
    if ( (NRF_POWER-&amp;gt;RESETREAS &amp;amp; RESETREAS_BITMASK) == 0)
    {
      /* set GPIO configuration and enable GPIOTE PORT event */
      /* Go to systemoff, wait for button press */
    }
    /* application continues here */
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cheers,
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>