<?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>nrf51822 wake-up on interrupt and send advertisement</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4415/nrf51822-wake-up-on-interrupt-and-send-advertisement</link><description>I want, without success, to wake-up from SYSTEM OFF state, send advertisements with some custom data and go back to sleep. 
 The counter value is always 0, instead of being incremented on every wake-up and saved in the retention register. 
 What is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Nov 2014 12:23:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4415/nrf51822-wake-up-on-interrupt-and-send-advertisement" /><item><title>RE: nrf51822 wake-up on interrupt and send advertisement</title><link>https://devzone.nordicsemi.com/thread/15678?ContentTypeID=1</link><pubDate>Wed, 12 Nov 2014 12:23:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5078d9aa-f345-4f34-9952-ac6b1e5d6de2</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Did Konstantin provide an adequate answer to your problem? If so, please accept his answer by pressing the accept icon below the voting arrows.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 wake-up on interrupt and send advertisement</title><link>https://devzone.nordicsemi.com/thread/15677?ContentTypeID=1</link><pubDate>Tue, 11 Nov 2014 14:32:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49de3663-4b20-4bfd-9036-c7c71db9ad9a</guid><dc:creator>Attilio Dona&amp;amp;#39;</dc:creator><description>&lt;p&gt;Ok,&lt;/p&gt;
&lt;p&gt;My error was invoking sd_power_gpregret_get(&amp;amp;counter) before ble_stack_init(), where softdevice is enabled.&lt;/p&gt;
&lt;p&gt;Thanks for your suggestion about using sd_power_gpregret_set, the correct way in this case is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  sd_power_gpregret_clr(0xffffffff);
  sd_power_gpregret_set(counter);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Greetings
Attilio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 wake-up on interrupt and send advertisement</title><link>https://devzone.nordicsemi.com/thread/15675?ContentTypeID=1</link><pubDate>Tue, 11 Nov 2014 13:48:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ed0a276-2d5c-4976-a915-953743861e26</guid><dc:creator>Attilio Dona&amp;amp;#39;</dc:creator><description>&lt;p&gt;I see 0 in the debugger. When invoking sd_power_gpregret_set counter is set to 1 but at the next wakeup after sd_power_gpregret_get(&amp;amp;counter) counter is still 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 wake-up on interrupt and send advertisement</title><link>https://devzone.nordicsemi.com/thread/15676?ContentTypeID=1</link><pubDate>Tue, 11 Nov 2014 13:35:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1eb0f45-a787-47f1-a4d1-4676098cc985</guid><dc:creator>Konstantin K</dc:creator><description>&lt;p&gt;Where are you seeing 0, in the code with debugger or in the advertisement packet?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 wake-up on interrupt and send advertisement</title><link>https://devzone.nordicsemi.com/thread/15679?ContentTypeID=1</link><pubDate>Tue, 11 Nov 2014 13:33:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a763578-e403-407c-8e9d-bf609dfc5883</guid><dc:creator>Konstantin K</dc:creator><description>&lt;p&gt;One thing I see is that you&amp;#39;re using sd_power_gpregret_set() incorrectly.  This functions takes a mask (rather than value) and sets the gpregret bits that are masked as 1s.  This would work fine the first time you use it, but all subsequent values would just keep adding ones to gpregret.  So calling it with 3 and then 4 would results in 7 in gpregret.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/documentation/nrf51/6.1.0/s110/html/a00937.html#ga08156c79e367410cf7afc784f6189f31"&gt;devzone.nordicsemi.com/.../a00937.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>