<?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>nrf9160 interrupts
 
 

 
{</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61812/nrf9160-interrupts</link><description>Dear Sir. 
 I have a question regarding the nRF9160 Interrupt procedure. 
 I have 2 interrupts on my nRF9160 custom board. 
 The 1st interrupt is an external interrupt every 2mSec. 
 Set up for the external interrupt : 
 
 void AFE4900_Interrupt_Config</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Jun 2020 12:52:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61812/nrf9160-interrupts" /><item><title>RE: nrf9160 interrupts
 
 

 
{</title><link>https://devzone.nordicsemi.com/thread/252744?ContentTypeID=1</link><pubDate>Tue, 02 Jun 2020 12:52:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf62902d-6f09-4658-8fc1-236afcf3a443</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ephraim"]Where can I find the document of how to set the priority GPTIOE 49,0 ?.[/quote]
&lt;p&gt;The description in dts is available, but not the usage of the magic number corresponding to the NVIC IRQn number:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/master/dts/bindings/interrupt-controller/arm%2Cv8m-nvic.yaml"&gt;https://github.com/zephyrproject-rtos/zephyr/blob/master/dts/bindings/interrupt-controller/arm%2Cv8m-nvic.yaml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have opened up a discussion with the developers on how this can be made easier. This vector-number corresponds to the GPIOTE_IRQn define. For nRF9160, in non-secure mode, it is this one:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/mdk/nrf9160.h#L113"&gt;https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/mdk/nrf9160.h#L113&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note that this number will be different if you run on nRF52832, 840, etc. Then you have to manually check the &amp;quot;IRQn_Type&amp;quot; number for that specific device.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll be sure to bring this tedious configuration up with the developers, and see if we can get a better solution in the future.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 interrupts
 
 

 
{</title><link>https://devzone.nordicsemi.com/thread/252529?ContentTypeID=1</link><pubDate>Sun, 31 May 2020 06:35:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f8a8dd7-1d88-49b8-bb99-c61df8c2814f</guid><dc:creator>ephraim</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It works , Many thanks&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;One more question before I close this post .&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Where can I find the document of how to set the priority GPTIOE 49,0 ?.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 interrupts
 
 

 
{</title><link>https://devzone.nordicsemi.com/thread/251975?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 13:32:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f138f185-dec2-4ca7-a210-3f4d38b2f565</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]k_timer_init(&amp;amp;my_timer, my_expiry_function, NULL);[/quote]
&lt;p&gt;&amp;nbsp;This will run in interrupt priority, which is inherited from the kernel timer instance RTC1, which is hardcoded with this priority:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/timer/nrf_rtc_timer.c#L102"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/timer/nrf_rtc_timer.c#L102&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I wouldn&amp;#39;t recommend changing this.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]How can I set the external interrupt to have higher priority than the timer interrupt ?.[/quote]
&lt;p&gt;GPIOTE needs to have a higher priority than RTC1, which has &amp;#39;1&amp;#39;, so you&amp;#39;ll need GPIOTE prio to &amp;#39;0&amp;#39;.&lt;/p&gt;
&lt;p&gt;This can be done by creating a $board_name.overlay file (nrf9160_pca10090ns.overlay if using ncs tag v1.2.0, nrf9160dk_nrf9160ns.overlay on current master) holding your configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;amp;gpiote {
    status = &amp;quot;okay&amp;quot;;
    interrupts = &amp;lt;49 0&amp;gt;;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tested the above with the zephyr/samples/basic/button, where I added this to the button callback:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void button_pressed(struct device *gpiob, struct gpio_callback *cb,
		    u32_t pins)
{
	printk(&amp;quot;Button pressed at %&amp;quot; PRIu32 &amp;quot;\n&amp;quot;, k_cycle_get_32());
	printk(&amp;quot;GPIOTE ISR Prio: %d\n&amp;quot;, NVIC_GetPriority(GPIOTE1_IRQn));
	printk(&amp;quot;RTC1 ISR Prio: %d\n&amp;quot;, NVIC_GetPriority(RTC1_IRQn));
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And it now prints this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Button pressed at 26472
GPIOTE ISR Prio: 1
RTC1 ISR Prio: 2
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A side note:&amp;nbsp;In DTS, the number is offset by &amp;#39;1&amp;#39; compared to what is read out from the NVIC (NVIC_GetPriority(...)). 0 in DTS -&amp;gt; 1 when you read NVIC directly.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this and see if it works better?&lt;/p&gt;
&lt;p&gt;You can also consider to use a system workqueue when handling larger non-timing critical logic in interrupt handlers.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>