<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LPC812, PORT0_0 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565119#M17023</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MarcVonWindscooting on Tue Mar 25 15:26:31 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It is known, that GPIO clock is enabled on LPC812FD20, Rev 4C (current volume production) at least - in contradiction to the UM (1.3 at least). I did not believe and tried myself. It's true!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although I like your style of 'minimally invasive' instructions (&amp;amp;=, |=, set, clear registers,...), I fear you run into problems that result from register (default) contents in contradiction to the UM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you try with direct assignments of the config registers? Or at least check, whether the config registers you use are set as expected?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Welcome, by the way&amp;nbsp; ;-) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE: I tried the following and it works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;** Failed to inline code **&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Forget it. I never can inline code in this forum, I don't know why. One less than or greater than and all seems gone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Find the file attached.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something else must be wrong with your headers or your hardware device.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE again: As soon as I switch off IOCON clock, my P0_0 is dead, too. And I found why:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SYSAHBCLKCTRL bits 20..31: reserved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What you read from reserved bits is undefined (random in the worst case). What you write has to be all 0s ! This is violated by SYSAHBCLKCTRL &amp;amp;= ~0 already. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:06:21 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:06:21Z</dc:date>
    <item>
      <title>LPC812, PORT0_0</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565118#M17022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by alagner on Tue Mar 25 13:27:27 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all, hello from a new board user &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now the point:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;what I am trying to achieve is setting the PORT0_0 as output and driving the RFM73 CE pin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My looks like that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void pins_init(void)
{
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;6) | (1&amp;lt;&amp;lt;7)&amp;nbsp; | (1&amp;lt;&amp;lt;18); //gpio, switch matrix, iocon enable
&amp;nbsp; LPC_GPIO_PORT-&amp;gt;DIR0 |= (1&amp;lt;&amp;lt;0); //P0_0 output
&amp;nbsp; LPC_IOCON-&amp;gt;PIO0_0 &amp;amp;= ~(0x03&amp;lt;&amp;lt;3); //clear all pullups on P0_0
&amp;nbsp; LPC_SWM-&amp;gt;PINENABLE0 |=(1&amp;lt;&amp;lt;0); //just in case;should off as default, added after problems
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL &amp;amp;= ~(1&amp;lt;&amp;lt;7) &amp;amp; ~(1&amp;lt;&amp;lt;18); //all set-up so shut them down
&amp;nbsp; // todo INT pin
}

inline void
rfm73_ce_pin_set_high_state(void)
{
&amp;nbsp; LPC_GPIO_PORT-&amp;gt;SET0 = (1&amp;lt;&amp;lt;0);
}
inline void
rfm73_ce_pin_set_low_state(void)
{
&amp;nbsp; LPC_GPIO_PORT-&amp;gt;CLR0 = (1&amp;lt;&amp;lt;0);
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;...and the pin goes HiZ right after disabling pullups and the output cannot be set in any way. Checked using voltmeter (always 0.3 - 0.6V) and scope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However this one:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;int
main(void)
{
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;6) | (1&amp;lt;&amp;lt;18);&amp;nbsp;&amp;nbsp;&amp;nbsp; //gpio clock enable, io control clock enable
&amp;nbsp; LPC_IOCON-&amp;gt;PIO0_16 = (1&amp;lt;&amp;lt;7);&amp;nbsp; //disable pullups
&amp;nbsp; LPC_GPIO_PORT-&amp;gt;DIR0 |= (1&amp;lt;&amp;lt;16);

&amp;nbsp; for(;;)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (volatile int i=0; i&amp;lt; 100000; i++); 
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO_PORT-&amp;gt;NOT0 = (1&amp;lt;&amp;lt;16);
&amp;nbsp; }

&amp;nbsp; return 0;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;blinks led like charm. What's the catch then?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:06:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565118#M17022</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPC812, PORT0_0</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565119#M17023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MarcVonWindscooting on Tue Mar 25 15:26:31 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It is known, that GPIO clock is enabled on LPC812FD20, Rev 4C (current volume production) at least - in contradiction to the UM (1.3 at least). I did not believe and tried myself. It's true!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although I like your style of 'minimally invasive' instructions (&amp;amp;=, |=, set, clear registers,...), I fear you run into problems that result from register (default) contents in contradiction to the UM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you try with direct assignments of the config registers? Or at least check, whether the config registers you use are set as expected?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Welcome, by the way&amp;nbsp; ;-) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE: I tried the following and it works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;** Failed to inline code **&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Forget it. I never can inline code in this forum, I don't know why. One less than or greater than and all seems gone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Find the file attached.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something else must be wrong with your headers or your hardware device.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE again: As soon as I switch off IOCON clock, my P0_0 is dead, too. And I found why:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SYSAHBCLKCTRL bits 20..31: reserved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What you read from reserved bits is undefined (random in the worst case). What you write has to be all 0s ! This is violated by SYSAHBCLKCTRL &amp;amp;= ~0 already. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:06:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565119#M17023</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: LPC812, PORT0_0</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565120#M17024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by alagner on Tue Mar 25 16:20:44 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Still no luck&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;6) | (1&amp;lt;&amp;lt;7)&amp;nbsp; | (1&amp;lt;&amp;lt;18); //gpio, switch matrix, iocon enable
&amp;nbsp; LPC_IOCON-&amp;gt;PIO0_0 &amp;amp;= ~(0x03&amp;lt;&amp;lt;3) &amp;amp; 0x0000FFFF; //clear all pullups on P0_0 
&amp;nbsp; //right after the above instruction the pin goes "permanent high impedance"

