<?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>Controlling port pins</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4819/controlling-port-pins</link><description>I am trying to debug a SPI application using Keil and the Eval board, but am having problems with control of the port pins. I am using pin 23 as the CS pin. it configures correctly as an output, but the functions NRF_GPIO-&amp;gt;OUTSET = 23; and NRF_GPIO-&amp;gt;OUTCLR</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 08 Aug 2015 20:26:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4819/controlling-port-pins" /><item><title>RE: Controlling port pins</title><link>https://devzone.nordicsemi.com/thread/17052?ContentTypeID=1</link><pubDate>Sat, 08 Aug 2015 20:26:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c57a2fa-7adf-408e-9264-9cf1aa8c05ae</guid><dc:creator>2R</dc:creator><description>&lt;p&gt;Am I correct to say, OUTCLR by 1 has no effect, but OUTCLR by 0 will clear the pin?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controlling port pins</title><link>https://devzone.nordicsemi.com/thread/17050?ContentTypeID=1</link><pubDate>Tue, 16 Dec 2014 12:12:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00e6622d-bf60-4dc5-bce1-d93007b45fb6</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Yes, I recommend to use the nrf_gpio library&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controlling port pins</title><link>https://devzone.nordicsemi.com/thread/17049?ContentTypeID=1</link><pubDate>Mon, 15 Dec 2014 15:31:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3458fa3-dc94-4954-a03a-3c0cfa274f3d</guid><dc:creator>Julian</dc:creator><description>&lt;p&gt;I was aware of what you describe, but I missed the significance of the arguments. I now realise that nrf_gpio_pin_set(23)  has an argument that defines the pin number, whereas If I want to use NRF_GPIO-&amp;gt;OUTSET I should have written NRF_GPIO-&amp;gt;OUTSET= (1UL&amp;lt;&amp;lt;23). I think I will stick to nrf_gpio_pin_set&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controlling port pins</title><link>https://devzone.nordicsemi.com/thread/17051?ContentTypeID=1</link><pubDate>Mon, 15 Dec 2014 15:15:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff864ff7-69e4-4cb2-bfb3-28bb9fd43a29</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Yes, that is correct. If you do a NRF_GPIO-&amp;gt;OUTSET = 23; you are setting the output states for the entire port, not GPIO pin 23. That is why the nrf_gpio_pin_set shifts a 1 bit by the pin number you pass in to set the pin as an output. I&amp;#39;d suggest reading the GPIO section of the reference manual (Section 14 in revision 3.0). Note that setting a OUTSET bit to a zero has no effect which is why that assignment doesn&amp;#39;t need to be an |=&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controlling port pins</title><link>https://devzone.nordicsemi.com/thread/17048?ContentTypeID=1</link><pubDate>Mon, 15 Dec 2014 15:00:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f0eb5fc-bf05-416c-b40a-7c8162e5316e</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;You observation is as expected. When you write NRF_GPIO-&amp;gt;OUTSET = 23 you will set pin 0, 1, 2 and 4 since OUTSET is a 32 bit register and the decimal number 23 is equal to binary number 10111. However, when you call nrf_gpio_pin_set, the number 1 is shifted 23 places in the register and therefore pin 23 is set.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Controlling port pins</title><link>https://devzone.nordicsemi.com/thread/17047?ContentTypeID=1</link><pubDate>Sun, 14 Dec 2014 23:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17283ba4-59cc-4b4a-bacb-ebbdf7fd6ec4</guid><dc:creator>Julian</dc:creator><description>&lt;p&gt;Interesting point: - the binary value for 23 (17 HEX) is .....00010111 --- which would suggest that NRF_GPIO-&amp;gt;Outset(pin_number) is setting the port, not an individual pin - although the attached comment in file &lt;strong&gt;nrf_gpio.h&lt;/strong&gt; would suggest otherwise. The code was taken from the  spi_master_example project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>