title: Setting up a pin in NXP LPC1769
body: <p>I only need to modify a source code for just another port/pins.
  I have studied with <a href="http://www.nxp.com/documents/user_manual/UM10360.pdf" rel="nofollow noreferrer">NXP UM10360</a> as much as I could.</p>
  
  <p>I have that setup;</p>
  
  <p>Header file used from "CMSIS_CORE_LPC17xx" : <strong>LPC17xx.h</strong></p>
  
  <pre><code>LPC_PINCON-&gt;PINSEL0 |= 0x2&lt;&lt;14; //P0.7 &gt; SCK1 
  LPC_PINCON-&gt;PINSEL0 |= 0x2&lt;&lt;16; //P0.8 &gt; MISO1 
  LPC_PINCON-&gt;PINSEL0 |= 0x2&lt;&lt;18; //P0.9 &gt; MOSI1 
  </code></pre>
  
  <p>and</p>
  
  <p>I want to replace those pins with another (from SSP1 to SSP0).</p>
  
  <pre><code>P0.7 will be P0.15
  P0.8 will be P0.17
  P0.9 will be P0.18
  </code></pre>
  
  <p>And as per the manual, I tried this (Function 10);  </p>
  
  <pre><code>LPC_PINCON-&gt;PINSEL0 &amp;= ~((0x3 &lt;&lt; 31)|(0x3 &lt;&lt; 30));//P0.15, SCK0
  LPC_PINCON-&gt;PINSEL0 |= ((0x2 &lt;&lt; 31)|(0x2 &lt;&lt; 30)); //ENable clock
  LPC_PINCON-&gt;PINSEL1 &amp;= ~((0x2 &lt;&lt; 3)|(0x2 &lt;&lt; 2));//P0.17,  MISO0
  LPC_PINCON-&gt;PINSEL1 &amp;= ~((0x2 &lt;&lt; 5)|(0x2 &lt;&lt; 4));//P0.18,  MOSI0
  </code></pre>
  
  <p>But, SPI device has stopped after this. The original setup above is working fine and showing me nice SPI signals with Logic Analyzer. But, with that new pins and setup accordingly, I can only get CSN and MISO and SCK only enabled (no pulse) on the Logic Analyzer.</p>
  
  <p><strong>Just this:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/onVeJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/onVeJ.png" alt="enter image description here"></a></p>
  
  <p>What am I doing wrong?
  (I am inexperienced with NXP MCU's, please bear with me.)</p>
  
  <p><strong>Edited:</strong></p>
  
  <p>For the records, I found it my-self eventually, problem solved;</p>
  
  <pre><code>LPC_PINCON-&gt;PINSEL0 |= 0x2&lt;&lt;30; //SCK0, P0.15 
  LPC_PINCON-&gt;PINSEL1 |= 0x2&lt;&lt;2;  //MISO0, P0.17 
  LPC_PINCON-&gt;PINSEL1 |= 0x2&lt;&lt;4;  //MOSI0, P0.18 
  LPC_GPIO0-&gt;FIODIR |= (1&lt;&lt;16);   //SSEL/CSN, P0.16 
  </code></pre>
  
  <p>Here is the outcome on the Logic Analyzer;</p>
  
  <p><a href="https://i.stack.imgur.com/PgUZu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PgUZu.png" alt="enter image description here"></a></p>