&amp;nbsp; LPC_SWM-&amp;gt;PINENABLE0 |=(1&amp;lt;&amp;lt;0);&amp;nbsp; 
&amp;nbsp; LPC_GPIO_PORT-&amp;gt;DIR0 |= (1&amp;lt;&amp;lt;0); //P0_0 output
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL &amp;amp;= ~(1&amp;lt;&amp;lt;7) &amp;amp; ~(1&amp;lt;&amp;lt;18) &amp;amp; 0xFFFFF;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:06:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565120#M17024</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: LPC812, PORT0_0</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565121#M17025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MarcVonWindscooting on Tue Mar 25 16:57:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: alagner&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
LPC_IOCON-&amp;gt;PIO0_0 &amp;amp;= ~(0x03&amp;lt;&amp;lt;3) &amp;amp; 0x0000FFFF; //clear all pullups on P0_0 
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I explained with the wrong register. The one above has bits 16..31 'reserved'. Same problem, if accessed as a 32-bit word.&amp;nbsp; My lib accesses here with 16bits. Check &lt;/SPAN&gt;&lt;STRONG&gt;your&lt;/STRONG&gt;&lt;SPAN&gt; header file providing LPC_IOCON. Or better use that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_0 = LPC_IOCON-&amp;gt;PIO0_0 &amp;amp; ~(0x03&amp;lt;&amp;lt;3) &amp;amp; 0x0000FFFF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is NOT the same in this special context, contrary to intuition &lt;SPAN class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;&lt;LI-EMOJI id="lia_face-with-open-mouth" title=":face_with_open_mouth:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: Sorry the last 2 lines are bullshit! It's way too late, I should go to bed. I don't have any more ideas this night any more....&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:06:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565121#M17025</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC812, PORT0_0</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565122#M17026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by bavarian on Wed Mar 26 06:39:06 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I lost a little bit the overview what in fact you try to achieve and where the problem is&amp;nbsp; 8-) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe the code snippet below helps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
/* This code sets all 18GPIOs on LPC812 to output */
/* Enable AHB clock to the GPIO domain. */
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;6);
// Configure the pins through the switch matrix
LPC_SWM-&amp;gt;PINENABLE0 = 0xFFFFFFFF;

/* Pin I/O Configuration */
LPC_IOCON-&amp;gt;PIO0_0 = 0x98;
LPC_IOCON-&amp;gt;PIO0_1 = 0x98;
LPC_IOCON-&amp;gt;PIO0_2 = 0x98;
LPC_IOCON-&amp;gt;PIO0_3 = 0x98;
LPC_IOCON-&amp;gt;PIO0_4 = 0x98;
LPC_IOCON-&amp;gt;PIO0_5 = 0x98;
LPC_IOCON-&amp;gt;PIO0_6 = 0x98;
LPC_IOCON-&amp;gt;PIO0_7 = 0x98;
LPC_IOCON-&amp;gt;PIO0_8 = 0x98;
LPC_IOCON-&amp;gt;PIO0_9 = 0x98;
LPC_IOCON-&amp;gt;PIO0_10 = 0x100;
LPC_IOCON-&amp;gt;PIO0_11 = 0x100;
LPC_IOCON-&amp;gt;PIO0_12 = 0x98;
LPC_IOCON-&amp;gt;PIO0_13 = 0x98;
LPC_IOCON-&amp;gt;PIO0_14 = 0x98;
LPC_IOCON-&amp;gt;PIO0_15 = 0x98;
LPC_IOCON-&amp;gt;PIO0_16 = 0x98;
LPC_IOCON-&amp;gt;PIO0_17 = 0x98;

/* Peripheral reset control to GPIO and GPIO INT, a "1" brings it out of reset. */
LPC_SYSCON-&amp;gt;PRESETCTRL &amp;amp;= ~(0x1&amp;lt;&amp;lt;10);
LPC_SYSCON-&amp;gt;PRESETCTRL |= (0x1&amp;lt;&amp;lt;10);

/* Set port P0.0 - P0.17 to output, all LEDs off (write a '1') */
for ( i = 0; i &amp;lt; 18; i++)
{
&amp;nbsp; GPIOSetDir( 0, i, 1 );
&amp;nbsp; GPIOSetBitValue( 0, i, 1 );
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:06:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565122#M17026</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC812, PORT0_0</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565123#M17027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MarcVonWindscooting on Wed Mar 26 11:34:10 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;@bavarian:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You're right, we messed up the thread. THE QUESTION is: wether or not&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_0 &amp;amp;= ~(0x03&amp;lt;&amp;lt;3); //clear all pullups on P0_0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;causes loss of control over PIO0_0 or not. And if so, why?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:06:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565123#M17027</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: LPC812, PORT0_0</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565124#M17028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by alagner on Sun Apr 27 13:34:56 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;OK, solved. Typos are difficult to debug (got one in switch matrix bitmask), now everything's working perfect, thanks everyone :)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:06:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC812-PORT0-0/m-p/565124#M17028</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:06:24Z</dc:date>
    </item>
  </channel>
</rss>

