<?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>Maximum number of pin interrupts</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106693/maximum-number-of-pin-interrupts</link><description>Hi, 
 
 In this post Hung Bui states that there can only be &amp;quot;maximum 4 pin events, each for one GPIO pin (so max 4 pins at a time)&amp;quot;. This is (apperently) not true since I have 8 pins set up with individual interrupt callbacks and that works just fine</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Oct 2025 13:56:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106693/maximum-number-of-pin-interrupts" /><item><title>RE: Maximum number of pin interrupts</title><link>https://devzone.nordicsemi.com/thread/550503?ContentTypeID=1</link><pubDate>Thu, 02 Oct 2025 13:56:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad49965e-ea48-4e02-92ff-41db30398d7f</guid><dc:creator>Yaxit</dc:creator><description>&lt;p&gt;OMG this&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum number of pin interrupts</title><link>https://devzone.nordicsemi.com/thread/461230?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2023 09:14:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45b76078-e611-41fe-ab18-447304848198</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;It wraps around the function that you&amp;#39;re using:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-1/include/zephyr/drivers/gpio.h#L931"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-1/include/zephyr/drivers/gpio.h#L931&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you call the above with a GPIO_INT_EDGE* input, it will become GPIOTE allocated channel (unless it is masked in sense-edge-mask).&lt;/p&gt;
&lt;p&gt;A GPIO_INT_LEVEL* input will become a GPIOTE PORT event, where you can have as many as you have GPIOs available.&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><item><title>RE: Maximum number of pin interrupts</title><link>https://devzone.nordicsemi.com/thread/461119?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 15:14:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cc8fc87-118b-4d60-b49f-18c66b6f44df</guid><dc:creator>Eric Wiebols</dc:creator><description>&lt;p&gt;This is my configuration:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;gpio0&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;status&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;okay&amp;quot;&lt;/span&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;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;i.e no &amp;quot;sense-edge-mask = &amp;lt; 0x... &amp;gt;;&amp;quot; definition.&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;My (inherited) code uses&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;gpio_pin_interrupt_configure(). Maybe gpio_pin_interrupt_configure_dt() works differently ?&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: Maximum number of pin interrupts</title><link>https://devzone.nordicsemi.com/thread/460996?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 09:29:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:746f364d-1935-4c48-b9ec-90e8b74a53c8</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Eric,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I ran a test, where I added this loop to the zephyr/samples/basic/button:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	struct gpio_dt_spec test = {
		.port = button.port,
		.pin = 0,
		.dt_flags = button.dt_flags,
	};
	for (int i = 0; i &amp;lt; 10; i++) {
		test.pin = i;
		ret = gpio_pin_interrupt_configure_dt(&amp;amp;test,
							GPIO_INT_EDGE_TO_ACTIVE);
		if (ret != 0) {
			printk(&amp;quot;Error %d: failed to configure interrupt on %s pin %d\n&amp;quot;,
				ret, test.port-&amp;gt;name, test.pin);
			return 0;
		} else {
			printk(&amp;quot;Success: %d\n&amp;quot;, i);
		}
	}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This now shows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.5.0 ***
Success: 0
Success: 1
Success: 2
Success: 3
Success: 4
Success: 5
Success: 6
Success: 7
Error -12: failed to configure interrupt on gpio@842500 pin 8
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, If I add the below mentioned &amp;quot;sense-edge-mask&amp;quot;, I can configure more than 8:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.5.0 ***
Success: 0
Success: 1
Success: 2
Success: 3
Success: 4
Success: 5
Success: 6
Success: 7
Success: 8
Success: 9
Set up button at gpio@842500 pin 6
Set up LED at gpio@842500 pin 2
Press the button
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you certain that the &amp;quot;sense-edge-mask&amp;quot; is not configured in your overlay?&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><item><title>RE: Maximum number of pin interrupts</title><link>https://devzone.nordicsemi.com/thread/460768?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 10:18:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56adf348-7c86-47ec-9666-1baf98796976</guid><dc:creator>Eric Wiebols</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;Thank you for the feedback. I will look into using the &amp;quot;sense-edge-mask&amp;quot;.&amp;nbsp; However, I still think&amp;nbsp;&lt;strong&gt;gpio_pin_interrupt_configur&lt;/strong&gt;&lt;span&gt;e() should return an error if you try to configure more interrupts than are available in the chip. This would have saved me a lot of time trying to figure out what was going on.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;\Eric&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum number of pin interrupts</title><link>https://devzone.nordicsemi.com/thread/460765?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 10:11:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83021127-a246-47a8-a0f4-861e96b81318</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=""]In this post&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/650/maximum-number-of-interrupt-enabled-pins"&gt;Maximum number of interrupt enabled pins?&lt;/a&gt;&amp;nbsp;Hung Bui states that there can only be &amp;quot;maximum 4 pin events, each for one GPIO pin (so max 4 pins at a time)&amp;quot;.[/quote]
&lt;p&gt;This is true for GPIOTE IN channels for the nRF51-series devices.&lt;/p&gt;
&lt;p&gt;For nRF52-series devices, it is 8 GPIOTE IN channels:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/struct_nrf52/struct/nrf52.html?cp=5"&gt;https://infocenter.nordicsemi.com/topic/struct_nrf52/struct/nrf52.html?cp=5&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That being mentioned, you can still use level triggered wakeup sources, ie. GPIOTE PORT event. This can be set on all GPIOs if you want.&lt;/p&gt;
&lt;p&gt;To implement a software-emulated edge-triggered detection based on GPIOTE PORT event, you can use&amp;nbsp;&amp;quot;sense-edge-mask&amp;quot; in DeviceTree:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/88382/how-to-use-sense-edge-mask"&gt;How to use sense-edge-mask?&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&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>