<?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: [SOLVED] LPC11U67 System PLL won't lock. in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC11U67-System-PLL-won-t-lock/m-p/539484#M11867</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by acker10 on Sat Apr 19 13:28:13 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally able to figure this out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was missing a few things, but the thing that held me up the longest was missing the ADMODE bit in the IOCON registers for PIO2_0 and PIO2_1 (table 88 in the user manual).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The LPC11U67 defaults to "disabled analog mode."&amp;nbsp; The crystal didn't start working until I set this bit to "enable analog mode."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's interesting is if you use SVDConv from ARM CMSIS package on the version 0.6 lpc11u6x SVD file downloadable on this site, the PIO2_0_b and PIO2_1_b ICON structures have fields for everything but ADMODE, so you have to use LPC_IOCON-&amp;gt;PIO2_0 and LPC_IOCON_PIO2_1 instead to set the whole bitfield at once.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way, I also think there's an error in the user manual.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Section 4.2.3 states:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;1. In the IOCON block, disable the pull-up and pull-down resistors in the IOCON&lt;BR /&gt;registers for pins PIO2_0 and PIO2_1 and set the MODE bits to 0x1.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Setting MODE to 0x1 is wrong.&amp;nbsp; MODE should be 0 to disable the pull-up and pull-down.&amp;nbsp; Instead it should be "set the FUNC bits to 0x1."&amp;nbsp; This held me up for awhile too until I figured out this mistake in the documentation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Minimal routines that got me going:&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;
void setupSystemOscillator()
{
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL_b.IOCON = 1;
&amp;nbsp; LPC_IOCON-&amp;gt;PIO2_0 = 1;
&amp;nbsp; LPC_IOCON-&amp;gt;PIO2_1 = 1;
&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG_b.SYSOSC_PD = 0;
&amp;nbsp; int i;
&amp;nbsp; for(i = 0x1000; i &amp;gt; 0; i--) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; asm("movs r0, r0"); // noop delay
&amp;nbsp; }
}

void setupClock()
{
&amp;nbsp; setupSystemOscillator();

&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKSEL = 1;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKUEN = 0;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKUEN = 1;

&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG_b.SYSPLL_PD = 1;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCTRL_b.MSEL = 0;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCTRL_b.PSEL = 3;
&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG_b.SYSPLL_PD = 0;
&amp;nbsp; while((LPC_SYSCON-&amp;gt;SYSPLLSTAT &amp;amp; 0x01) != 1);
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:40:35 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:40:35Z</dc:date>
    <item>
      <title>[SOLVED] LPC11U67 System PLL won't lock.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC11U67-System-PLL-won-t-lock/m-p/539483#M11866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by acker10 on Thu Apr 17 23:19:50 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to follow the directions in the LPC11U6x user manual for basic clock configuration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Debugger shows that my loop to check the System PLL status (SYSPLLSTAT) register for a PLL lock is never exiting.&amp;nbsp; (Section 4.4.4 in the user manual.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What are the debugging steps for this kind of problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used this same crystal on a LPC11U37 with same circuitry without problems.&amp;nbsp; Bad solder joint on XTALOUT/XTALIN pins (LQFP48)?&amp;nbsp; Not the right capacitor values?&amp;nbsp; Perhaps the LPC11U67is more picky about crystal accuracy than the LPC11U37 was?&amp;nbsp; (No, I don't have an oscilloscope unfortunately.)&amp;nbsp; My code is bad?&amp;nbsp; (Bad MSEL/PSEL selection?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The crystal is 12mhz with two 18pF capacitors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code:&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;
void setupClock()
{
&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG_b.SYSPLL_PD = 0; // 0=powered, 1=off
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKSEL = 1; // 0=irc, 1=systemosc, 3=32khzclk

&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKUEN = 1;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKUEN = 0;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKUEN = 1;
&amp;nbsp; while(!(LPC_SYSCON-&amp;gt;SYSPLLCLKUEN &amp;amp; 0x01)); // this works

&amp;nbsp; // must admit not sure this is right
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCTRL_b.MSEL = 3;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCTRL_b.PSEL = 1;

&amp;nbsp; while(!(LPC_SYSCON-&amp;gt;SYSPLLSTAT &amp;amp; 0x01)); // **this is where it never exits**
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:40:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC11U67-System-PLL-won-t-lock/m-p/539483#M11866</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC11U67 System PLL won't lock.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC11U67-System-PLL-won-t-lock/m-p/539484#M11867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by acker10 on Sat Apr 19 13:28:13 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally able to figure this out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was missing a few things, but the thing that held me up the longest was missing the ADMODE bit in the IOCON registers for PIO2_0 and PIO2_1 (table 88 in the user manual).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The LPC11U67 defaults to "disabled analog mode."&amp;nbsp; The crystal didn't start working until I set this bit to "enable analog mode."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's interesting is if you use SVDConv from ARM CMSIS package on the version 0.6 lpc11u6x SVD file downloadable on this site, the PIO2_0_b and PIO2_1_b ICON structures have fields for everything but ADMODE, so you have to use LPC_IOCON-&amp;gt;PIO2_0 and LPC_IOCON_PIO2_1 instead to set the whole bitfield at once.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way, I also think there's an error in the user manual.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Section 4.2.3 states:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;1. In the IOCON block, disable the pull-up and pull-down resistors in the IOCON&lt;BR /&gt;registers for pins PIO2_0 and PIO2_1 and set the MODE bits to 0x1.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Setting MODE to 0x1 is wrong.&amp;nbsp; MODE should be 0 to disable the pull-up and pull-down.&amp;nbsp; Instead it should be "set the FUNC bits to 0x1."&amp;nbsp; This held me up for awhile too until I figured out this mistake in the documentation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Minimal routines that got me going:&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;
void setupSystemOscillator()
{
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL_b.IOCON = 1;
&amp;nbsp; LPC_IOCON-&amp;gt;PIO2_0 = 1;
&amp;nbsp; LPC_IOCON-&amp;gt;PIO2_1 = 1;
&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG_b.SYSOSC_PD = 0;
&amp;nbsp; int i;
&amp;nbsp; for(i = 0x1000; i &amp;gt; 0; i--) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; asm("movs r0, r0"); // noop delay
&amp;nbsp; }
}

void setupClock()
{
&amp;nbsp; setupSystemOscillator();

&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKSEL = 1;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKUEN = 0;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCLKUEN = 1;

&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG_b.SYSPLL_PD = 1;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCTRL_b.MSEL = 0;
&amp;nbsp; LPC_SYSCON-&amp;gt;SYSPLLCTRL_b.PSEL = 3;
&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG_b.SYSPLL_PD = 0;
&amp;nbsp; while((LPC_SYSCON-&amp;gt;SYSPLLSTAT &amp;amp; 0x01) != 1);
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:40:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC11U67-System-PLL-won-t-lock/m-p/539484#M11867</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC11U67 System PLL won't lock.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC11U67-System-PLL-won-t-lock/m-p/539485#M11868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Belias on Mon Jun 30 07:52:18 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Had the same problem, luckily I found this post after SIX HOURS ... ... ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now it works, but of course I was suspecting my hardware. Please NXP update all these errors in the Datasheet!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:40:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC11U67-System-PLL-won-t-lock/m-p/539485#M11868</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:40:35Z</dc:date>
    </item>
  </channel>
</rss>

