<?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 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53445/nrf52840-gpio-simple-input-read-issue</link><description>Hi all, I am stuck with a simple but weird issue. It&amp;#39;s driving me crazy for the last few hours. I am using a PCA10056 DK. I am somehow unable to do a simple digital pin read correctly with nrf_gpio_pin_read when I configure the pin to be pulled up or</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Oct 2019 15:22:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53445/nrf52840-gpio-simple-input-read-issue" /><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215992?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 15:22:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ad9e197-20a5-4404-9daf-8311d73094ea</guid><dc:creator>dev_000</dc:creator><description>&lt;p&gt;Thanks a lot Dmitry. That was the problem. &lt;br /&gt;It works fine on free pins. Just double checked the DK user guide again. For anyone searching for it in the future. Check the following image from DK user guide. (Pg 26)&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/2465.1.JPG" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215989?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 15:11:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9918f31e-dd07-4259-ad90-d3f5ec5edfd7</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;pins from 17 to 23 are routed to SPI flash on PCA10056. To use them as GPIO, you need to cut bridges SB10..SB15 and solder SB20..SB25 as shown at the back of the board. Or choose&lt;span&gt;&amp;nbsp;any&amp;nbsp;&lt;/span&gt;other free pin (for quick test, configure pin 11 that is Button 1).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215962?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 13:53:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1527351-b6fe-4191-9a46-d12ecc1e41e7</guid><dc:creator>dev_000</dc:creator><description>&lt;p&gt;Tried that as well. The issue still persists.&lt;br /&gt;Attached is the screenshot of the debug session.&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/0640.Debug.JPG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215948?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 13:23:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:702e19e0-5853-47a6-95ed-d756f1e86453</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;&amp;quot;&lt;span&gt;Well the basic blinky code is utilising the on board LEDs and buttons. That&amp;#39;s not what I am doing.&amp;quot;&lt;br /&gt;&lt;br /&gt;That&amp;#39;s the whole point, it&amp;#39;s the smallest piece of code that will compile out of the box and run on the nRF device. You can remove all the LED blinking stuff, just add your pin reading routine and see if you can re-create the issue.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215932?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 12:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1222e694-4b6b-4d2c-be32-004fc7d05eb1</guid><dc:creator>dev_000</dc:creator><description>&lt;p&gt;Well the basic blinky code is utilising the on board LEDs and buttons. That&amp;#39;s not what I am doing. &lt;br /&gt;&lt;br /&gt;I am attaching the main.c file here. Can you please test this in the basic ble_app_template project to see if this is replicate-able in pca10056? That would rule out program errors if any.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/73725.main.c"&gt;devzone.nordicsemi.com/.../73725.main.c&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215922?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 12:35:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce50562f-e910-4ece-8488-1d92634dff8a</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;This is not the expected behavior of the GPIOs.&lt;br /&gt;&lt;br /&gt;I suggest you replicate the issue with the most basic example, the \examples\peripheral\&lt;a title="Blinky Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/gpio_example.html?cp=5_1_4_6_0"&gt;Blinky Example&lt;/a&gt;, so that we can rule out programmatical errors.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I also suggest you halt the CPU and read the GPIO&amp;#39;s&amp;nbsp;&lt;a title="IN" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/gpio.html?cp=3_0_0_5_8_1_3#register.IN"&gt;IN&lt;/a&gt;&amp;nbsp;register directly in a debugging session.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215862?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 09:19:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59472b70-c945-4f1c-bfcf-fb939551c13a</guid><dc:creator>dev_000</dc:creator><description>&lt;p&gt;I tried with the different pins as well (Like P0.19, P0.21). Issue seems to be there. &lt;br /&gt;Now when I repeat the same experiment today, its not functioning even with NRF_GPIO_PIN_NOPULL&lt;br /&gt;&lt;br /&gt;In NRF_GPIO_PIN_NOPULL is stuck at 0&lt;br /&gt;In NRF_GPIO_PIN_PULLDOWN its stuck at 0&lt;br /&gt;In NRF_GPIO_PIN_PULLUP its stuck at 1&lt;br /&gt;&lt;br /&gt;Its not changing no matter what I do. &lt;br /&gt;&lt;br /&gt;Tried volatile too. No change in result. &lt;br /&gt;&lt;br /&gt;Any advice on what can be wrong?&lt;br /&gt;Tried on 2 Dev kits. Same behaviour. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 GPIO Simple Input Read Issue</title><link>https://devzone.nordicsemi.com/thread/215851?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 08:52:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed5683f9-6511-4f04-89d0-76c239f4f795</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Is the problem specific to p0.17? Do note that p0.17 is already in use by the on-board flash. See the DK&amp;#39;s&amp;nbsp;&lt;a title="Connector interface" href="https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/nrf52840_DK/connector_if.html?cp=3_0_4_7_5"&gt;Connector interface&lt;/a&gt;&amp;nbsp;spec.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It could be a problem where the compiler optimizes out the register read, try declaring button_value as volatile.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>