<?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>nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts</link><description>We are in the process of porting from nRF SDK v15.3.0 to v17.1.0. 
 After updating, we’ve noticed that the device sometimes gets stuck. Investigation shows this is related to GPIO interrupt handling. 
 The nRF52840 supports two wakeup detect modes: Default</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Aug 2025 11:35:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts" /><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546895?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 11:35:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8eafd166-8b2e-4452-9ba6-508c0c6bcea2</guid><dc:creator>Ligo George</dc:creator><description>&lt;p&gt;Thanks for the support, I think we are good.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546892?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 11:03:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84f17e89-7b79-4012-a175-d4d1ecf7b885</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;SENSE is enabled in&amp;nbsp;nrfx_gpiote_in_event_enable() after&amp;nbsp;nrfx_gpiote_in_init().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546887?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 10:51:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8dee1bb3-2f3d-4309-9222-527d8cbaac10</guid><dc:creator>Ligo George</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;It&amp;#39;s&amp;nbsp;also redundant to run enable sense with&amp;nbsp;&lt;/span&gt;&lt;span&gt;nrf_gpio_cfg() when it&amp;#39;s already done by the GPIOTE driver (in case of .high_accuracy=false).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;Can you please let me me know where this wake up sense is already done in&amp;nbsp;&lt;code&gt;nrfx_gpiote_in_init()&lt;/code&gt; the case of &lt;code&gt;.high_accuray=false&lt;/code&gt; ? I coudn&amp;#39;t find it.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546884?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 10:34:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f70232e3-65f3-4c8d-b238-98554c07331d</guid><dc:creator>Ligo George</dc:creator><description>&lt;p&gt;Yes, it works fine if we configure &lt;code&gt;.high_accuracy = false&lt;/code&gt; before enabling wake up sense.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546859?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 08:37:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca1899c5-7c9d-405b-8e51-8da393aea6a1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;This should not occur if the pin has already been initialized and enabled in the GPIOTE driver, as that would cause execution to&amp;nbsp;reach this code and release the DETECT signal:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="351" src="https://devzone.nordicsemi.com/resized-image/__size/874x702/__key/communityserver-discussions-components-files/4/pastedimage1756201393950v1.png" width="437" /&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s&amp;nbsp;also redundant to run enable sense with&amp;nbsp;&lt;span&gt;nrf_gpio_cfg() when it&amp;#39;s already done by the GPIOTE driver (in case of .high_accuracy=false).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546852?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 07:57:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b02e17b-d45d-4a9c-ae0f-fa87d81dd852</guid><dc:creator>Ligo George</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;And this is with .high_accuracy=true for that particular pin?&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;Based on my&amp;nbsp;tests, it behaves same in this case with &lt;code&gt;.hi_accuracy&lt;/code&gt; true / false.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546848?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 07:50:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43674e79-fd02-4a6b-93d0-5c98dcbb9426</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="134458" url="~/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts/546846"]On power up we are doing, &lt;code&gt;nrf_gpio_cfg(pin, NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_SENSE_LOW);&lt;/code&gt;. It straight away goes stuck at port_event_handle() if the input is already low, with SDK 17.&amp;nbsp;[/quote]
