<?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>Waking the nRF51 / 52 from SD_APP_EVT_WAIT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21786/waking-the-nrf51-52-from-sd_app_evt_wait</link><description>We have an ISR parsing incoming serial data from the UART. When a valid packet arrives, I&amp;#39;d like to be able to wake the core from whatever low-power state is entered when the sd_app_evt_wait() function is called within the main loop. 
 Is there an SOC</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 May 2017 16:54:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21786/waking-the-nrf51-52-from-sd_app_evt_wait" /><item><title>RE: Waking the nRF51 / 52 from SD_APP_EVT_WAIT</title><link>https://devzone.nordicsemi.com/thread/85581?ContentTypeID=1</link><pubDate>Thu, 04 May 2017 16:54:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d30ec9db-3d03-47fc-aa45-0af2610fdbce</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;I&amp;#39;m glad it worked out as expected.
If you could, please close out the question as &amp;quot;answer accepted&amp;quot;.  I&amp;#39;m trying to improve my points on the blog. Thanks in advance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Waking the nRF51 / 52 from SD_APP_EVT_WAIT</title><link>https://devzone.nordicsemi.com/thread/85580?ContentTypeID=1</link><pubDate>Thu, 04 May 2017 16:07:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1735dd8-a6b8-43ee-b848-5042924329b5</guid><dc:creator>Caleb C</dc:creator><description>&lt;p&gt;Awesome.  My own tests also confirm that execution continues.  In retrospect, it would be quite odd if the processor did not resume execution after waking to service a HW interrupt.&lt;/p&gt;
&lt;p&gt;The app_scheduler just queues up a callback function and executes in the main loop on a call to app_sched_execute().  We put that right after the call to sd_app_evt_wait() so that when the ISR returns, the more time-consuming code starts executing right away in the main context instead of in an ISR.  Pretty handy.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Waking the nRF51 / 52 from SD_APP_EVT_WAIT</title><link>https://devzone.nordicsemi.com/thread/85579?ContentTypeID=1</link><pubDate>Wed, 03 May 2017 18:21:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2da9a89-9eb9-4bba-a6e9-505a14eb3c1f</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Both according to the Nordic spec and according to my empirical evidence, execution continues at the command after the evt_wait when it returns from servicing the request.  It is for this reason it is normally put in a while or for loop at the end of main so that evt_wait is called after each wake up.  If you have general housekeeping to do in main then you can put code in the same loop with the evt_wait and it will execute each time the processor wakes up.&lt;/p&gt;
&lt;p&gt;However, if you have something more time sensitive to do in main, then it is my understanding the app_scheduler is the way to go.  However, I have never had need for the scheduler since all the important stuff in my code runs in handlers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Waking the nRF51 / 52 from SD_APP_EVT_WAIT</title><link>https://devzone.nordicsemi.com/thread/85578?ContentTypeID=1</link><pubDate>Wed, 03 May 2017 18:01:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ef835eb-1cc6-48c0-a56b-733fbf878688</guid><dc:creator>Caleb C</dc:creator><description>&lt;p&gt;Of course the ISR runs.  But when it exits, does execution begin immediately after sd_app_evt_wait(), or does the processor go back to sleep and wait for an app or SOC event to continue operation?&lt;/p&gt;
&lt;p&gt;Regarding events, I found the app_scheduler in the SDK, and it should do nicely.  We just want to make sure that the main loop continues operation right away after the ISR returns, even if the core was sleeping due to a call to sd_app_evt_wait().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Waking the nRF51 / 52 from SD_APP_EVT_WAIT</title><link>https://devzone.nordicsemi.com/thread/85577?ContentTypeID=1</link><pubDate>Wed, 03 May 2017 17:48:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:413ca9c3-4b33-48d9-8a6c-5355a4c66b6b</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;You don&amp;#39;t have to do anything.  The interrupt request will automatically wake the processor so that your interrupt handler can run.  And, regarding can custom events be added...  Yes, essentially anything that generates an interrupt (timers, gpio, comms, etc.) will wake the processor so that they will be serviced.  The only caveat is that your interrupts will wait to be serviced until the SD is done handling TX or RX activity.&lt;/p&gt;
&lt;p&gt;See here: &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v7.x.x/doc/7.1.0/s110/html/a01075.html#ga11d88d38ac99fb72cde74c9385d36433"&gt;developer.nordicsemi.com/.../a01075.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>