<?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>[nRF51422] Using of GPREGRET</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/136/nrf51422-using-of-gpregret</link><description>Is it possible to write GPREGRET when S210 is running? Writing directly to register causing HardFault.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Jul 2013 17:01:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/136/nrf51422-using-of-gpregret" /><item><title>RE: [nRF51422] Using of GPREGRET</title><link>https://devzone.nordicsemi.com/thread/728?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2013 17:01:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89165ca3-f8c9-4dbf-a985-7dcdc7a8007e</guid><dc:creator>PW</dc:creator><description>&lt;p&gt;I knew about flashwrite solution, but I tried to avoid it. However in this situation, it will be best way.&lt;/p&gt;
&lt;p&gt;Best regards
PW&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51422] Using of GPREGRET</title><link>https://devzone.nordicsemi.com/thread/727?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2013 12:45:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e93e39a4-fd73-4d45-9a18-a488894d0940</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve misread your application.&lt;/p&gt;
&lt;p&gt;If you want to store variables after reset, you must store the variable to flash.
There&amp;#39;s an example on this in our SDK, which is called &amp;quot;flashwrite_example&amp;quot;.&lt;/p&gt;
&lt;p&gt;GPREGRET register will be cleared after reset. Same with RAM.&lt;/p&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51422] Using of GPREGRET</title><link>https://devzone.nordicsemi.com/thread/726?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2013 11:42:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c87cffb-57de-40f4-9751-cab425dab6ad</guid><dc:creator>PW</dc:creator><description>&lt;p&gt;I don&amp;#39;t use poweroff. What about RAM content when random reset occurs? Can I read unchanged variable when I use power_ramon function earlier (etc. at the beginning of the program) .&lt;/p&gt;
&lt;p&gt;Best regards
PW&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51422] Using of GPREGRET</title><link>https://devzone.nordicsemi.com/thread/725?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2013 10:46:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46a22ac5-9b03-461e-8da4-bb09e6d24c5d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Due to the RESETREAS register is PAN&amp;#39;ed in the current revision of the device, you must workaround this by powering on the RAM (since GPREGRET is unavailable in S210).&lt;/p&gt;
&lt;p&gt;Use the sd_power_ramon_set API call:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/**@brief Sets bits in the NRF_POWER-&amp;gt;RAMON register.
 *
 * @param[in] ramon Contains the bits needed to be set in the NRF_POWER-&amp;gt;RAMON register.
 *
 * @return ::NRF_SUCCESS
 */
uint32_t SVCALL(SD_POWER_RAMON_SET) sd_power_ramon_set(uint32_t ramon);

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This call is directly mapped 1:1 on how you would set the RAMON register.
If you set one variable declared within the area of RAM block 1, you can use this for checking wakeup source:
static uint8_t reset_reason_from_systemoff &lt;strong&gt;attribute&lt;/strong&gt;((at(0x20001000)));&lt;/p&gt;
&lt;p&gt;Set this before going into systemoff, and do a check when waking up again.&lt;/p&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51422] Using of GPREGRET</title><link>https://devzone.nordicsemi.com/thread/724?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2013 10:06:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a776f9a-73d6-49d5-a42d-b01c0e50ee52</guid><dc:creator>PW</dc:creator><description>&lt;p&gt;I must remember program status in case reset occurs. Can I do it in RAM?&lt;/p&gt;
&lt;p&gt;BR
PW&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51422] Using of GPREGRET</title><link>https://devzone.nordicsemi.com/thread/723?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2013 09:56:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d23fb44-28f4-4761-b819-f43c4a5b0bae</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Using the S210 stack, this is unfortunately not possible.
There is no API call to get/set this register.&lt;/p&gt;
&lt;p&gt;What are you trying to use this register for?
If you power on the RAM while going into sleep, you can retain your variables when awoken.&lt;/p&gt;
&lt;p&gt;BR
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>