<?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>Early wake-up from POWER/CLOCK IRQ when using RTC to wake up</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70091/early-wake-up-from-power-clock-irq-when-using-rtc-to-wake-up</link><description>Hello - 
 
 We are developing on a nRF52840 device, SDK v17.0.2 and FreeRTOS. Following the flow in the provided by the vPortSuppressTicksAndSleep() function, we&amp;#39;ve implemented a function to wake-up from RTC or any interrupt in System ON sleep mode. Our</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 05 Jan 2021 23:12:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70091/early-wake-up-from-power-clock-irq-when-using-rtc-to-wake-up" /><item><title>RE: Early wake-up from POWER/CLOCK IRQ when using RTC to wake up</title><link>https://devzone.nordicsemi.com/thread/287598?ContentTypeID=1</link><pubDate>Tue, 05 Jan 2021 23:12:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6abd0bfb-c31b-4b19-94b7-135fc979e75b</guid><dc:creator>bfriedk1</dc:creator><description>&lt;p&gt;Hello -&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the suggestions. The LFCLK is started at application launch when the RTC is initially configured. In our sleep function we basically reprogram the RTC for wake-up from System ON sleep after a specified period of time.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I looked at the events and enabled interrupts per your suggestion.&amp;nbsp;I think I found the problem. The LFCLKSTARTED interrupt was enabled and after the __WFE() loop exits, the&amp;nbsp;&lt;span&gt;EVENTS_LFCLKSTARTED event was generated. To resolve that I disabled LFLCK interrupts before&amp;nbsp;entering the loop:&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="c_cpp"&gt;nrf_clock_int_disable(CLOCK_INTENSET_LFCLKSTARTED_Msk);
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;That seems to resolve the issue and wait&amp;nbsp;loop no longer exits early:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;do {
  __WFE();
} while (0 == (NVIC-&amp;gt;ISPR[0] | NVIC-&amp;gt;ISPR[1]));&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;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Brian&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Early wake-up from POWER/CLOCK IRQ when using RTC to wake up</title><link>https://devzone.nordicsemi.com/thread/287508?ContentTypeID=1</link><pubDate>Tue, 05 Jan 2021 12:46:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f8a8b80-ca0d-44be-96e3-8a8352e53404</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you starting the LFCLK together with the RTC? If you are, how do you do this?&lt;/p&gt;
&lt;p&gt;You can read out the&amp;nbsp;&lt;a title="Registers" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/power.html?cp=4_0_0_4_2_6#unique_240432348"&gt;POWER Registers&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a title="Registers" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/clock.html?cp=4_0_0_4_3_2#topic"&gt;CLOCK Registers&lt;/a&gt;&amp;nbsp;with your debugger to see which EVENTS have been generated, and which interrupts are enabled (in the INTENSET registers).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>