<?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>problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/88976/problem-with-gpio-pin-as-input-with-nrf9160-using-zephyr-rtos</link><description>Hi, 
 I&amp;#39;m using GPIO pin as input button with nrf9160 using Zephyr RTOS, but when I was press the button I didn&amp;#39;t get any response from button state. 
 hear is my code 
 
 when I press button count value not changing, if anyone know where I did wrong</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 Jun 2022 09:41:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/88976/problem-with-gpio-pin-as-input-with-nrf9160-using-zephyr-rtos" /><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/374704?ContentTypeID=1</link><pubDate>Wed, 29 Jun 2022 09:41:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afa3d606-07fa-4f20-8bc0-c478959519b4</guid><dc:creator>_bhanu</dc:creator><description>&lt;p&gt;now its working fine&lt;/p&gt;
&lt;p&gt;thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/374468?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 08:09:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9817791c-f923-4248-9b96-9ee5413772ab</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Could you try creating an overlay file for your board with this addition? When you open the input files of your project in VSC you should&amp;nbsp;see a shortcut for creating overlay files right there.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
/ {
    buttons {		
        button4: button_4 {
            gpios = &amp;lt;&amp;amp;gpio0 15 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)&amp;gt;;
            label = &amp;quot;Push button switch 4&amp;quot;;
        };
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/374163?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2022 12:56:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0baa0343-e015-4879-8d17-65a762c54cb6</guid><dc:creator>_bhanu</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/88976/problem-with-gpio-pin-as-input-with-nrf9160-using-zephyr-rtos/373415"]What GPIO have you connected the button to?[/quote]
&lt;p&gt;In my case i used gpio-15&amp;nbsp; is connected&amp;nbsp; to eternal button.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/373415?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2022 11:17:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bda65b42-b8ff-44d3-bd36-3674bd720291</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Sure! You would have to add this to the boards dts (device tree) file, either directly or by using an .overlay file. I believe it would be beneficial for you to read a bit about how these files work though, you can read about them and how they are used &lt;a href="https://academy.nordicsemi.com/topic/configuration-files/"&gt;here in our new Dev Academy&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;What GPIO have you connected the button to?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/373340?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2022 05:04:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7406bc78-30ff-491b-a77c-57451ca71df1</guid><dc:creator>_bhanu</dc:creator><description>&lt;p&gt;Hi Elfving,&lt;/p&gt;
&lt;p&gt;thanks for reply.&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/88976/problem-with-gpio-pin-as-input-with-nrf9160-using-zephyr-rtos/373141"]I see. Have you added the button to&amp;nbsp;the dts files of your board?[/quote]
&lt;p&gt;can you help&amp;nbsp; me to fid the path to add button to dts file on my board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/373141?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2022 07:22:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9281896-5e8d-4745-993e-a292ed8aff96</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;I see. Have you added the button to&amp;nbsp;the dts files of your board?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/373116?ContentTypeID=1</link><pubDate>Sat, 18 Jun 2022 04:57:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce76754e-a08d-425f-8e7d-695393d19194</guid><dc:creator>_bhanu</dc:creator><description>&lt;p&gt;thanks you,&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/88976/problem-with-gpio-pin-as-input-with-nrf9160-using-zephyr-rtos/373051#373051"]When it comes the internal buttons, could you try GPIO_PULL_UP | GPIO_ACTIVE_LOW[/quote]
&lt;p&gt;now it&amp;#39;s working for internal button.&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/88976/problem-with-gpio-pin-as-input-with-nrf9160-using-zephyr-rtos/373051#373051"]When it comes to your external button, it looks like a pull-down switch. So could you try GPIO_PULL_DOWN for that one?[/quote]
&lt;p&gt;when it come to external&amp;nbsp; button I tried &amp;quot;GPIO_PULL_DOWN&amp;quot; then also I&amp;#39;m not getting any response. Even if tried GPIO_PULL_UP then also not working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/373051?ContentTypeID=1</link><pubDate>Fri, 17 Jun 2022 13:12:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35e19f9e-9ede-4f2a-a9f4-36eba8c554f9</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello Bhanu,&lt;/p&gt;
&lt;p&gt;As you are referring to external vs internal buttons, are you using the nRF9160DK?&lt;/p&gt;
&lt;p&gt;When it comes the internal buttons, could you try GPIO_PULL_UP | GPIO_ACTIVE_LOW? If you take a look at the dts file of the 9160 you see these pin hardware characteristics defined.&lt;/p&gt;
&lt;p&gt;You can also have a look at how this is done in &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/basic/button/README.html"&gt;the Zephyr button example&lt;/a&gt;, in which gpio_pin_configure_dt() is used instead of gpio_pin_configure().&lt;/p&gt;
&lt;p&gt;When it comes to your external button, it looks like a pull-down switch. So could you try GPIO_PULL_DOWN for that one?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/372575?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2022 12:38:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44940c1a-5e1e-4574-9e08-e42f8dd86c0a</guid><dc:creator>_bhanu</dc:creator><description>&lt;p&gt;Hi Depraz,&lt;/p&gt;
&lt;p&gt;I changed my code as you said ,after changing also I&amp;#39;m not getting any response form my button. if I changed pin config as&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt; &lt;/span&gt;ret = gpio_pin_configure( gpio_dev ,button, GPIO_PULL_UP); &amp;quot; then&amp;nbsp; its working fine in onboard&amp;nbsp; button. if I connect it to&amp;nbsp; external button&amp;nbsp; its not working. My external button is connected to nrf9160 as bellow figure.&lt;/p&gt;
&lt;p&gt;.&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/511568b6ce395f1b40000000.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;is their any changes i have to do in my code if&amp;nbsp; I connect&amp;nbsp; button externally to board?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with GPIO pin as input  with  nrf9160 using zephyr RTOS</title><link>https://devzone.nordicsemi.com/thread/372550?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2022 11:46:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b48a34ac-3f32-4703-947b-710fbe6e5182</guid><dc:creator>Depraz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;device_get_binding returns a &amp;quot;&lt;span class="k"&gt;&lt;span class="pre"&gt;const&lt;/span&gt;&lt;/span&gt;&lt;span class="w"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="k"&gt;&lt;span class="pre"&gt;struct&lt;/span&gt;&lt;/span&gt;&lt;span class="w"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a class="reference internal" title="device" href="https://docs.zephyrproject.org/3.0.0/reference/drivers/index.html#c.device"&gt;&lt;span class="n"&gt;&lt;span class="pre"&gt;device&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;quot; so&amp;nbsp;&lt;span class="w"&gt;&lt;span&gt;&amp;nbsp;gpio_dev should be&amp;nbsp;declared as&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;const struct device *gpio_dev =device_get_binding(&amp;quot;GPIO_0&amp;quot;);&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;It is always good to look for returned value, so I would replace&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;	ret = gpio_pin_configure(gpio_dev,button, GPIO_INPUT);
&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;by&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;	ret = gpio_pin_configure(gpio_dev,button, GPIO_INPUT);
    if (ret != 0)
    {
        printk(&amp;quot;Error %d&amp;quot;, ret);
        return 1;
    }&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Can you retry with those changes ? If this is still not working, make sure to have CONFIG_GPIO=y in your config and that the dts has&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;gpio0 {
  status = &amp;quot;okay&amp;quot;;
};
&lt;/pre&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>