<?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>Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112973/level-triggered-gpio-interrupt-with-ncs-2-7-on-nrf9160</link><description>Hi, 
 after upgrading to NCS v2.7.0, I have some trouble with an increased sleep power consumption of our device when I use Zephyr&amp;#39;s gpio-keys for the button input. 
 I was using NCS v2.5.2 before. Initially after upgrading, the button would not work</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 May 2025 09:27:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112973/level-triggered-gpio-interrupt-with-ncs-2-7-on-nrf9160" /><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/534827?ContentTypeID=1</link><pubDate>Mon, 12 May 2025 09:27:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:537ee939-7fb5-489b-9e4e-a8c8e2685c96</guid><dc:creator>asierzega</dc:creator><description>&lt;p&gt;Thanks Charlie, for the trick with changing GPIO_INT_EDGE_BOTH to GPIO_INT_LEVELS_LOGICAL!&lt;br /&gt;It works with the nRF52832 (SDK 3.0.1), and my project with a few buttons now consumes 2.5 &amp;micro;A instead of 10 &amp;micro;A&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;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/496150?ContentTypeID=1</link><pubDate>Tue, 30 Jul 2024 08:40:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ac47313-3502-4e51-a58d-00e568a05327</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Good to know, you are welcome.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/496036?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 14:00:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0266c7fe-65fe-4d8e-a996-49a1b8494cad</guid><dc:creator>SenseJo</dc:creator><description>&lt;p&gt;Hi Charlie,&lt;/p&gt;
