<?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 sd_nvic_SetPriority with GPIOTE handler on nRF51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5450/how-to-use-sd_nvic_setpriority-with-gpiote-handler-on-nrf51822</link><description>Hmm... this should be a simple question. But I haven&amp;#39;t found a direct answer yet in the online SDK docs, the ARM NVIC docs, nor in this forum (and have only been confused by trying to work with the combination of them :-) 
 Im using the S110 SD, with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Feb 2015 21:44:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5450/how-to-use-sd_nvic_setpriority-with-gpiote-handler-on-nrf51822" /><item><title>RE: How to use sd_nvic_SetPriority with GPIOTE handler on nRF51822</title><link>https://devzone.nordicsemi.com/thread/19030?ContentTypeID=1</link><pubDate>Fri, 06 Feb 2015 21:44:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c8a51f1-056d-4db7-bd7e-18643796d82f</guid><dc:creator>Mike Wirth</dc:creator><description>&lt;p&gt;Stefan,
Thanks for the very informative and complete response.  I had already discovered some of what you described by tracing back through gpiote_init() and app_gpiote_init() in the interim.  But confirmation of that and the additional info on softdevice  interrupts is very useful. (Please consider adding this discussion to future documentation or sample code :-)&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
&lt;p&gt;PS: Re soft device interrupts, luckily I can control when my GPIOTE activity occurs and will use the soft device notification feature for radio activity to hold off my use of GPIOTE so that they don&amp;#39;t coincide.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use sd_nvic_SetPriority with GPIOTE handler on nRF51822</title><link>https://devzone.nordicsemi.com/thread/19029?ContentTypeID=1</link><pubDate>Fri, 06 Feb 2015 12:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffa9fc34-5cf1-4f7c-8d38-6808b99a06b4</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Mike&lt;/p&gt;
&lt;p&gt;Since you talk about registering a user I assume you are using the app_gpiote library. In the app_gpiote library, the priority of the GPIOTE interrupt is set to APP_IRQ_PRIORITY_HIGH in order for the library to operate properly. If you open for example the ble_app_bps in nRF51 SDK v6.1.0 you can see that the app_gpiote library is initialized with gpiote_init() in the main function which in turn calls the app_gpiote_init() function in app_gpiote.c. There you can see that the GPIOTE interrupt is set to APP_IRQ_PRIORITY_HIGH. So this interrupt should not be interrupted by other application interrupts since APP_IRQ_PRIORITY_HIGH is the highest application priority interrupt. Only softdevice interrupts have higher priority. More on how softdevice interrupts affects the GPIOTE interrupt can be found on &lt;a href="https://devzone.nordicsemi.com/question/15696/nrf51822-sense-pin-in-port-mode-doesnt-solve-the-gpiote-overconsumption-in-event-mode/?comment=15962#comment-15962"&gt;this thread&lt;/a&gt; and &lt;a href="https://devzone.nordicsemi.com/question/15811/how-to-use-timer-to-get-button-pushed-time/"&gt;this thread&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because the app_gpiote.c does not use the sd_* functions to set the GPIOTE priority (uses NVIC_*) you must call gpiote_init() before initializing the softdevice with ble_stack_init(). You should not attempt to change the priority dynamically, only set it during initialization.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>