<?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>What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/627/what-is-the-easiest-way-to-disable-all-interrupts</link><description>Using the nRF51822. I have a routine that should never be interrupted. What is the easiest way to disable all interrupts, and then re-enabling them?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 May 2014 06:38:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/627/what-is-the-easiest-way-to-disable-all-interrupts" /><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3228?ContentTypeID=1</link><pubDate>Fri, 23 May 2014 06:38:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b2be631-ece1-43d8-84b4-d51b24f736e8</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hi, It looks like the new Timeslot API feature in S110 v7 alpha may be able to do what you want. With that feature, you can request timeslots where the SoftDevice&amp;#39;s links is guaranteed to be idle, and you can for instance disable interrupts safely. It is possible to schedule such timeslots regularly at any interval, but there may be cases where the timeslot scheduled can be denied due to critical events in a connection, for example. This gets more likely the longer timeslots you request and the more often you request them, and also with shorter BLE connection intervals. So if your code can handle being denied to run once in a while, this should be suitable for you. If your code does not have as strict timing requirements and allow some variations in the interval, you could do even better, by requesting timeslots in a more clever way, based on your needs.&lt;/p&gt;
&lt;p&gt;See the S110 SoftDevice Specification and API-documentation for more details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3227?ContentTypeID=1</link><pubDate>Thu, 22 May 2014 22:49:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32893147-2015-4faf-ab7e-b505bc77600a</guid><dc:creator>Cameron Tacklind</dc:creator><description>&lt;p&gt;I have a similar requirement in my application and I would love more information regarding this.&lt;/p&gt;
&lt;p&gt;I need to turn off all interrupts so that I can guarantee a timed sequence of events. This sequence will always finish in &amp;lt;10us. Is this a short enough time to have interrupts off for the soft device to not barf?&lt;/p&gt;
&lt;p&gt;Is there some amount of time that I can turn off interrupts for less than and not interfere with the SD?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m also very curious to know more about &amp;quot;[...] using the radio notification feature to control when exactly you do this.&amp;quot;&lt;/p&gt;
&lt;p&gt;To put it another way, if I can regularly get a 10us window of disabled interrupts with maximum latency of ~10ms, I&amp;#39;d be very happy.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3226?ContentTypeID=1</link><pubDate>Mon, 05 May 2014 05:45:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfb78c4f-bd90-48bd-9ba7-2d87a9b49970</guid><dc:creator>felixk</dc:creator><description>&lt;p&gt;Hi Ole,
What about register that changes on read, like the EVENT_READY flag for SPI ?
I seem to be having problem with that, and the problem seems to go away if I use a timeout instead of just while(SPI-&amp;gt;EVENT_READY == 0);&lt;/p&gt;
&lt;p&gt;Yours,
Felix&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3225?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2014 12:03:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caf4091e-c666-476d-9d07-b59fad097abb</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;No, I don&amp;#39;t think that&amp;#39;s a correct assumption, since you should be able to use the critical regions to protect such code. As far as I&amp;#39;ve seen, RTOSes disable IRQs to protect against their own interrupts interfering with the data structures. However, in the case of the softdevice, it doesn&amp;#39;t change any state or data in the application space, and as such, it shouldn&amp;#39;t cause any problems for the RTOS if such an interrupt occurs, even when in a critical region.&lt;/p&gt;
&lt;p&gt;You may also have interest in taking a look at this: &lt;a target="_blank" href="https://devzone.nordicsemi.com/index.php/freertos" rel="nofollow"&gt;https://devzone.nordicsemi.com/index.php/freertos&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3224?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2014 17:34:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95b14cb7-9e62-44ef-a11c-e59a0acf4dc0</guid><dc:creator>Richard von Lehe</dc:creator><description>&lt;p&gt;Would it be fair to say that whenever the BLE stack is enabled, it is impossible to run any kind of tiny OS for the application?  It would appear that way, since most if not all OS require the use of critical sections (i.e. __disable_irq).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3223?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2013 12:26:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75cf26a3-88d3-4c01-8fc7-55f8a2bcee6d</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;I&amp;#39;ve edited and extended my answer above somewhat, but beware that this is a very scary thing to do that can have bad consequences.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3222?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2013 03:56:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f4377ae-1815-4fa9-a5bc-0c4945133e9e</guid><dc:creator>Pary Wu</dc:creator><description>&lt;p&gt;I think sd_nvic_critical_region_enter() _exit() will not be helpful.
Sometimes the reason which we need to disable all interrupts, in the MCU world, is to make a very short clock in GPIO by software. And in the this all-interrupt-disabled period, the GPIO clocks can made almost constantly, say, for 1us.
The problem is, if we do not have such the API&amp;#39;s to disable all interrupts, then the GPIO clocks cannot be made in this platform.
As we have known in 8051, the instruction is simply &amp;#39;EA=0&amp;#39;.
In the nRF51822 platform, I think it is still possible to do such the API by setting &amp;#39;cspie&amp;#39; registers; but it is usually can be used in the privileged mode...&lt;/p&gt;
&lt;p&gt;So is it possible that Nordic release which the &amp;#39;disable-all-interrupts&amp;#39; API&amp;#39;s for applications?
We know it has potentials to make BLE disconnected; but if it is used properly, it will not be disconnected...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the easiest way to disable all interrupts?</title><link>https://devzone.nordicsemi.com/thread/3221?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2013 12:18:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7482d591-7307-410f-a3ac-2ed256c86131</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;There is no way to disable all interrupts as long as the softdevice is enabled, since this will possibly make you lose the BLE connection.&lt;/p&gt;
&lt;p&gt;You can however disable all application interrupts by using sd_nvic_critical_region_enter()/_exit() functions.&lt;/p&gt;
&lt;p&gt;Edit: If however the softdevice is disabled, or it&amp;#39;s ok for your application to risk getting asserts back from the softdevice, you can use the CMSIS functions __disable_irq() and __enable_irq() to achieve this. Be aware that if you do this while in a connection or while advertising, you will get asserts if you&amp;#39;re unlucky with the timing. This problem can be reduced (and possibly avoided) by using the radio notification feature to control when exactly you do this, but this is anyway &lt;em&gt;not&lt;/em&gt; something we recommend to do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>