<?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 block the code while interrupts are executing?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12113/how-to-block-the-code-while-interrupts-are-executing</link><description>Hello, 
 I am working with S110 stack and the custom application. I wanted to use the ADC driver with blocking and interrupts enabled. But the application is blocking and it blocked the ISR thereby I am not getting ADC interrupt too. This is the configuration</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Feb 2016 12:24:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12113/how-to-block-the-code-while-interrupts-are-executing" /><item><title>RE: How to block the code while interrupts are executing?</title><link>https://devzone.nordicsemi.com/thread/45824?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2016 12:24:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48859fb1-e1ce-4489-a6ea-f2f573c0a60e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;If you execute the code in this comment from &lt;code&gt;main()&lt;/code&gt; somehow rather than a interrupt, I do not see what the problem can be. You could always try to change the priority of ADC IRQ to &lt;code&gt;NRF_APP_PRIORITY_HIGH&lt;/code&gt;, though it should not be needed. What is the state of the ADC peripheral after it has been started? Could you check with a debugger?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to block the code while interrupts are executing?</title><link>https://devzone.nordicsemi.com/thread/45823?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2016 13:51:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a35e736-7606-4e3b-9464-39b3f13f482d</guid><dc:creator>sowmya</dc:creator><description>&lt;p&gt;Thank you for the reply. Yes I called it from main but still interrupt was not hitting and it was in the blocking statement &lt;code&gt;while(Conv_Completed == false);&lt;/code&gt;.
How to set the priority of the variable?&lt;/p&gt;
&lt;p&gt;Update: The code snippet will be like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void read_adc()
{
 Conv_Completed = false;
 NRF_ADC-&amp;gt;TASKS_START = 1;
 while(Conv_Completed == false);
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Yes previous I was calling from timer isr. Now I changed and calling from main, but still interrupt is not coming.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to block the code while interrupts are executing?</title><link>https://devzone.nordicsemi.com/thread/45822?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2016 13:40:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7b07655-1717-4cfa-8de0-63fcc816511d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;In your case, you must make sure that the priority of &lt;code&gt;ADC_IRQHandler()&lt;/code&gt; is higher than the priority where you wait for the &lt;code&gt;Conv_Completed&lt;/code&gt; flag. How do you call that piece of code? As you have this problem, it seems it&amp;#39;s called from a interrupt context. Either you should try to call it from the main context (effectively lowering its priority), or you need to increase the priority of &lt;code&gt;ADC_IRQHandler()&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>