<?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>GPIO pin configuration</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70735/gpio-pin-configuration</link><description>Hi there! 
 We are using nRF52840DK development kit with nRF-Connect SDK to build a pre-production version of our product. 
 We need more GPIO configurations for our project. Can we get step by step procedure for GPIO configuration other than predefined</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 Jan 2021 07:28:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70735/gpio-pin-configuration" /><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290925?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 07:28:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3a1d540-8551-4410-adb5-d9d38628ab91</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Glad to help.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290921?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 07:19:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:149250df-a0af-406a-b8bb-a6d1fa6162ac</guid><dc:creator>samuel kapa</dc:creator><description>&lt;p&gt;hi Amanda H,&lt;/p&gt;
&lt;p&gt;thanks for u r help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290470?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 11:29:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ba67c36-642b-4078-8c96-cd5255e2a6e4</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Samuel,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please see the&amp;nbsp;&lt;a title="Connector interface" href="https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/dk/connector_if.html?cp=4_0_4_7_5"&gt;Connector interface&lt;/a&gt;&amp;nbsp;of nRF52840DK. I don&amp;#39;t think there is P0.02.&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;P0.00&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;P0.01&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;are used for the 32.768 kHz crystal and are not available on the connectors. For more information, see&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a title="The nRF52840 SoC can use an optional 32.768 kHz crystal (X2) for higher accuracy and lower average power consumption." href="https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/dk/hw_32khz_crystal.html#hw_32khz_crystal"&gt;32.768 kHz crystal&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290457?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 10:49:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d841df65-0c58-42e9-81e4-fc671d37d8b6</guid><dc:creator>samuel kapa</dc:creator><description>&lt;p&gt;hi Amanda H,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; here is the sample code i am writing for gpio.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;zephyr.h&amp;gt;&lt;br /&gt;#include &amp;lt;device.h&amp;gt;&lt;br /&gt;#include &amp;lt;sys/util.h&amp;gt;&lt;br /&gt;#include &amp;lt;inttypes.h&amp;gt;&lt;br /&gt;#include &amp;lt;devicetree.h&amp;gt;&lt;br /&gt;#include &amp;lt;sys/printk.h&amp;gt;&lt;br /&gt;#include &amp;lt;drivers/pwm.h&amp;gt;&lt;br /&gt;#include &amp;lt;drivers/gpio.h&amp;gt;&lt;br /&gt;#include &amp;lt;nrfx/hal/nrf_gpio.h&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;//#define SLEEP_TIME_MS 3000&lt;/p&gt;
&lt;p&gt;#define OUTPUT_PIN 15&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;void main(void)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; nrf_gpio_cfg_output(OUTPUT_PIN);&lt;br /&gt;&amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; while (1) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nrf_gpio_pin_set(OUTPUT_PIN);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; k_sleep(K_SECONDS(3U));&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nrf_gpio_pin_clear(OUTPUT_PIN);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; k_sleep(K_SECONDS(3U));&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;with is pin number 15 or 16, 13, 14. i am getting output.&lt;/p&gt;
&lt;p&gt;but if i change the pin number to like 1 or 2. i am not getting any out put but it&amp;#39;s uploading to board.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;samuel kapa.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290432?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 10:04:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c67977dd-687f-4103-9542-30badcce6891</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Samuel,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is P0.16. You can also use&amp;nbsp;&lt;a title="NRF_GPIO_PIN_MAP" href="https://infocenter.nordicsemi.com/topic/drivers_nrfx_v2.4.0/group__nrf__gpio__hal.html?cp=8_0_3_0_15_0_1#ga0d66f2aaf7771ca4424237174032bf6a"&gt;NRF_GPIO_PIN_MAP&lt;/a&gt;(port, pin)&amp;nbsp;with the definition if you want to use a pin on port 1.&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290422?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 09:43:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:731c4522-8977-48a9-9a19-0a7f99c7f05c</guid><dc:creator>samuel kapa</dc:creator><description>&lt;p&gt;hi Amanda H,&lt;/p&gt;
&lt;p&gt;thanks for reply.&lt;/p&gt;
&lt;p&gt;in #define OUTPUT_PIN 16.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;what is mean by 16.&lt;/p&gt;
&lt;p&gt;if its pin then what is port.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;samuel kapa&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290420?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 09:42:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72a0a724-2a4e-41cb-81a3-87ef1f71177d</guid><dc:creator>samuel kapa</dc:creator><description>&lt;p&gt;in #define OUTPUT_PIN 16.&lt;/p&gt;
&lt;p&gt;what&amp;#39;s 16 means&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO pin configuration</title><link>https://devzone.nordicsemi.com/thread/290413?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 09:19:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c796b94-bbbe-4144-8db1-43523d0a9785</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Samuel,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Not sure what&amp;nbsp;exactly you want to use the GPIO configuration for.&lt;/p&gt;
&lt;p&gt;This tutorial&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-2-ncs-v1-4-0"&gt;https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-2-ncs-v1-4-0&lt;/a&gt;&amp;nbsp;shows how to config GPIO for PWM on nRF9160DK and nRF5340 PDK, but the same concept can apply to&amp;nbsp;&lt;span&gt;nRF52840DK. You also could search for similar use cases on Devzone.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you want to use GPIOs independently from any peripheral, you can also use the nrfx GPIO HAL functions directly in the code without setting .overlay or .config as&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;nrfx/hal/nrf_gpio.h&amp;gt; 

#define OUTPUT_PIN 16

 

void main(void)
{
    nrf_gpio_cfg_output(OUTPUT_PIN);
    nrf_gpio_pin_clear(OUTPUT_PIN);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-Amanda H.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>