<?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>Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10020/struggling-with-basic-gpio-read-on-nrf52</link><description>Hello, I am trying to develop on the NRF52. I have the development board and have been spending time with the SDK and documentation. I understand how the GPIO should work, but I can&amp;#39;t seem to get it to do a basic read. 
 I have a five position switch</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 31 Mar 2017 11:57:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10020/struggling-with-basic-gpio-read-on-nrf52" /><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37136?ContentTypeID=1</link><pubDate>Fri, 31 Mar 2017 11:57:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbbf6718-8a04-4932-87db-ca31a9ce282b</guid><dc:creator>arthare</dc:creator><description>&lt;p&gt;Thank you!  This took me forever to figure out why all my &lt;em&gt;other&lt;/em&gt; pins were working fine, but pin 9 wouldn&amp;#39;t give me any data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37135?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2016 16:44:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1284b70-c730-4e83-b2bb-fcabcf6aaf9b</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;You can define CONFIG_NFCT_PINS_AS_GPIOS at compiler and assembler flags. For example I do it at the project&amp;#39;s makefile using Eclipse.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37134?ContentTypeID=1</link><pubDate>Wed, 13 Apr 2016 13:30:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cec3838b-dae8-4f4c-9844-5128d40ce2aa</guid><dc:creator>Jorgewu</dc:creator><description>&lt;p&gt;Hi:
