LPC1768: onchip Clock module not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1768: onchip Clock module not working

1,711 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modestt on Mon Dec 03 14:43:05 MST 2012
I have designed a board around LPC1768, problem is I have not been able to get clock to work.
* 12M Xtal is connected and I can see it oscillating.
* The Peak to peak is around 1 volt( which is less then what I see on a LPC1769 XPresso board). I can download or bootload the code, no problems.
*only when I start or enable the external XTAL, system crashes( I can debug and see a which point it does it).
* I have tried soldering XTAL connected right next to processor. The loading caps are correct value.
*problem is I have not been able to use IRC as source for PLL0, that also doesn't work.
*RTC crystal not connected.
*I am using legacy code which I used for LPC1769 Xpresso chip, which should configure PLL0 to work at 72Mhz using XTAL as source. I have also tried using other combinations of M and N divisor.

Any one has any ideas I would appreciate.
Thanks
0 Kudos
Reply
7 Replies

1,532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modestt on Thu Dec 06 07:43:03 MST 2012
yep, just checked it.
CLKOUT is spitting out correct freqeuncy.
problem is configuration of PLL0.
XTAL 12M
PLL0CFG  0x0000000B
with
CLKSEL 0x00000001
CLKCFG  0x0000003

I can however run system if I choose to NOT setup clock at all and run from IRC !

no idea what is going on ?
Thanks a lot..
0 Kudos
Reply

1,532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modestt on Wed Dec 05 16:58:10 MST 2012
I will try adding CLKOUT and see what happens.
weird thing is I am seeing similar behaviour with IRC..:(
Thanks
0 Kudos
Reply

1,532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Dec 05 16:41:23 MST 2012
Did you try to add clockout (crystal) and endless loop after enabling oscillator?

If it's running your scope should show it ;)
0 Kudos
Reply

1,532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modestt on Wed Dec 05 16:19:19 MST 2012
sorry about that, I  missed crucial details :( too tired I guess :(

while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready    */

  }
**That is where code crashes while stepping, I seem to go past while loop after condition is false....with expected values in SCS. I can see crystal start oscillating  after crystal get enabled.
SCS_Val                  0x00000020

CCLKCFG  is 0x03, I have tried commenting it out but debugger still crashes  after while loop.
Thanks
0 Kudos
Reply

1,532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Dec 05 16:00:41 MST 2012
So where is your code crashing :confused:

After Crystal is locked or after your write CCLKCFG :confused:

What are you writing to CCLKCFG :confused:
0 Kudos
Reply

1,532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by modestt on Wed Dec 05 15:47:27 MST 2012
Thanks for response..
the code is below, taken from CMSIS V2 library, it works perfect on Xpresso board.

#if (CLOCK_SETUP)                       /* Clock Setup                        */

  LPC_SC->SCS       = SCS_Val;

  if (SCS_Val & (1 << 5)) {             /* If Main Oscillator is enabled      */

    while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready    */

  }
//////That is where code crashes....

  LPC_SC->CCLKCFG   = CCLKCFG_Val;      /* Setup Clock Divider                */

  LPC_SC->PCLKSEL0  = PCLKSEL0_Val;     /* Peripheral Clock Selection         */

  LPC_SC->PCLKSEL1  = PCLKSEL1_Val;

  LPC_SC->CLKSRCSEL = CLKSRCSEL_Val;    /* Select Clock Source for PLL0       */

#if (PLL0_SETUP)

  LPC_SC->PLL0CFG   = PLL0CFG_Val;      /* configure PLL0

Immediately after initializing OSC, system crashes and debugger looses connection.   Strange thing is I have tried disabling OSC and run off internal clock which also doesn't work, never reach PLL0 setup via debugger. I am able to download code on low baud rates s system exhibits 'cannot Autobuad' at higher rates.
chip current consumption with OSC running is only 18mA( which seems lower even with faulty conditions). I am beginning to think it could be a bad chip! Lets be clear that I can see 1Vpp clock as soon as I enable OSC and SCS register is showing correct value 0x60 before crashing.
0 Kudos
Reply

1,532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pboogaards on Wed Dec 05 12:06:20 MST 2012
It would be useful to see the code you are using to initialize your clocks and PLL.  Also make a note of where it crashes.
0 Kudos
Reply