<?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>How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4514/how-to-use-wfe-reliably</link><description>After reading the fine-print regarding WFE, I came to the conclusion that WFE can send the CPU to sleep even if interrupts are still pending. Such interrupts would not be able then to wake the CPU. In order to wake the CPU the interrupt has to occur while</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Nov 2023 12:39:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4514/how-to-use-wfe-reliably" /><item><title>RE: How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/thread/455751?ContentTypeID=1</link><pubDate>Wed, 15 Nov 2023 12:39:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84180bbf-d7d7-46a1-9a68-64736406d2b8</guid><dc:creator>pungent1188</dc:creator><description>&lt;p&gt;Well it happen to me, fast wakeup came from LIN device and bricked my product until power cycling.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/thread/16018?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 09:32:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27bb0582-9d32-4a3a-b085-cfbdb2ae576a</guid><dc:creator>gnf</dc:creator><description>&lt;p&gt;The link to the example is dead: &lt;a href="https://github.com/NordicSemiconductor/nrf51-powerdown-examples/blob/master/system-on-wakeup-on-gpio/main.c"&gt;github.com/.../main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Maybe this is linking to the same file: &lt;a href="https://github.com/NordicSemiconductor/nrf51-powerdown-examples/blob/master/system_on_wakeup_on_gpio/main.c"&gt;github.com/.../main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/thread/16015?ContentTypeID=1</link><pubDate>Thu, 20 Nov 2014 00:51:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5cd827f-3bb2-4f40-ab12-2fa8b41cc4e2</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Yes your code has a race condition in it, it&amp;#39;s possible for the interrupt to arrive between your test and the WFE. Unlikely, but possible.&lt;/p&gt;
&lt;p&gt;Setting SEVONPEND will cause the the event flag to be set every time there&amp;#39;s a pending interrupt, and WFE doesn&amp;#39;t sleep if the event flag is set. That should do what you want.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve found every time I looked into this that, despite the vast amount of documentation ARM writes about WFI and WFE, it&amp;#39;s very hard to find definitive answers to questions about exactly, precisely in all instances when the event flag is set .. and the books on Cortex tend to skate over it too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/thread/16017?ContentTypeID=1</link><pubDate>Wed, 19 Nov 2014 12:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9220d78-f87e-4f7b-9147-1366bb16729a</guid><dc:creator>Quax64</dc:creator><description>&lt;p&gt;Thanks, but these examples do not answer my question. I have __wfe() working already, but I need to verify that the CPU is reliably waking up again, even under very rare circumstances.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/thread/16014?ContentTypeID=1</link><pubDate>Wed, 19 Nov 2014 12:08:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbd21d34-0fd7-49bc-8ef1-db25d4fd9ac5</guid><dc:creator>Quax64</dc:creator><description>&lt;p&gt;For the time being, I would like to keep my code as simple as possible and rather not hide fundamental problems under another software layer. As far as I understand, sd_app_evt_wait() is anyway part of the SoftDevice which I don&amp;#39;t use.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/thread/16016?ContentTypeID=1</link><pubDate>Wed, 19 Nov 2014 12:05:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10da469c-2818-4c1a-a155-94310b78c289</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;If you are using softdevice, use the sd_app_evt_wait(). If you are not using softdevice, use the __WFE() as done in &lt;a href="https://github.com/NordicSemiconductor/nrf51-powerdown-examples/blob/master/system-on-wakeup-on-gpio/main.c"&gt;this example&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The __WFE() is also discussed on &lt;a href="https://devzone.nordicsemi.com/question/1555/how-do-you-put-the-nrf51822-chip-to-sleep/#reply-1589"&gt;this thread&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use WFE reliably?</title><link>https://devzone.nordicsemi.com/thread/16013?ContentTypeID=1</link><pubDate>Wed, 19 Nov 2014 11:34:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a221dd0c-e154-475b-9435-9e30dea0b66b</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;Have you had a look at sd_app_evt_wait() in nrf_soc?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>