<?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>Help figuring out why my GPIO interrupt handler not being called - Zephyr 3.2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101226/help-figuring-out-why-my-gpio-interrupt-handler-not-being-called---zephyr-3-2</link><description>I&amp;#39;m pulling my hair out here; I have a custom board with an nrf52840 on it, and my code is using Zephyr 3.2 (I&amp;#39;m not specifically using any of the nrf SDKs, just stock Zephyr). 
 
 I have verified that the hardware works - I have built the Zephyr &amp;quot;button</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 02 Jul 2023 18:11:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101226/help-figuring-out-why-my-gpio-interrupt-handler-not-being-called---zephyr-3-2" /><item><title>RE: Help figuring out why my GPIO interrupt handler not being called - Zephyr 3.2</title><link>https://devzone.nordicsemi.com/thread/434073?ContentTypeID=1</link><pubDate>Sun, 02 Jul 2023 18:11:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3149a37-0901-460f-825b-c7673bd71bea</guid><dc:creator>riz94107</dc:creator><description>&lt;p&gt;As I expected, the problem was in fact simple.&lt;/p&gt;
&lt;p&gt;Setting up the device:&lt;/p&gt;
&lt;div&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;const&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;hakkei_power_config&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;nbsp;{.&lt;/span&gt;&lt;span&gt;signal&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;GPIO_DT_SPEC_INST_GET&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;, signal_gpios)};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;const&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;hakkei_power_data&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;nbsp;{.&lt;/span&gt;&lt;span&gt;str&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;BLARGH&amp;quot;&lt;/span&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;DEVICE_DT_INST_DEFINE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;hakkei_power_init&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;span&gt;, APPLICATION,&amp;nbsp;&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;NULL&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;... the callback is in the &amp;quot;data&amp;quot; struct - which is marked `const`.&amp;nbsp; This didn&amp;#39;t trigger a compiler error, but apparently did get it stored in flash instead of RAM.&amp;nbsp; &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f926.svg" title="Face palm"&gt;&amp;#x1f926;&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;Changing to this:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;hakkei_power_data&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;nbsp;{.&lt;/span&gt;&lt;span&gt;str&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;BLARGH&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;made everything work!&amp;nbsp; Thanks for your help.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help figuring out why my GPIO interrupt handler not being called - Zephyr 3.2</title><link>https://devzone.nordicsemi.com/thread/434035?ContentTypeID=1</link><pubDate>Sat, 01 Jul 2023 00:30:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac420e38-cd9d-4dd5-8208-15aa060b0325</guid><dc:creator>riz94107</dc:creator><description>&lt;p&gt;I found the time to step through somewhat; I haven&amp;#39;t figured it out yet, but it looks like the handler isn&amp;#39;t actually getting set.&amp;nbsp; I have no idea why just yet - Ozone is telling me some stuff is &amp;quot;out of scope&amp;quot; when I step through on the debugger for reasons I don&amp;#39;t entirely understand, but clearly, when I step through here:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;gpio_init_callback&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;pwr_cb&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;button_pressed&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;BIT&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;signal&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;pin&lt;/span&gt;&lt;span&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;gpio_add_callback&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;signal&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;port&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;pwr_cb&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;... I don&amp;#39;t see the &amp;quot;handler&amp;quot; field of &amp;amp;data-&amp;gt;pwr_cb (which is `struct gpio_callback`) getting set (it remains 0)&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;So... I clearly am missing something simple.&amp;nbsp; I bet it&amp;#39;s staring me right in the face.&amp;nbsp; &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;The fact that those are inline functions is making the debugging a bit hard.&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help figuring out why my GPIO interrupt handler not being called - Zephyr 3.2</title><link>https://devzone.nordicsemi.com/thread/434026?ContentTypeID=1</link><pubDate>Fri, 30 Jun 2023 21:14:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75f02cfb-8c57-4e03-a5ee-9857a02c0f74</guid><dc:creator>riz94107</dc:creator><description>&lt;p&gt;OK, adding a breakpoint in&amp;nbsp;&lt;span&gt;nrfx_gpiote.c::nrfx_gpiote_irq_handler() is going to help - that&amp;#39;s definitely triggering, and I step through the function.&amp;nbsp; EVENTS_IN[7] shows &amp;quot;Generated&amp;quot; at that point.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think at this point I just need to step through&amp;nbsp;nrfx_gpiote.c::nrfx_gpiote_irq_handler() to figure out why the callback isn&amp;#39;t being called - hopefully this gives me enough of a clue.&amp;nbsp; I probably won&amp;#39;t have time to get to it for a few days, unfortuately, but I&amp;#39;ll reply here when I figure it out.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help figuring out why my GPIO interrupt handler not being called - Zephyr 3.2</title><link>https://devzone.nordicsemi.com/thread/433993?ContentTypeID=1</link><pubDate>Fri, 30 Jun 2023 15:35:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c98faa4b-c651-4476-97b4-bd2196a79d1e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Good, you found the SVD file. However, it&amp;#39;s strange that the same register configuration is not working in your project. Could you please check if the EVENTS_IN[6] register is being set when you toggle the input? You may also want to try placing a breakpoint in the nrfx_gpiote.c::nrfx_gpiote_irq_handler() function to see if it is invoked when the interrupt is triggered.&lt;/p&gt;
&lt;p&gt;Besides not receiving the button callback, is your application performing other tasks as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help figuring out why my GPIO interrupt handler not being called - Zephyr 3.2</title><link>https://devzone.nordicsemi.com/thread/433535?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2023 18:20:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d3fc06f-4b98-4f27-a62b-519e86ca1732</guid><dc:creator>riz94107</dc:creator><description>&lt;p&gt;Sorry for the response delay - took me a bit to figure out I hadn&amp;#39;t loaded the nrf52 SVD in Ozone :)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Anyway, no luck - pin configurations for the registers in question all seem to be the same in both apps:&lt;/p&gt;
&lt;p&gt;P0-&amp;gt;PIN_CNF[17] is 0000 0000&lt;/p&gt;
&lt;p&gt;GPIOTE-&amp;gt;INTENSET is 8000 0080&lt;/p&gt;
&lt;p&gt;GPIOTE-&amp;gt;CONFIG[7] is 0003 1101&lt;/p&gt;
&lt;p&gt;(all other GPIOTE-&amp;gt;CONFIG[0..6] are 0000 0000)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m really scratching my head at this point&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help figuring out why my GPIO interrupt handler not being called - Zephyr 3.2</title><link>https://devzone.nordicsemi.com/thread/433227?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 12:15:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cf7e461-4539-4970-8ea7-27e5d26ce7c4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Please use the peripheral viewer in Ozone to check if the GPIO (P0) and GPIOTE configurations are the same when you run the basic button sample and when you run your application. I&amp;#39;m not able to spot any errors in the code you posted, so I&amp;#39;m wondering if the input pin configuration may be overwritten by something else in your app.&lt;/p&gt;
&lt;p&gt;Relevant registers fields:&lt;/p&gt;
&lt;p&gt;P0-&amp;gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/gpio.html?cp=5_0_0_5_8_1_9#register.PIN_CNF-0-31"&gt;PIN_CNF[17]&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;GPIOTE-&amp;gt;&lt;a title="INTENSET" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/gpiote.html?cp=5_0_0_5_9_3_5#register.INTENSET"&gt;INTENSET&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;GPIOTE-&amp;gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/gpiote.html?cp=5_0_0_5_9_3_7#register.CONFIG-0-7"&gt;CONFIG[n]&lt;/a&gt;&amp;nbsp;(check all channels)&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>