<?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>impossible to get out of the poll during an interruption (manages the interruption and goes back to sleep)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65751/impossible-to-get-out-of-the-poll-during-an-interruption-manages-the-interruption-and-goes-back-to-sleep</link><description>Hello, I am on a NRF9160-DK and I am using SDK 1.3.0 I am working on the AWS_FOTA project. I&amp;#39;m trying to configure the sending of a message in MQTT when pressing a button. However, I ran into a problem with the poll which causes the processor to sleep</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Sep 2020 07:57:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65751/impossible-to-get-out-of-the-poll-during-an-interruption-manages-the-interruption-and-goes-back-to-sleep" /><item><title>RE: impossible to get out of the poll during an interruption (manages the interruption and goes back to sleep)</title><link>https://devzone.nordicsemi.com/thread/270477?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 07:57:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3def7fa0-d1d8-4897-9ccd-dec33051fd43</guid><dc:creator>lecozahu</dc:creator><description>&lt;p&gt;Okay thank you, &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hugo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: impossible to get out of the poll during an interruption (manages the interruption and goes back to sleep)</title><link>https://devzone.nordicsemi.com/thread/270475?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 07:55:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e33319e-fa1f-4dad-a55d-2822063f720f</guid><dc:creator>Simon</dc:creator><description>[quote user="lecozahu"]When there is a new message on the queue could it wake up the processor and ask it to process functions? do you have an example or a link to a documentation?[/quote]
&lt;p&gt;&amp;nbsp;I think &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/zephyr/reference/kernel/threads/workqueue.html"&gt;Workqueue Threads&lt;/a&gt; might be a good option for you.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: impossible to get out of the poll during an interruption (manages the interruption and goes back to sleep)</title><link>https://devzone.nordicsemi.com/thread/269041?ContentTypeID=1</link><pubDate>Thu, 10 Sep 2020 15:19:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:650c1906-d8e8-426f-9e89-f46f622813d0</guid><dc:creator>lecozahu</dc:creator><description>&lt;p&gt;Thank your for your help,&lt;/p&gt;
&lt;p&gt;the interrupt is triggered, because I pass a variable (flag to 1) during the interrupt and everything works.&lt;br /&gt;This flag is used when I return to the main to process the function I request, if the flag is activated then I execute a function.&lt;br /&gt;&lt;br /&gt;Getting out of the poll means getting out of sleep / waiting for me.&lt;br /&gt;Currently it falls asleep then processes the interrupt returns to sleep and performs the rest of the function then returns to the main. However, I would like the interruption to wake him from his sleep, process what he has to process in the poll and return in the main (without going back to sleep).&lt;br /&gt;(I have the impression that it goes back to sleep because the processing of the functions requested in the main is done a long time after and &lt;span class="tlid-translation translation" lang="en"&gt;&lt;span class="" title=""&gt;when I decrease the value of the variable&lt;/span&gt;&lt;/span&gt; the mqtt_keepalive variable the reaction is done very quickly)&lt;br /&gt;&lt;br /&gt;When there is a new message on the queue could it wake up the processor and ask it to process functions? do you have an example or a link to a documentation? &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Lecozahu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: impossible to get out of the poll during an interruption (manages the interruption and goes back to sleep)</title><link>https://devzone.nordicsemi.com/thread/269001?ContentTypeID=1</link><pubDate>Thu, 10 Sep 2020 13:19:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38deb225-4aa5-4537-b067-13b06b083706</guid><dc:creator>Simon</dc:creator><description>[quote user=""]When I press a button, the interrupt is triggered but does not allow you to get out of the poll.[/quote]
&lt;p&gt;Is the callback handler for the interrupt triggered? Try to add some logging or toggle a pin in the interrupt handler to verify this. What do you mean by &amp;quot;get out of the poll&amp;quot;? An interrupt should not cause the program execution to go past poll() onto the next line. It should only handle the interrupt by executing the handler and go back to poll() and wait for events.&lt;/p&gt;
&lt;p&gt;One approach could be to use Work Queues and when the button interrupt is triggered, you add the message you want to send to the Work Queue.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>