<?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>Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80419/interrupts-on-third-party-board</link><description>Hello! 
 I am currently working with Actinius&amp;#39; Icarus IoT board and I&amp;#39;m trying to get the interrupts to work. This is the boards&amp;#39; pin layout: At the moment I have connected the 0 pin to a button and the 1 pin to a LED. My goal is to make the button trigger</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Jan 2022 12:18:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80419/interrupts-on-third-party-board" /><item><title>RE: Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/thread/347757?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 12:18:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0ca3c16-f648-4bc2-887e-f8a6da307a19</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Everything works with the second implementation? I would expect the first one to work if DT_NODELABEL were changed to DT_ALIAS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/thread/347754?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 12:00:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08bb4f30-ba86-4900-a060-9ca37844b1b2</guid><dc:creator>Baowz</dc:creator><description>&lt;p&gt;Yes, you are correct, the alias was a part of the problem. However, I got the error while I was trying to define the button like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define BUTTON_NODE    		DT_NODELABEL(sw1)
#define BUTTON_GPIO_LABEL	DT_GPIO_LABEL(BUTTON_NODE, gpios)
#define BUTTON_GPIO_PIN		DT_GPIO_PIN(BUTTON_NODE, gpios)
#define BUTTON_GPIO_FLAGS	GPIO_INPUT | DT_GPIO_FLAGS(BUTTON_NODE, gpios)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but this got fixed when I change it to this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define BUTTON_NODE    		DT_GPIO_PIN(DT_NODELABEL(sw1), gpios)
#define BUTTON_GPIO_LABEL	DT_GPIO_LABEL(BUTTON_NODE, gpios)
#define BUTTON_GPIO_FLAGS	GPIO_INPUT | DT_GPIO_FLAGS(BUTTON_NODE, gpios)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/thread/347740?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 11:14:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbb866a5-fea7-4ef1-809e-1464cd470d71</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;I see that I forgot to add aliases. Try this:&lt;/p&gt;
&lt;p&gt;overlay:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
    buttons {
        button1: button_1 {
            gpios = &amp;lt;&amp;amp;gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)&amp;gt;;
            label = &amp;quot;Push Button 2&amp;quot;;
        };
    };
    
    leds {
		button_led: led_3 {
			gpios = &amp;lt;&amp;amp;gpio0 1 GPIO_ACTIVE_LOW&amp;gt;;
			label = &amp;quot;Button LED&amp;quot;;
		};
	};

    aliases {
        led3 = &amp;amp;button_led;
		sw1 = &amp;amp;button1;
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;main.c changes:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Get button configuration from the devicetree sw0 alias. This is mandatory.
 */
#define SW1_NODE	DT_ALIAS(sw1)
#if !DT_NODE_HAS_STATUS(SW1_NODE, okay)
#error &amp;quot;Unsupported board: sw1 devicetree alias is not defined&amp;quot;
#endif
static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW1_NODE, gpios,
							      {0});
static struct gpio_callback button_cb_data;

/*
 * The led0 devicetree alias is optional. If present, we&amp;#39;ll use it
 * to turn on the LED whenever the button is pressed.
 */
static struct gpio_dt_spec led = GPIO_DT_SPEC_GET_OR(DT_ALIAS(led3), gpios,
						     {0});
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Let me know how that works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/thread/347264?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 17:54:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccd111de-35f5-4a34-ba4d-c6ee7b11c1e1</guid><dc:creator>Baowz</dc:creator><description>&lt;p&gt;When using the example you gave me I keep getting this error in the &amp;quot;devicetree_unfixed.h&amp;quot;:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;#39;DT_N_S_leds_S_led_3&amp;#39; undeclared (first use in this function); did you mean &amp;#39;DT_N_S_leds_led_3_ORD&amp;#39;?&lt;/pre&gt;Do you have any idea what causes this and how to fix it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/thread/333960?ContentTypeID=1</link><pubDate>Wed, 13 Oct 2021 13:24:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:240c6848-521a-4db6-98d8-bcda949f3190</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think it should be a big issue, but you just want to toggle the LED on a button press, right? In that case, you can probably remove the while loop and just handle the LED toggle in the button_pressed callback.&lt;/p&gt;
&lt;p&gt;Eventually you can look into entering system off mode, and having the interrupt as a wake-up source.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/thread/333733?ContentTypeID=1</link><pubDate>Tue, 12 Oct 2021 12:16:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3395babb-016f-4155-a2e1-9e5f667c420d</guid><dc:creator>Baowz</dc:creator><description>&lt;p&gt;This definitely helps, thank you! I also found the button sample you talked about, great help! However, I saw they are using a while loop for the interrupt. Is this necessary? If so, will this affect the power usage by a significant amount? My project currently tries to use as little power as possible so it can be run on solar power.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupts on third-party board.</title><link>https://devzone.nordicsemi.com/thread/333054?ContentTypeID=1</link><pubDate>Thu, 07 Oct 2021 12:47:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:658ab764-744e-4621-8020-38a8edeed091</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you taken a look at the button sample, found in the same folder as blinky? That shows how to use buttons with interrupts.&lt;/p&gt;
&lt;p&gt;You will likely also have to &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.0/zephyr/guides/dts/howtos.html#set-devicetree-overlays"&gt;add an overlay file&lt;/a&gt; where you configure the pins as a button and a LED.&lt;/p&gt;
&lt;p&gt;Looking at the actinius_icarus board files, something like this should work:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
    buttons {
        button1: button_1 {
            gpios = &amp;lt;&amp;amp;gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)&amp;gt;;
            label = &amp;quot;Push Button 2&amp;quot;;
        };
    };
    
    leds {
		button_led: led_3 {
			gpios = &amp;lt;&amp;amp;gpio0 1 GPIO_ACTIVE_LOW&amp;gt;;
			label = &amp;quot;Button LED&amp;quot;;
		};
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then you just combine the button and blinky samples, and modify the application to use the newly defined button and LED.&lt;/p&gt;
&lt;p&gt;If you run into any issues, let me know and I&amp;#39;ll do my best to help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>