<?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>Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86598/reduce-gpio-current-draw</link><description>Hi there, 
 We are currently developing and testing on the nRF5340. We are using our own OS (not Zephyr). 
 We measure power on the devkit by connecting the PPK2 as a source meter to the external supply, and then switching SW10 (VEXT-&amp;gt;NRF) switch to on</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 May 2022 06:15:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86598/reduce-gpio-current-draw" /><item><title>RE: Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/thread/367291?ContentTypeID=1</link><pubDate>Wed, 11 May 2022 06:15:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed408924-6c8f-44a1-a5c2-a69ac4167ae3</guid><dc:creator>Frikkie Badenhorst</dc:creator><description>&lt;p&gt;Cause of issue was that we were using the GPIOTE IN interrupt instead of the PORT interrupt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/thread/362651?ContentTypeID=1</link><pubDate>Fri, 08 Apr 2022 15:44:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccbeac53-cb5a-4420-85d1-e2e2776bf937</guid><dc:creator>Frikkie Badenhorst</dc:creator><description>&lt;p&gt;Hi Stian,&lt;/p&gt;
&lt;p&gt;Thanks for your response. Understood that the using the PORT interrupt will use less current.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you please respond with the following on the case which Hung is handling.&lt;/p&gt;
&lt;p&gt;1) Is it specified somewhere that the IN event will add current while the PORT event will not?&lt;/p&gt;
&lt;p&gt;2) When using the PORT event, and there are 2 inputs on the same GPIO port, how would one know which input triggered the interrupt?&lt;/p&gt;
&lt;p&gt;3) How exactly are you measuring current on the DK? Could you please describe your exact hardware setup&lt;/p&gt;
&lt;p&gt;Looking forward to your response!&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Frikkie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/thread/362649?ContentTypeID=1</link><pubDate>Fri, 08 Apr 2022 15:32:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a1b2796-5ea4-44cd-ba3e-10847496a98e</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, I realize now that you posted a separate case for the same topic which is handled by Hung. I will follow up there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/thread/362648?ContentTypeID=1</link><pubDate>Fri, 08 Apr 2022 15:25:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83929ebc-4dda-48c7-b448-0d7aa7c3824c</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, I would expect to see 50-70 uA with the code you posted. It&amp;#39;s using the GPIOTE IN event which will add some additional current. You can use the PORT event instead, which should not add anything to the system on idle current&lt;/p&gt;
&lt;p&gt;You use the SENSE bits in the PIN_CNF register to enable GPIO sensing, and then enable the PORT interrupt in the GPIOTE module:&lt;/p&gt;
&lt;pre&gt;NRF_P0-&amp;gt;PIN_CNF[23] = (3 &amp;lt;&amp;lt; 2) | (3 &amp;lt;&amp;lt; 16); // pin 23, pullup, sense high to low&lt;br /&gt;NRF_GPIOTE-&amp;gt;INTENSET = (1 &amp;lt;&amp;lt; 31); // enable PORT interrupt&lt;/pre&gt;
&lt;p&gt;Here is a fully working &amp;quot;bare metal&amp;quot; sample that at least works when using Zephyr. When I run it here I measure about 3 uA. It turns off the LED (pin 28) when the button (pin 23) is pressed.&lt;/p&gt;
&lt;p&gt;I see that you are not using Zephyr, but the principle should be the same. Just remove the IRQ_CONNECT macro, and use the GPIOTE0_IRQHandler as you already are doing..&lt;/p&gt;
&lt;pre&gt;#include &amp;lt;zephyr.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void gpiote_irq_handler(void){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NRF_GPIOTE-&amp;gt;EVENTS_PORT = 0; //clear PORT event&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NRF_GPIOTE-&amp;gt;INTENSET = 0; // disable PORT interrupt&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NRF_P0-&amp;gt;OUTSET = (1 &amp;lt;&amp;lt; 28); // Turn off LED&lt;br /&gt;}&lt;br /&gt;void main(void)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;IRQ_CONNECT(DT_IRQN(DT_NODELABEL(gpiote)), DT_IRQ(DT_NODELABEL(gpiote), priority), gpiote_irq_handler, NULL, 0); //connect interrupt handler above in zephyr&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;irq_enable(DT_IRQN(DT_NODELABEL(gpiote))); //enable GPIOTE interrupts&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NRF_P0-&amp;gt;DIRSET = (1 &amp;lt;&amp;lt; 28); // LED pin output&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NRF_P0-&amp;gt;OUTCLR = (1 &amp;lt;&amp;lt; 28); // Turn on LED&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NRF_P0-&amp;gt;PIN_CNF[23] = (3 &amp;lt;&amp;lt; 2) | (3 &amp;lt;&amp;lt; 16); // configure button, pin 23, pullup, sense high to low&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NRF_GPIOTE-&amp;gt;INTENSET = (1 &amp;lt;&amp;lt; 31); // enable PORT interrupt&lt;br /&gt;    for(;;){&lt;br /&gt;        __WFE();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;Please try this and see if you get down to normal idle current.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Stian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/thread/362604?ContentTypeID=1</link><pubDate>Fri, 08 Apr 2022 12:37:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:570515fa-581f-418d-9814-faeb75fd9546</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you using DCDC mode on app, net, HV regulators?&lt;br /&gt;How is the chip powered?&lt;br /&gt;What voltage is the chip powered at? Are you using VDD or VDDH?&lt;br /&gt;Have you made sure that errata workarounds from the MDK is being enabled and used properly in your OS ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/thread/361910?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2022 16:30:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a4ef793-1c54-4e9c-969c-2585d2728ea4</guid><dc:creator>Frikkie Badenhorst</dc:creator><description>&lt;p&gt;Hi Sigurd,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Setting ONLY LED1 pin as output keeps the current stable at 11uA. Setting both the LED1 pin and Button1 pin as an output and input respectively, also keeps the current stable at 11uA.&lt;/p&gt;
&lt;p&gt;Only after we configure the GPIO&lt;strong&gt;TE&amp;nbsp;&lt;/strong&gt;peripheral to enable the interrupts (as shown in the code of the initial post), the current jumps up into the 270uA range. Its almost as if the device can not go into a low power state while waiting for an interrupt to occur?&lt;/p&gt;
&lt;p&gt;Please advise?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reduce GPIO current draw</title><link>https://devzone.nordicsemi.com/thread/361897?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2022 14:37:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:154b68b1-5282-4870-b8aa-ce8341bb39a0</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I would strongly recommend that you use nRF Connect SDK.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]&lt;p&gt;1) Set LED1 pin as output&lt;/p&gt;
&lt;p&gt;2) Set button1 as input and enable the interrupt for it&lt;/p&gt;
&lt;p&gt;3) The interrupt service routine then toggles the LED.&lt;/p&gt;[/quote]
&lt;p&gt;Do you see this only when you do all these steps? What if e.g. only set button 1 as input, or only set LED1 as output?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>