I am using IAR7.5
1 .Can you tell me where I can set ?
2.And what I need to do for it after include this header file?
3.Because this values is loaded while system booting, so does system needed be reboot?
Thanks..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37133?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 11:22:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b60a5f16-9c71-4638-b4f5-7c3461980353</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Thank you for sharing this excellent explanation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37131?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 17:25:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72bbddfe-ca4e-421e-abd4-d1c03455e6da</guid><dc:creator>Blue_Alien</dc:creator><description>&lt;p&gt;Thanks, that did it! Adding this line enabled the GPIO functionality.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const uint32_t UICR_ADDR_0x20C    __attribute__((at(0x1000120C))) __attribute__((used)) = 0xFFFFFFFE;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37130?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 08:31:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd32cc7b-b7e3-44d6-97b2-add3ded45c89</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;It may be a bit hidden in the documentation, but the PROTECT field in the &lt;a href="http://infocenter.nordicsemi.com/topic/nrf52.v1.7/Chunk832797900.html#register.NFCPINS"&gt;NFCPINS&lt;/a&gt; register in UICR defines the usage of the pins that are shared between NFC and GPIO (P0.09 and P0.10). Can you attempt to configure the pins as GPIO&amp;#39;s there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37132?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 04:46:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14a42b0a-bad0-4e70-96f5-f151b1dff943</guid><dc:creator>Blue_Alien</dc:creator><description>&lt;p&gt;I figured out my issue. Trying to use pins 9 and 10 on the NRF52 Dev Board for general purpose GPIO is useless until you make a couple of hardware and memory changes.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5241.Untitled.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Even after removing R25 and R26, then connecting to pads of R27 and R28, they still don&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;Einar Thorsrud solved the final piece of the puzzle. &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fnrf52.v1.7%2FChunk832797900.html&amp;amp;anchor=register.NFCPINS"&gt;The UICR register needed to be set to enable GPIO functionality of pins 9 and 10.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Adding this line to the uicr_config.h file and selecting &amp;quot;Use Memory Layout from Target Dialog&amp;quot; in the project Linker options did the trick.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const uint32_t UICR_ADDR_0x20C    __attribute__((at(0x1000120C))) __attribute__((used)) = 0xFFFFFFFE;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/08166.Capture.PNG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37127?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 17:05:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ccf393c-85ee-42a8-b860-4cef91826eb7</guid><dc:creator>Blue_Alien</dc:creator><description>&lt;p&gt;Thanks for the answers. The common of the 5 position switch is attached to Vdd. So I do want the pull downs enabled.&lt;/p&gt;
&lt;p&gt;I did verify that the pins of my switch are at Vdd.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t need to drive the LED&amp;#39;s in my actual project. Just using for testing right now.&lt;/p&gt;
&lt;p&gt;I think the next step for me is to try attaching to different GPIO and testing.&lt;/p&gt;
&lt;p&gt;Also, I want this to all be interrupt driven. Would it be better to use the NVIC from the softdevice library or GPIOTE? I want the interrupt to trigger whenever the 5 position switch changes, then read the position in the interrupt handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37129?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 16:56:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:676531ab-5a48-476f-8c5a-7af851ea0eda</guid><dc:creator>Blue_Alien</dc:creator><description>&lt;p&gt;Dan,&lt;/p&gt;
&lt;p&gt;Thanks. I double checked the Dev Kit schematic and P0.08, P0,09, and P0.10 are connected to the corresponding GPIO of the NRF52. They are not on the physical pins 8, 9, and 10 of the package. Just to be safe, I will try using 3 different GPIO.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37126?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 10:39:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1805a68-7a1a-4319-b309-699b2441b77d</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Me neither - perhaps the original poster can confirm what the 5-position switch common terminal is connected to (V+ or GND) and also confirm the exact pins on the devkit they attached it to to make sure those pins are the right ones for 8, 9 and 10. This is so simple it&amp;#39;s hard to understand what the problem is.&lt;/p&gt;
&lt;p&gt;Also how about trying a very low-tech approach of putting a multimeter on the pin you&amp;#39;re trying to read  and ensuring it is at V+.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37125?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 10:35:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8acef917-f76e-4982-a24f-65aab065ea30</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;You are right RK. I must have jumped to the code before I had read all the text. My answer is based on this misunderstanding, and reflects what would have to be done in order to use the buttons on the DK. I do not see anything wrong with the code as long as the pin numbers and pull is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37124?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 10:11:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7870845e-c7d1-4bfd-8bc3-3f8427ae399b</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Why do you say the switch numbers should be 13, 14 and 15 when he states that he has a 5-position switch attached to pins 8, 9 and 10? He doesn&amp;#39;t say he&amp;#39;s trying to detect the buttons on the board, he&amp;#39;s trying to detect his own switch.  And you can&amp;#39;t really say whether it should be a pull-up or a pull-down since he doesn&amp;#39;t state whether the common terminal on the 5-position switch is V+ or GND. If it&amp;#39;s GND then he should change it to a pullup, if it&amp;#39;s V+ however, then the pulldown is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37123?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 08:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0a9fdf3-236b-4f6b-b781-865a0f2b5661</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I assume the development board you have is the nRF52 DK or nrf52 Preview DK? If so there are a few issues with your code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The switch numbers should be 13, 14 and 15. (You could use the BSP header file as you do with LED&amp;#39;s, and use BUTTON_1 etc.)&lt;/li&gt;
&lt;li&gt;You should enable the internal pullup resistors, not the pulldown&amp;#39;s.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For a real application you would probably be better off using events/interrupts via the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk52.v0.9.2/group__nrf__drv__gpiote.html?resultof=%22%47%50%49%4f%54%45%22%20%22%67%70%69%6f%74%22%20"&gt;GPIOTE driver&lt;/a&gt; instead of reading the input pins in your main loop. You could also use PPI which would allow you to control the LED&amp;#39;s using buttons without any involvement from the CPU (except the initial configuration).&lt;/p&gt;
&lt;p&gt;(I converted this from a answer to a comment)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with basic GPIO read on NRF52</title><link>https://devzone.nordicsemi.com/thread/37128?ContentTypeID=1</link><pubDate>Sun, 01 Nov 2015 15:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d219628-24d9-41db-a7bf-c360dd4bd39a</guid><dc:creator>Dan Danknick</dc:creator><description>&lt;p&gt;Without seeing your schematic, this is just a guess but have you confused GPIO port pin numbers with the physical pin numbers on the package (8,9,10)?&lt;/p&gt;
&lt;p&gt;Dan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>