<?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>Wakeup from RTC only</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66856/wakeup-from-rtc-only</link><description>Hello - 
 
 We are developing an application for nRF52840, using the v17.0.0 SDK. The application is running on FreeRTOS. We need to power off all the RAM and use the RTC to wakeup after a specified time. To do that I borrowed the SDK tickless idle code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Oct 2020 14:38:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66856/wakeup-from-rtc-only" /><item><title>RE: Wakeup from RTC only</title><link>https://devzone.nordicsemi.com/thread/274383?ContentTypeID=1</link><pubDate>Mon, 12 Oct 2020 14:38:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcf8ec4b-aab9-4c05-9095-1c78b65fe93a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Brian&lt;/p&gt;
&lt;p&gt;The code you sent should work fine, as long as the RTC event register is not cleared anywhere else.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup from RTC only</title><link>https://devzone.nordicsemi.com/thread/274163?ContentTypeID=1</link><pubDate>Sun, 11 Oct 2020 15:04:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e8fbd62-53b5-4120-ad2d-7fc6c8769772</guid><dc:creator>bfriedk1</dc:creator><description>&lt;p&gt;&lt;span&gt;Torbj&amp;oslash;rn -&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for the reply. I noticed that the SDK&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/rtc_example.html?cp=7_1_4_6_34"&gt;RTC&lt;/a&gt;&amp;nbsp;example shows how to specify an interrupt handler and reworked our code to use that technique. That worked well, but fails when I power off all the RAM, even when I store the RTC instance in one retained section of RAM.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The code I originally shared works when powering off RAM, so I looked for another way to know if the interrupt triggered corresponds to the RTC. This seems to work:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;do {
	__WFE();
} while (!nrf_rtc_event_pending(portNRF_RTC_REG, NRF_RTC_EVENT_COMPARE_0));
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My hope is that the (inlined) function returns true when the counter compare interrupt fires. Would you agree?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Brian&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup from RTC only</title><link>https://devzone.nordicsemi.com/thread/273756?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 12:54:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95f2eb45-e39b-48db-bb41-0e97b7547229</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using __WFE() or sd_app_evt_wait() will wake you up on any interrupt that occurs, assuming that interrupt is enabled through the&amp;nbsp;interrupt controller, that is correct.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The normal way to handle this is to implement the interrupt handler, and set a flag or run some other code there. Then you can check this flag in your while loop, and only exit when the flag is set.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>