&lt;p&gt;I understand that Nordic MCUs do not need (and do not support) CONFIG_PM. And I just confirmed that we still achieve the same power consumption when CONFIG_PM_DEVICE is not set. However, I think that is only because we were lucky and the drivers for the external chips we have do not require or use CONFIG_PM.&lt;/p&gt;
&lt;p&gt;Nevertheless, my problem has been resolved by this. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/495943?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 08:02:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b54291a-3d97-4084-b0bd-d2d6234c0a17</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Johannes,&lt;/p&gt;
&lt;p&gt;According to previous discussion about PM: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/109006/does-nordic-provide-sample-code-for-power-management-on-ncs-v2-4-2/472615"&gt;devzone.nordicsemi.com/.../472615&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Power management is automatically handled by the hardware on our chips. Therefore, the support for PM on Nordic ICs was removed since SDK v2.5.0:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/commit/96b38273138f05dd06cf7a58fa361f401e773e5e"&gt;https://github.com/nrfconnect/sdk-zephyr/commit/96b38273138f05dd06cf7a58fa361f401e773e5e&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The PM running may need some extra peripherals like timer, so you are expected to see current increase. nRF chips manage PM on hardware level so we dropped support for Zephyr PM.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/495654?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2024 13:44:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00edaa34-5e3a-458e-84cf-77655119fda1</guid><dc:creator>SenseJo</dc:creator><description>&lt;p&gt;Hi Charlie,&lt;/p&gt;
&lt;p&gt;sorry for replying so late.&lt;/p&gt;
&lt;p&gt;I can confirm that after applying your change to input_gpio_keys.c, the floor current is at the level I expected (3.4 &amp;mu;A on my custom board).&lt;/p&gt;
&lt;p&gt;However, when in addition I set CONFIG_PM_DEVICE=y *and* CONFIG_PM_DEVICE_RUNTIME=y, the floor current is increased again.&lt;br /&gt;Initially I suspected this would be caused by the pm action in input_gpio_keys.c; but when I removed that, the power consumption is still increased.&lt;/p&gt;
&lt;p&gt;For our product, I need to set CONFIG_PM_DEVICE=y (and would prefer to enable CONFIG_PM_DEVICE_RUNTIME as well), to reduce the power consumption of some external peripherals.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d be glad if we can resolve this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/493834?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 09:12:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:982ce11b-ad20-4d6a-bef7-d63c6610c419</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Johannes,&lt;/p&gt;
&lt;p&gt;I tried the solution you mentioned before, and the following change will make a nRF9160DK consume around 2.3uA floor current.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;C:\NCS\v2.7.0\zephyr\samples\subsys\input\input_dump&amp;gt; git diff
diff --git a/drivers/input/input_gpio_keys.c b/drivers/input/input_gpio_keys.c
index fa27ca5bd64..d666e9c18de 100644
--- a/drivers/input/input_gpio_keys.c
+++ b/drivers/input/input_gpio_keys.c
@@ -149,7 +149,7 @@ static int gpio_keys_interrupt_configure(const struct gpio_dt_spec *gpio_spec,

        LOG_DBG(&amp;quot;port=%s, pin=%d&amp;quot;, gpio_spec-&amp;gt;port-&amp;gt;name, gpio_spec-&amp;gt;pin);

-       ret = gpio_pin_interrupt_configure_dt(gpio_spec, GPIO_INT_EDGE_BOTH);
+       ret = gpio_pin_interrupt_configure_dt(gpio_spec, GPIO_INT_LEVELS_LOGICAL &amp;amp; ~GPIO_INT_MODE_DISABLED);
        if (ret &amp;lt; 0) {
                LOG_ERR(&amp;quot;interrupt configuration failed: %d&amp;quot;, ret);
                return ret;
diff --git a/samples/subsys/input/input_dump/prj.conf b/samples/subsys/input/input_dump/prj.conf
index e4c7fb97d5d..e8137283778 100644
--- a/samples/subsys/input/input_dump/prj.conf
+++ b/samples/subsys/input/input_dump/prj.conf
@@ -3,3 +3,4 @@ CONFIG_LOG_MODE_MINIMAL=y
 
 CONFIG_INPUT=y
 CONFIG_INPUT_EVENT_DUMP=y
+CONFIG_SERIAL=n
\ No newline at end of file&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:480px;max-width:640px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1280x960/__key/communityserver-discussions-components-files/4/ppk_2D00_20240715T090812.png" /&gt;&lt;/p&gt;
&lt;p&gt;Change&amp;nbsp;&lt;span&gt;CONFIG_SERIAL to y and verified that the buttons still work.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
Input sample started
I: input event: dev=buttons          SYN type= 1 code= 11 value=1
I: input event: dev=buttons          SYN type= 1 code= 11 value=0
I: input event: dev=buttons          SYN type= 1 code=  2 value=1
I: input event: dev=buttons          SYN type= 1 code=  2 value=0
I: input event: dev=buttons          SYN type= 1 code= 11 value=1
I: input event: dev=buttons          SYN type= 1 code= 11 value=0
I: input event: dev=buttons          SYN type= 1 code=  2 value=1
I: input event: dev=buttons          SYN type= 1 code=  2 value=0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Do you have a chance to test with an nRF9160DK?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/493681?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 15:13:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccd52720-b405-4500-9e24-02d3418eb3e5</guid><dc:creator>SenseJo</dc:creator><description>&lt;p&gt;Hi Charlie,&lt;/p&gt;
&lt;p&gt;thanks for your reply!&lt;/p&gt;
&lt;p&gt;I couldn&amp;#39;t find out how to attach source files to this thread, but it&amp;#39;s easily reproduceable e.g. with a slight modification of the Zephyr input_dump sample (e.g. from NCS v2.7.0, zephyr/samples/subsys/input/input_dump).&lt;/p&gt;
&lt;p&gt;Just add code for initializing the modem to the main function (to work around NCSDK-10106), so it looks as follows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;modem/nrf_modem_lib.h&amp;gt;

int main(void)
{
    int ret = nrf_modem_lib_init();
    if (ret) {
        printf(&amp;quot;ERROR: Modem library initialization failed (%d)&amp;quot;, ret);
        return ret;
    }

    printf(&amp;quot;Input sample started\n&amp;quot;);
    return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then, compile the the sample as follows:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&gt;west build -b nrf9160dk/nrf9160/ns (read) -- -DCONFIG_NRF_MODEM_LIB=y -DCONFIG_SERIAL=n&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;On my board, this results in a sleep current of ~18 &amp;mu;A:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&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/ppk_2D00_20240712T144915.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;Whereas, when the same sample is build with an additional `&lt;span style="font-family:courier new, courier;"&gt;-DCONFIG_INPUT_GPIO_KEYS=n&lt;/span&gt;`, on my board the sleep current would be around 3 &amp;mu;A:&lt;br /&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/ppk_2D00_20240712T145043.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;(I am using a custom board, but it simply consists of an nRF9160, an LDO and a SIM card slot, so I am still using the nrf9160dk/nrf9160/ns target)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Level-triggered GPIO interrupt with NCS 2.7 on nRF9160</title><link>https://devzone.nordicsemi.com/thread/493663?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 14:13:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d14c58d-e529-4db8-a4ed-c4229b45e9a2</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi Johannes,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you sure the 15uA extra current comes from GPIO configuration?&lt;/p&gt;
&lt;p&gt;Would you be able to make a small sample only using gpio-keys to compare the power difference?&lt;/p&gt;
&lt;p&gt;You can share me the sample if the difference still exists.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In addition, I share a discussion about System off mode&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/111709/nrf9160---system-off-mode-current"&gt;(+) nRF9160 - SYSTEM OFF Mode Current - Nordic Q&amp;amp;A - Nordic DevZone - Nordic DevZone (nordicsemi.com)&lt;/a&gt;&amp;nbsp;just in case you are also interested.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>