<?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>Question about set GPIO pin status</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69499/question-about-set-gpio-pin-status</link><description>Hi, 
 I have a question about setting the gpio pin status. From the picture, it seems that the value on the right represents the status of the gpio pin. So the default value is 2, which means using input mode and disconnecting with input buffer, right</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Dec 2020 17:07:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69499/question-about-set-gpio-pin-status" /><item><title>RE: Question about set GPIO pin status</title><link>https://devzone.nordicsemi.com/thread/285174?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 17:07:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6e67029-f747-4d1b-bf44-77c40e6046c9</guid><dc:creator>Leogean</dc:creator><description>&lt;p&gt;Ah, I understand, thanks a lot for the detailed explanation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about set GPIO pin status</title><link>https://devzone.nordicsemi.com/thread/285003?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 10:32:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a95745e7-293c-4c09-9712-66927605fba1</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The state of the pin is not reflected in the PIN_CFG register, you need to read the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/gpio.html#register.IN"&gt;IN register&lt;/a&gt;&amp;nbsp;to get the state of pins configured as inputs. To read state of pins configured as outputs, you can read the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/gpio.html?cp=4_0_0_5_8_1_3#register.OUTSET"&gt;OUTSET&lt;/a&gt;&amp;nbsp;register.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/v1.8.4/hal/nrf_gpio.h#L666-L676"&gt;nrf_gpio_pin_write&lt;/a&gt;() will only call nrf_gpio_pin_clear() or nrf_gpio_pin_set(), depending on the second argument (0 will clear, 1 or above will set).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about set GPIO pin status</title><link>https://devzone.nordicsemi.com/thread/284922?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 06:40:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea49f7c6-ce4d-4769-b1ab-e089021c5cfe</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;The code is okay. And the debug message told you it&amp;#39;s output. However, I think your debug break-point is wrong. Because the main loop should for(;;) or while(1) loop. Even through you trace the function. You should make the break-point with some command.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;void system_io_init(void)&lt;br /&gt;{&lt;br /&gt; nrf_gpio_cfg_output(LNA_ENABLE_PIN);&lt;br /&gt; nrf_gpio_pin_set(LNA_ENABLE_PIN);&lt;br /&gt; //nrf_gpio_pin_clear(LNA_ENABLE_PIN);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;int main()&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; system_io_init();&lt;/p&gt;
&lt;p&gt;ble_stack_init();&lt;/p&gt;
&lt;p&gt;db_discovery_init();&lt;br /&gt; gatt_c_init();&lt;br /&gt; &lt;br /&gt; // Start scanning for peripherals and initiate connection to devices which&lt;br /&gt; // advertise.&lt;br /&gt; scan_start();&lt;/p&gt;
&lt;p&gt;for (;;)&lt;br /&gt; {&lt;br /&gt; if (NRF_LOG_PROCESS() == false)&lt;br /&gt; {&lt;br /&gt; // Wait for BLE events.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrf_gpio_pin_set(LNA_ENABLE_PIN);&lt;/span&gt;&lt;br /&gt; power_manage();&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrf_gpio_pin_clear(LNA_ENABLE_PIN);&lt;/span&gt;&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt; nrf_gpio_pin_clear(LNA_ENABLE_PIN);&lt;/p&gt;
&lt;p&gt;my_delay(50);//&amp;nbsp; &amp;nbsp; Break-point here&lt;br /&gt; }&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about set GPIO pin status</title><link>https://devzone.nordicsemi.com/thread/284921?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 06:15:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8db6602f-c00d-44c7-9af5-2ba3ae400622</guid><dc:creator>Leogean</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/2783.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Thanks very much for your fast response. The picture shows all my main function in my project. I do not configure this pin anywhere else, even in the sdk_config.h. But when I checking the register, the output is not clear after &amp;quot;nrf_gpio_pin_clear(19)&amp;quot;, and you can see I cannot even set the breakpoint to check the &amp;quot;nrf_gpio_pin_write&amp;quot; (no arrow mark on the left). Do I miss something in order to change the status of the gpio pin?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about set GPIO pin status</title><link>https://devzone.nordicsemi.com/thread/284916?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 05:07:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0231e2cd-53db-45eb-ab32-2b2434dde6a8</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;#define LNA_ENABLE_PIN 17&amp;nbsp; //P0.17&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_output(LNA_ENABLE_PIN);&lt;br /&gt; nrf_gpio_pin_set(LNA_ENABLE_PIN);&lt;/p&gt;
&lt;p&gt;also yours&amp;nbsp;&lt;span&gt;nrf_gpio_pin_write(17, 1); is okay&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;output low:nrf_gpio_pin_clear(LNA_ENABLE_PIN); or&amp;nbsp;nrf_gpio_pin_write(17, 0);&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Your question 1. You try the code configuration P0.17 but fail.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think the most reasons are assigned the configuration by the other application. You may check your sdk_config.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Maybe you can find P0.17 for other functions as input.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about set GPIO pin status</title><link>https://devzone.nordicsemi.com/thread/284915?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 03:56:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdf84c77-9e06-43db-8ca8-4445a9e1759d</guid><dc:creator>Leogean</dc:creator><description>&lt;p&gt;By the way, what I am doing is like:&lt;/p&gt;
&lt;p&gt;First: nrf_gpio_cfg_output(17);&lt;/p&gt;
&lt;p&gt;Then: nrf_gpio_pin_write(17, 3);&lt;/p&gt;
&lt;p&gt;Is this process is correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>