<?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>nRF5340, gpio1 interrupt not occurring</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98508/nrf5340-gpio1-interrupt-not-occurring</link><description>I am using nRF5340DK, NCS 2.3. Interrupt occurs on gpio0, but not on gpio1. My code is below. 
 I checked all pins 0 to 15 of gpio1 but no interrupt occurred Is there anything I should check?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Apr 2023 13:05:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98508/nrf5340-gpio1-interrupt-not-occurring" /><item><title>RE: nRF5340, gpio1 interrupt not occurring</title><link>https://devzone.nordicsemi.com/thread/419716?ContentTypeID=1</link><pubDate>Tue, 11 Apr 2023 13:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:463a1053-5f96-475d-9a09-dcc19639a5bb</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;In order to use NRF_P1, you should declare &amp;quot;gpio0&amp;quot; and &amp;quot;gpio1&amp;quot; to use that port in your overlay, like here where P1.08 and P1.09 are used as buttons:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	buttons {
		compatible = &amp;quot;gpio-keys&amp;quot;;
		button0: button_0 {
			gpios = &amp;lt;&amp;amp;gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)&amp;gt;;
			label = &amp;quot;Push button 1&amp;quot;;
		};
		button1: button_1 {
			gpios = &amp;lt;&amp;amp;gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)&amp;gt;;
			label = &amp;quot;Push button 2&amp;quot;;
		};
	};
	aliases {
		sw0 = &amp;amp;button0;
		sw1 = &amp;amp;button1;
	};	
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When you define it like this, you can use the ncs\zephyr\samples\basic\button sample directly without any change in the firmware itself.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For your case, I tried your test program, changed to use P1.08 and P1.09 (ie. &amp;quot;gpio1&amp;quot; device on both pins) and that worked:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.2.99-ncs2 ***
name: gpio@842800, pins: 256
name: gpio@842800, pins: 512
name: gpio@842800, pins: 512
name: gpio@842800, pins: 256
name: gpio@842800, pins: 256
name: gpio@842800, pins: 256
name: gpio@842800, pins: 256
name: gpio@842800, pins: 256
name: gpio@842800, pins: 512
name: gpio@842800, pins: 512
name: gpio@842800, pins: 512
name: gpio@842800, pins: 512
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;At my end, the buttons are active low, so this is my slightly modified firmware with active low and pull-up on the pins:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;

#include &amp;lt;zephyr/sys/printk.h&amp;gt;

#define SLEEP_TIME_MS   10*60*1000

#define MY_PIN0 8
#define MY_PIN1 9

static const struct device *gpio0 = DEVICE_DT_GET(DT_NODELABEL(gpio0));
static const struct device *gpio1 = DEVICE_DT_GET(DT_NODELABEL(gpio1));

static struct gpio_callback gpio0_cb_data;
static struct gpio_callback gpio1_cb_data;

void cb(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
	printk(&amp;quot;name: %s, pins: %u\n&amp;quot;,dev-&amp;gt;name, pins);
}

void main(void)
{
	if (!device_is_ready(gpio0)) {
		return;
	}

	if (!device_is_ready(gpio1)) {
		return;
	}

	gpio_pin_configure(gpio1, MY_PIN0, GPIO_INPUT | GPIO_PULL_UP);
	gpio_pin_configure(gpio1, MY_PIN1, GPIO_INPUT | GPIO_PULL_UP);

	gpio_pin_interrupt_configure(gpio1, MY_PIN0, GPIO_INT_EDGE_FALLING);
	gpio_init_callback(&amp;amp;gpio0_cb_data, cb, BIT(MY_PIN0));
	gpio_add_callback(gpio1, &amp;amp;gpio0_cb_data);

	gpio_pin_interrupt_configure(gpio1, MY_PIN1, GPIO_INT_EDGE_FALLING);
	gpio_init_callback(&amp;amp;gpio1_cb_data, cb, BIT(MY_PIN1));
	gpio_add_callback(gpio1, &amp;amp;gpio1_cb_data);	

	while (1) {
        k_msleep(SLEEP_TIME_MS);
	}
}&lt;/pre&gt;&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>