<?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>Configuring Interrupt falling edge not triggering the handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94111/configuring-interrupt-falling-edge-not-triggering-the-handler</link><description>Product: custom board on nRF52840 
 
 aliases { // MUTHU: This also working 
 ex10irq = &amp;amp; ex10_irq_n ; 
 }; 
 
 gpio_keys { 
 compatible = &amp;quot;gpio-keys&amp;quot; ; 
 
 ex10_irq_n:ex10_irq_n { 
 gpios = &amp;lt;&amp;amp; gpio1 15 ( GPIO_ACTIVE_LOW )&amp;gt;; 
 label = &amp;quot;ex10 irq&amp;quot; ; 
 status</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 26 Nov 2022 16:01:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94111/configuring-interrupt-falling-edge-not-triggering-the-handler" /><item><title>RE: Configuring Interrupt falling edge not triggering the handler</title><link>https://devzone.nordicsemi.com/thread/397749?ContentTypeID=1</link><pubDate>Sat, 26 Nov 2022 16:01:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e26125c0-513f-48d2-acb3-7a517ce5f613</guid><dc:creator>MUTHUKUMAR V</dc:creator><description>&lt;p&gt;Thanks Naeem!&lt;/p&gt;
&lt;p&gt;This helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuring Interrupt falling edge not triggering the handler</title><link>https://devzone.nordicsemi.com/thread/397229?ContentTypeID=1</link><pubDate>Wed, 23 Nov 2022 15:01:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a463cae-edfb-4702-b380-ab46c3554c86</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hi Muthukumar,&lt;/p&gt;
&lt;p&gt;Good to know that your project is working.&lt;/p&gt;
&lt;p&gt;As you have configured the pin, interrupt, and connected the callbacks. In the code, you can disable the interrupt by using instructions like:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//Disabling the interrupt
ret = gpio_pin_interrupt_configure_dt(&amp;amp;ex10_irq_st, GPIO_INT_DISABLE);
//Checking if disabled or not
if (ret != 0) {
    printk(&amp;quot;Error %d: failed to DISABLE interrupt on %s pin %d\n&amp;quot;,ret, button.port-&amp;gt;name, button.pin);
    return;
}
printk(&amp;quot;\r\nINT Disabled\n&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Regarding usage of &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;irq_enable(irqn)&lt;/span&gt; and &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;irq_disable(irqn)&lt;/span&gt; macros as defined in the Zephyr ISR APIs:&amp;nbsp;&lt;br /&gt;they require &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;irqn&lt;/span&gt;, that is irq line number. You can obtain this irqn using &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;DT_IRQN(nid)&lt;/span&gt; macro which takes node id and returns the irq number of that node. Use can use &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;DT_NODELABEL(nlabel)&lt;/span&gt; to get the node label of &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;nlabel&lt;/span&gt; node.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuring Interrupt falling edge not triggering the handler</title><link>https://devzone.nordicsemi.com/thread/396998?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2022 16:44:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71f2df50-8a5e-4c32-9880-0c52cacc80ff</guid><dc:creator>MUTHUKUMAR V</dc:creator><description>&lt;p&gt;Thanks for your reply!&lt;/p&gt;
&lt;p&gt;I can see it is getting called every time. I will keep you posted with details, if I observed this issue again.&lt;/p&gt;
&lt;p&gt;Added to that, How to enable and disable the interrupt from the code?&lt;/p&gt;
&lt;p&gt;After the initialization with the below steps.&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;ret&amp;nbsp;=&amp;nbsp;gpio_pin_configure_dt(&amp;amp;ex10_irq_st,&amp;nbsp;GPIO_INPUT);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;if&amp;nbsp;(ret&amp;nbsp;!=&amp;nbsp;0) {&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;printk(&amp;quot;Error&amp;nbsp;%d: failed to configure&amp;nbsp;%s&amp;nbsp;pin&amp;nbsp;%d\n&amp;quot;,&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret,&amp;nbsp;ex10_irq_st.port-&amp;gt;name,&amp;nbsp;ex10_irq_st.pin);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;return;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; }&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; ret = gpio_pin_interrupt_configure_dt(&amp;amp;ex10_irq_st, GPIO_INT_EDGE_FALLING);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;if (ret != 0) {&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printk(&amp;quot;Error %d: failed to configure %s pin %d\n&amp;quot;,&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret, ex10_irq_st.port-&amp;gt;name, ex10_irq_st.pin);&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; gpio_init_callback(&amp;amp;ex10_irq_cb, interrupt_handler, BIT(ex10_irq_st.pin));&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; gpio_add_callback(ex10_irq_st.port, &amp;amp;ex10_irq_cb);&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I middle of our implementation, i need to enable and disable lot many times.&lt;/p&gt;
&lt;p&gt;I can use the below API for enable and disable and it is safe to use in middle of the implementation?&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;gpio_pin_interrupt_configure_dt(&amp;amp;ex10_irq_st, GPIO_INT_EDGE_FALLING); // enable&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;gpio_pin_interrupt_configure_dt(&amp;amp;ex10_irq_st, GPIO_INT_DISABLE); // disable&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;or do we have any other means to enable/disable the interrupt?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I noticed irq_enable(irq number) as well in the documentation. if it ok to use, how can we get IRQ number from the above initialization? because we haven&amp;#39;t&amp;nbsp;provided the custom IRQ number during initialization.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Thanks,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;MUTHUKUMAR V&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuring Interrupt falling edge not triggering the handler</title><link>https://devzone.nordicsemi.com/thread/396927?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2022 13:19:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3884ff9-6b95-4225-8ad2-7225494b7c44</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hi Muthukumar,&lt;/p&gt;
&lt;p&gt;Thank you for contacting DevZone at NordicSemi.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Would you please send me the zip file of your minimal project (including overlays, configurations and main) so that I may flash on the DK and see the issue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>