<?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>nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17367/nrf52-changing-pio-from-analog-to-digital-output</link><description>Dear Wang, 
 I am unable find any documentation and board Initialisation code on how to change PIO from analog to digital output. but can&amp;#39;t seem to locate the setting. 
 Need PIO1 to operate in Digital mode. And similarly other PIOs as well. 
 Regards</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Oct 2016 09:59:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17367/nrf52-changing-pio-from-analog-to-digital-output" /><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66769?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2016 09:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f34fe480-0fe7-485e-a3f0-b2750bf8b08c</guid><dc:creator>AmitKumar</dc:creator><description>&lt;p&gt;For P0.22 - This seems to be sporadic, i will get back on it. But the Pio is not being used by SPI, it is separate from pins configured for SPI.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66768?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2016 12:32:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:397bd891-b872-4bb1-bd29-2a86aad752ae</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Which SDK version are you using? Which pins are configured for NRF_DRV_SPI_DEFAULT_CONFIG? Can you toggle the pin if you explicitly specify all SPI pins to be other pins than P0.22?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66770?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2016 12:22:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b697bc6e-a9f1-4620-8464-fa752cb7beb6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;On the nRF52-DK you have to &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52/dita/nrf52/development/dev_kit_v1.1.0/hw_32khz_crystal.html?cp=2_0_0_1_5"&gt;cut and solider SB1-SB4&lt;/a&gt; to disconnect the external 32 kHZ crystal, to use the pins as GPIO. Make sure your application is not &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/clock.html?cp=2_2_0_18_1#concept_xkj_np1_2r"&gt;configured to use external crystal&lt;/a&gt;. To use RESET pin (P0.21) as GPIO, you need to &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/uicr.html#register.PSELRESET-0"&gt;remap the RESET pin&lt;/a&gt; in the UICR registers, and solider SB17 on nRF52-DK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66767?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2016 12:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ffea893-1ca0-40e2-b31e-4bb8a3668d15</guid><dc:creator>AmitKumar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Within the same code (the overall project is trying to use PIO1 as chip select for the flash), I am not able to toggle the PIO22 (like below) also, without commenting out nrf_drv_spi_init and nrf_drv_spi_transfer. This code is the spi example from keil5 with SPI pins reassigned from default to flash. Behaviour is identical to what we are observing on nRF52-DK.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG(SPI_INSTANCE);
spi_config.ss_pin = SPI_CS_PIN;
//APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, spi_event_handler));
		
nrf_gpio_cfg_output(22);
    
while(1)
{
			

        // Reset rx buffer and transfer done flag
        memset(m_rx_buf, 0, m_length);
        spi_xfer_done = false;
	    m_tx_buf[0] = 0x5;
        m_length = 1;
	    m_length2 = 4;
	   m_rx_buf[0] = m_rx_buf[1] = m_rx_buf[2] = m_rx_buf[3] = 0xAA;
	   //APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, m_length2));


        while(spi_xfer_done == false)
        {
            __SEV();
            __WFE();
            __WFE();
        }

        LEDS_INVERT(BSP_LED_0_MASK);
	    nrf_delay_ms(1000);
	    nrf_gpio_pin_toggle(22);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Thx, AmitKumar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66766?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2016 11:50:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e8bb95c-2378-402a-9bc2-3770ae0fa587</guid><dc:creator>AmitKumar</dc:creator><description>&lt;p&gt;We tested it on nRF52-DK as well. If we can switch it on there, that will also help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66765?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2016 11:33:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e41d06d9-7340-439c-8a97-62b939519990</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Are you using the nRF52-DK or a custom board?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66764?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2016 11:28:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4734f24e-6f2c-44df-b121-db29d3a4c38d</guid><dc:creator>Jagadish.H</dc:creator><description>&lt;p&gt;this is more specific to the device that could also be using the same PIO, not just analog. for eg:
PIO1 can be used as XL2 input, as well as Digital IO, The functions you have suggested are not doing the job. I need to switch the PIO1 to Digital IO, as described in the product datasheet (on page 13, nRF52832_PS_v1.2). I have exact same issue with GPIO 21, which is stuck in nReset, that also needs to be switched to Digital IO.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 changing PIO from Analog to Digital Output</title><link>https://devzone.nordicsemi.com/thread/66763?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2016 08:35:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96a870d1-2051-4194-a2b8-2d4d603926fa</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There are no analog outputs on the nRF52, as this would require a DAC. The closest to analog output will be to output &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/pwm.html?cp=2_2_0_46#concept_pzc_1pw_nr"&gt;PWM signals&lt;/a&gt; on the pins.&lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/group__nrf__gpio.html?cp=4_0_0_6_6_7"&gt;GPIO abstraction API documentation&lt;/a&gt; about how to configure GPIO. The simples configuration of an output would be to call the function &lt;code&gt;nrf_gpio_cfg_output(uint32_t pin_number)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>