&lt;p&gt;The DETECT signal is not going to be deasserted until either the SENSE or input level changes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1756281034681v1.png" alt=" " /&gt;&lt;/p&gt;
[quote userid="134458" url="~/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts/546846"] It straight away goes stuck at &lt;code&gt;port_event_handle()&lt;/code&gt; if the input is already low, with SDK 17.&amp;nbsp;[/quote]
&lt;p&gt;And this is with .high_accuracy=true for that particular pin?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546846?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 07:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:368fe393-a4b2-44e6-8ec3-73e8569138ee</guid><dc:creator>Ligo George</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;This is&amp;nbsp;was the assumption I made when you&amp;nbsp;said the signal came from&amp;nbsp;a charger earlier, and is why I meant&amp;nbsp;ask if the active level would change depending on the charger state at the time of entering system off. How were you handling this in the previous version? Also, were you using GPIOTE PORT events or GPIO IN events previously?&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With SDK 15, currently both &lt;code&gt;.hi_accuracy=true&lt;/code&gt; and&amp;nbsp;&lt;code&gt;NRF_GPIO_PIN_SENSE_LOW&lt;/code&gt; is enabled. So I assume it uses both&amp;nbsp;&lt;span&gt;GPIOTE PORT events&amp;nbsp;and GPIO IN events.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Now with SDK&amp;nbsp;17, currently I am setting &lt;code&gt;.hi_accuracy=false&lt;/code&gt; for pins which configure wakeup sense.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;This indicates that the input pin has not been disabled in the GPIOTE driver. In any case, if you set the sense level to low and the input is low, the device will immediately wake up again if you try to enter system off.&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;On power up we are doing, &lt;code&gt;nrf_gpio_cfg(pin, NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_SENSE_LOW);&lt;/code&gt;. It straight away goes stuck at &lt;code&gt;port_event_handle()&lt;/code&gt; if the input is already low, with SDK 17.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546840?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 07:27:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a517bca8-3e7e-47ad-bec8-68953b8d6b29</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="134458" url="~/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts/546807"]For example, we use wake-up sense to detect charger input or button press. If the device starts with the charger already connected, the input is already LOW[/quote]
&lt;p&gt;This is&amp;nbsp;was the assumption I made when you&amp;nbsp;said the signal came from&amp;nbsp;a charger earlier, and is why I meant&amp;nbsp;ask if the active level would change depending on the charger state at the time of entering system off. How were you handling this in the previous version? Also, were you using GPIOTE PORT events or GPIO IN events previously?&lt;/p&gt;
[quote userid="134458" url="~/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts/546807"]causes the device to get stuck in the same &lt;code data-start="307" data-end="328"&gt;port_event_handle()&lt;/code&gt;[/quote]
&lt;p&gt;This indicates that the input pin has not been disabled in the GPIOTE driver. In any case, if you set the sense level to low and the input is low, the device will immediately wake up again if you try to enter system off.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546807?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 17:39:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0ca0b5c-f668-4a9a-8632-4ef09d67f31c</guid><dc:creator>Ligo George</dc:creator><description>&lt;p data-start="63" data-end="409"&gt;For example, we use wake-up sense to detect charger input or button press. If the device starts with the charger already connected, the input is already LOW. Enabling wake-up sense on LOW at this time causes the device to get stuck in the same &lt;code data-start="307" data-end="328"&gt;port_event_handle()&lt;/code&gt; ISR. It works fine if the charger is not connected (input HIGH) when enabling.&lt;/p&gt;
&lt;p data-start="411" data-end="547"&gt;Similarly, if a button gets stuck/jammed and stays LOW, we could run into the same issue, making it harder to detect the actual cause.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546796?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 14:48:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:895ed331-ac84-4807-ac09-d4c8ee65df8f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Just to confirm, you only want the device to wake up when the signal&amp;nbsp;goes from high to low? And in that case, is the issue that the signal is sometimes already low when you try to enter system OFF?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546783?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 13:43:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:934a117c-9b78-4142-a2fe-a00e55e83d62</guid><dc:creator>Ligo George</dc:creator><description>&lt;p&gt;It is always configured as &lt;strong data-start="71" data-end="87"&gt;sense on LOW&lt;/strong&gt;. I could read the input first and then set the appropriate sense level, but that doesn&amp;rsquo;t sound very robust &amp;mdash; if it&amp;rsquo;s missed once, the device can end up stuck.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546781?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 13:35:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da4b0d03-c2df-462a-be79-adf6441a34cf</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Not sure what the input latch signal refers to in this context, but does the wake-up signal change between active low and active high? In that case, couldn&amp;rsquo;t you just read the input first and then set the appropriate sense level (low to high or high to low)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546774?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 13:16:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:867dbf0b-20bf-4f27-8bb2-2bab67e11a23</guid><dc:creator>Ligo George</dc:creator><description>&lt;p&gt;With this approach we still have an issue.&lt;/p&gt;
&lt;p&gt;If the input latch signal is asserted while enabling WAKEUP sense, we still run in to the same problem.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546773?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 13:10:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64c347cb-d67a-4195-aca6-f97cb7095e1d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for confirming that it works now. Ideally it seems like the driver should have ignored the latch bit for any input that was not initialized with&amp;nbsp;&lt;span&gt;.hi_accuracy=false. The assumption is probably that the application would not configure SENSE for other pins.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I don&amp;#39;t think this is applicable to SDK 15 since it does not include the latch clearing logic.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546772?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 13:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:868a5821-c954-41b6-845c-fe3e849cf385</guid><dc:creator>Ligo George</dc:creator><description>&lt;p&gt;It looks working now. Should we follow the same for SDK 15 as well or this is applicable only for SDK 17 ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546767?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 12:54:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c94e09f1-cadf-4600-af43-54a2c6aacd14</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The solution should be to ensure that&amp;nbsp;SENSE and GPIOTE IN events are not enabled for the same input pin at the same time. You can reconfigure pins that are to be used for wakeup when preparing to enter System OFF after disabling the GPIOTE IN event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546766?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 12:50:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43b7b54a-c08f-40d5-8505-f89bebc45e93</guid><dc:creator>Ligo George</dc:creator><description>&lt;p&gt;We are using SENSE on some inputs to wakeup the mcu.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546763?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 12:46:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e66f5576-5563-44bc-ba00-1d04eb6d4be5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, SDK 15 was not utilizing the latch register. Where are you configuring the pin with SENSE enabled, and what is the purpose of that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546759?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 12:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9b330ab-b4fc-43c5-bdf1-baf35b928f39</guid><dc:creator>Ligo George</dc:creator><description>&lt;p&gt;Yes, that is right.&lt;/p&gt;
&lt;p&gt;GPIOTE inputs are initialized with &lt;code&gt;.hi_accuracy=true&lt;/code&gt; and &lt;code&gt;SENSE&lt;/code&gt; is enabled. This was working fine with SDK 15.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you have any official documentation mentioning the same ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546755?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 12:35:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3df793de-975e-4107-a7f1-19026be9a6ec</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="134458" url="~/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts/546754"]&lt;code&gt;.hi_accuracy&lt;/code&gt; is set to true for all our interrupts, but still &lt;code&gt;port_event_handle()&lt;/code&gt; is getting called. Based on my testing, port_event_handle() is getting called especially in cases like &lt;em&gt;“&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpio.html#ariaid-title2:~:text=A%20PORT%20event%20is%20triggered%20if%20the%20DETECT%20signal%20was%20low%20before%20enabling%20the%20sense%20mechanism."&gt;A PORT event is triggered if the DETECT signal was low before enabling the sense mechanism&lt;/a&gt;”&lt;/em&gt;, even if&amp;nbsp;&lt;code&gt;.hi_accuracy&lt;/code&gt;&lt;span&gt;&amp;nbsp;is set to true, and it is stuck in while loop.&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;This suggests that you have pins configured with SENSE enabled, but this is not done by the GPIOTE driver when .hi_accuracy is set to &amp;#39;true&amp;#39;.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote userid="134458" url="~/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts/546754"]Will latch bit staying set matter if the detect mode is &amp;quot;non-latch&amp;quot; ?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
[quote userid="134458" url="~/f/nordic-q-a/123923/nrf52840-how-to-disable-latch-detect-in-sdk-v17-gpio-interrupts/546754"]But for me the code execution never reaches here, as I mentioned before.[/quote]
&lt;p&gt;Then the given pin has not been initialized with&amp;nbsp;&lt;span&gt;hi_accuracy=false.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;GPIOTE inputs initialzied with&amp;nbsp;.hi_accuracy=true should not be configured with SENSE enabled.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;EDIT I can see now how this could lead to the driver becoming stuck in the ISR. The solution should be to make sure sense is not enabled for inputs initialized with .hi_accuracy enabled.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546754?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 12:18:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ab88d32-4f07-4c21-91fc-734a3f29d8e0</guid><dc:creator>Ligo George</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Port event is not enabled when&amp;nbsp;.hi_accuracy is set to &amp;#39;true&amp;#39;. If this is the configuration you are using for all your interrupt pins, then&amp;nbsp;port_event_handle() should never have been called.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;.hi_accuracy&lt;/code&gt; is set to true for all our interrupts, but still &lt;code&gt;port_event_handle()&lt;/code&gt; is getting called. Based on my testing, port_event_handle() is getting called especially in cases like &lt;em&gt;&amp;ldquo;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpio.html#ariaid-title2:~:text=A%20PORT%20event%20is%20triggered%20if%20the%20DETECT%20signal%20was%20low%20before%20enabling%20the%20sense%20mechanism."&gt;A PORT event is triggered if the DETECT signal was low before enabling the sense mechanism&lt;/a&gt;&amp;rdquo;&lt;/em&gt;, even if&amp;nbsp;&lt;code&gt;.hi_accuracy&lt;/code&gt;&lt;span&gt;&amp;nbsp;is set to true, and it is stuck in while loop.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Is it always latched for the same pin?&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;Yes, but with&amp;nbsp;&lt;code&gt;.hi_accuracy&lt;/code&gt;&amp;nbsp;is set to true, it continues with next iteration from&amp;nbsp;&lt;code&gt;if(m_cb.port_handlers_pins[i] == PIN_NOT_USED).&amp;nbsp;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;because the latch bit will still be set even if the DETECT signal has been deasserted.&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;Will latch bit staying set matter if the detect mode is &amp;quot;non-latch&amp;quot; ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/pastedimage1756210463885v2.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;This case appears to have been considered based on the comment here:&amp;nbsp;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1756209860585v2.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;But for me the code execution never reaches here, as I mentioned before.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546751?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 12:04:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6aa46dbb-63d0-4095-961a-e3697e660a7b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Port event is not enabled when&amp;nbsp;.hi_accuracy is set to &amp;#39;true&amp;#39;. If this is the configuration you are using for all your interrupt pins, then&amp;nbsp;port_event_handle() should never have been called.&amp;nbsp;&lt;/p&gt;
[quote user="Ligo George"] as it is unable to find a matching latch bit set in following,&amp;nbsp;&lt;code&gt;if (nrf_bitmask_bit_is_set(pin, latch))&lt;/code&gt;[/quote]
&lt;p&gt;Is it always latched for the same pin?&lt;/p&gt;
[quote user="Ligo George"]I’m not sure I fully understand — if LDETECT is not enabled, how does using the LATCH register make the interrupt handling more robust?[/quote]
&lt;p&gt;because the latch bit will still be set even if the DETECT signal has been deasserted.&lt;/p&gt;
[quote user="Ligo George"]As per the nRF documentation I see: &lt;em&gt;“&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpio.html#ariaid-title2:~:text=A%20PORT%20event%20is%20triggered%20if%20the%20DETECT%20signal%20was%20low%20before%20enabling%20the%20sense%20mechanism."&gt;A PORT event is triggered if the DETECT signal was low before enabling the sense mechanism&lt;/a&gt;”.&amp;nbsp;&lt;/em&gt;If I understand correctly, the current port event handler doesn’t account for this case.[/quote]
&lt;p&gt;This case appears to have been considered based on the comment here:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1756209860585v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546739?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 10:45:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:908a4804-4a06-4796-93f3-3c2be12bbe28</guid><dc:creator>Ligo George</dc:creator><description>&lt;p data-start="69" data-end="101"&gt;Thanks for the quick response.&lt;/p&gt;
&lt;p data-start="103" data-end="257"&gt;I don&amp;rsquo;t think the input signal is completely glitch-free, since it is triggered by the charger connector &amp;mdash; that&amp;rsquo;s probably why the port event is firing.&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;From what I observe, it ends up calling &lt;code data-start="299" data-end="318"&gt;port_event_handle&lt;/code&gt;, and then &lt;code&gt;contuine;&lt;/code&gt; on the below check, so the level reconfiguration is not happening, continues again on the while loop non stop.&amp;nbsp;&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/pastedimage1756204948970v2.png" /&gt;&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;How to configure this properly ?&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfx_gpiote_in_config_t interruptConfig = {
    .sense = NRF_GPIOTE_POLARITY_TOGGLE,
    .pull = NRF_GPIO_PIN_NOPULL,
    .is_watcher = false,
    .hi_accuracy = true,
    .skip_gpio_setup = true,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;I tried configuring&amp;nbsp;&lt;code&gt;.hi_accuracy =&amp;nbsp;false&lt;/code&gt;, to force use port events. But still the behaviour is similar, as it is unable to find a matching latch bit set in following,&amp;nbsp;&lt;code&gt;if (nrf_bitmask_bit_is_set(pin, latch))&lt;/code&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;blockquote&gt;
