<?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 configuration and usage</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49074/gpio-configuration-and-usage</link><description>Hello, 
 I am using the chip nrf52840. I am trying to configure three pins (P0.09, P0.10 and P0.11) as output pins and I am trying to make set and reset functions for them. I used the gpio_toggle example to help me do it. However, I am not doing something</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Jul 2019 08:38:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49074/gpio-configuration-and-usage" /><item><title>RE: Gpio configuration and usage</title><link>https://devzone.nordicsemi.com/thread/195544?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 08:38:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:766c9b39-4755-4607-9075-ade152f092d6</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Johnny&lt;/p&gt;
&lt;p&gt;P0.18 should not be used as a GPIO as it is the RESET button and the only pin that can be used like that. I suggest using P0.15, P0.16, and P0.17 instead, these pins have no other functions than being GPIO pins. Please refer to the &lt;a href="https://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.1.pdf"&gt;product specification&lt;/a&gt; when assigning GPIO pins. &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/31324/toggle-a-pin-of-nrf52"&gt;This post&lt;/a&gt; should be helpful to let you toggle your pins, please look at that. My colleague Martin also links to a very helpful tutorial on the matter of using the various nRF52 peripherals.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Gpio configuration and usage</title><link>https://devzone.nordicsemi.com/thread/195311?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2019 09:22:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6c76f97-9e65-4c99-b566-351be13bb78b</guid><dc:creator>JohnnyMcMan</dc:creator><description>&lt;p&gt;Hello Simonr,&lt;/p&gt;
&lt;p&gt;Thank you for the fast reply. First of all i&amp;#39;m sorry, in the previous code I didn&amp;#39;t configure the pins as output in the main loop even though I made the functions to do it. Second, I changed the GPIO pins to pins P0.17, P0.18 and P0.19. However, I still can&amp;#39;t seem to read high voltage on those pins. This is the new code, it has a very slight difference from the code above. I try to set and reset the three pins every 6 seconds. Any suggestions why it is still not working? I am checking the voltage using my multimeter.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;quot;nrf_drv_spi.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;

#define CS_FLASH_MEMORY_PIN (17UL)
#define HOLD_PIN (18UL)
#define WRITE_PROTECT_PIN (19UL)

void configure_pin_direction_as_output(unsigned long pin){

NRF_GPIO-&amp;gt;PIN_CNF[pin] = (GPIO_PIN_CNF_DIR_Output &amp;lt;&amp;lt; GPIO_PIN_CNF_DIR_Pos) |
                         (GPIO_PIN_CNF_DRIVE_S0S1 &amp;lt;&amp;lt; GPIO_PIN_CNF_DRIVE_Pos) |
                         (GPIO_PIN_CNF_INPUT_Connect &amp;lt;&amp;lt; GPIO_PIN_CNF_INPUT_Pos) |
                         (GPIO_PIN_CNF_PULL_Disabled &amp;lt;&amp;lt; GPIO_PIN_CNF_PULL_Pos) |
                         (GPIO_PIN_CNF_SENSE_Disabled &amp;lt;&amp;lt; GPIO_PIN_CNF_SENSE_Pos);

}

void set_pin(unsigned long pin){

	 NRF_GPIO-&amp;gt;OUTSET = (1UL &amp;lt;&amp;lt; pin);

}

void reset_pin(unsigned long pin){

	 NRF_GPIO-&amp;gt;OUTCLR = (1UL &amp;lt;&amp;lt; pin);

}

void configure_chip_select_pin_of_the_flash_memory(void){

  configure_pin_direction_as_output(CS_FLASH_MEMORY_PIN);

}

void configure_hold_pin_of_the_flash_memory(void){

  configure_pin_direction_as_output(HOLD_PIN);

}

void configure_write_protect_pin_of_the_flash_memory(void){

  configure_pin_direction_as_output(WRITE_PROTECT_PIN);

}

void deactivate_chip_select_pin_of_the_flash_memory(void){

  set_pin(CS_FLASH_MEMORY_PIN);

}


void activate_chip_select_pin_of_the_flash_memory(void){

  reset_pin(CS_FLASH_MEMORY_PIN);

}

void deactivate_hold_pin(void){

	set_pin(HOLD_PIN);

}

void activate_hold_pin(void){

	reset_pin(HOLD_PIN);

}

void deactivate_write_protect_pin(void){

	set_pin(WRITE_PROTECT_PIN);

}

void activate_write_protect_pin(void){

	reset_pin(WRITE_PROTECT_PIN);

}

void initialize_pin_configuration_of_the_flash_memory(void){

	configure_chip_select_pin_of_the_flash_memory();
	configure_hold_pin_of_the_flash_memory();
	configure_write_protect_pin_of_the_flash_memory();

}

int main(void)
{	
	initialize_pin_configuration_of_the_flash_memory();
	
    while (1)
    {
				deactivate_chip_select_pin_of_the_flash_memory();
				deactivate_hold_pin();
				deactivate_write_protect_pin();
			
				nrf_delay_ms(6000);
			
				activate_chip_select_pin_of_the_flash_memory();
				activate_hold_pin();
				activate_write_protect_pin();
			
				nrf_delay_ms(6000);
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Gpio configuration and usage</title><link>https://devzone.nordicsemi.com/thread/195258?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2019 06:18:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:947a0e24-0d0b-4ea4-a1b9-94d5e6ab3c15</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hey,&lt;/p&gt;
&lt;p&gt;The pins P0.09 and P0.10 are by default set as NFC pins on the nRF52840. To use them as GPIOs please see &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpin.html&amp;amp;cp=3_1_0_3_2_1&amp;amp;anchor=concept_sq5_lcz_2q"&gt;the documentation provided here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>