LPC1317 - RC Oscillator start up delay question

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

LPC1317 - RC Oscillator start up delay question

661 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cararra on Thu Jul 04 06:46:37 MST 2013
The problem is this code:

    int RC_Oscillator_Delay;

    // This part switches to RC oscillator - but it is not reliably working
    LPC_SYSCON->PDRUNCFG &= ~(3<<0);         // page 32 of LPC1317 user manual  - power up the fast 12MHz RC Osc
    LPC_SYSCON->MAINCLKSEL  = 0x0;            // select RC oscillator (from the 4MHz xtal oscillator it is running on) - page 20 of the LPC1317 user manual

    // Normally there is a delay before RC oscillator is operational - at least 300 counts in my system
    for(RC_Oscillator_Delay = 0; RC_Oscillator_Delay<300; RC_Oscillator_Delay++);


Its a hit and miss affair whether RC oscillator switch over has worked.
For example, the above code works on a bench lab supply.
But not on a mains adapter based power supply.
Sometimes it works on 10000 counts.
What I really want is for the RC oscillator to start up reliably and switch to it from xtal operation.
The manuals don't seem to have any information about RC oscillator start up delays.
Any suggestion is helpful.

Thanks.
0 Kudos
Reply
1 Reply

610 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cararra on Thu Jul 04 14:02:30 MST 2013

Quote: cararra
The problem is this code:

    // This part switches to RC oscillator - but it is not reliably working
    LPC_SYSCON->PDRUNCFG &= ~(3<<0);         // page 32 of LPC1317 user manual  - power up the fast 12MHz RC Osc
    LPC_SYSCON->MAINCLKSEL  = 0x0;            // select RC oscillator (from the 4MHz xtal oscillator it is running on) - page 20 of the LPC1317 user manual




It turns out you had to turn off power to the xtal oscillator to assist the CPU into
relying on the RC osc.
    LPC_SYSCON->PDRUNCFG |= (1<<5);         // page 32 of LPC1317 user manual

That is plain silly! :D :mad:
0 Kudos
Reply