&lt;p data-start="259" data-end="351"&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I have not been able to find any other similar reports with this issue. The latch register is used to reduce the chance of missing pin events, which can occur more easily when multiple pins have sense enabled in applications where the GPIOTE IRQ may be blocked or preempted by other interrupts.&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The driver doesn&amp;#39;t enable the LDETECT mode, so the latch register bits&amp;nbsp;are not going&amp;nbsp;trigger the PORT event either. The driver&amp;nbsp;will always&amp;nbsp;uses the LATCH register as long as it&amp;#39;s supported by the&amp;nbsp;HW (indicated by the presence of the NRF_GPIO_LATCH_PRESENT symbol). This&amp;nbsp;was&amp;nbsp;not designed to be configurable as there are no known drawbacks of using it. It should only make the interrupt handling more robust.&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p data-start="259" data-end="351"&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p data-start="259" data-end="351"&gt;I&amp;rsquo;m not sure I fully understand &amp;mdash; if LDETECT is not enabled, how does using the LATCH register make the interrupt handling more robust?&lt;/p&gt;
&lt;hr /&gt;
&lt;p data-start="259" data-end="351"&gt;As per the nRF documentation I see: &lt;em data-start="263" data-end="358"&gt;&amp;ldquo;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpio.html#ariaid-title2:~:text=A%20PORT%20event%20is%20triggered%20if%20the%20DETECT%20signal%20was%20low%20before%20enabling%20the%20sense%20mechanism."&gt;A PORT event is triggered if the DETECT signal was low before enabling the sense mechanism&lt;/a&gt;&amp;rdquo;.&amp;nbsp;&lt;/em&gt;If I understand correctly, the current port event handler doesn&amp;rsquo;t account for this case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: How to disable latch detect in SDK v17 GPIO interrupts?</title><link>https://devzone.nordicsemi.com/thread/546735?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 10:00:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82b62de4-f84d-4d50-9077-23a8c173a3b3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have not been able to find any other similar reports with this issue. The latch register is used to reduce the chance of missing pin events, which can occur more easily when multiple pins have sense enabled in applications where the GPIOTE IRQ may be blocked or preempted by other interrupts.&lt;/p&gt;
&lt;p&gt;The driver doesn&amp;#39;t enable the LDETECT mode, so the latch register bits&amp;nbsp;are not going&amp;nbsp;trigger the PORT event either. The driver&amp;nbsp;will always&amp;nbsp;uses the LATCH register as long as it&amp;#39;s supported by the&amp;nbsp;HW (indicated by the presence of the NRF_GPIO_LATCH_PRESENT symbol). This&amp;nbsp;was&amp;nbsp;not designed to be configurable as there are no known drawbacks of using it. It should only make the interrupt handling more robust.&lt;/p&gt;
[quote user=""]Because our interrupt signals can stay active, the latch never resets → the MCU ends up stuck in the loop inside &lt;code&gt;port_event_handle(uint32_t * latch)&lt;/code&gt; (called from interrupt context). This effectively makes every GPIO interrupt susceptible to the same issue if the input signal stays asserted.[/quote]
&lt;p&gt;Note that the sense level is reconfigured in the ISR to prevent exactly this:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1756201393950v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Is the input signal free of glitches?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>