Hi Everyone..
I am a Newbie and just starting to write some programm for my lpc2378. At the moment i am trying to make the PLL Setup Sequence for my LPC2378. unfortunately i can't understand this step from User Manual
.. 4) Write to the clock source selection control register to change the clock souce.
I'd have the Main Oscillator as my Clock Source.
CLKSRCSEL = 0x1; /* select main OSC as the PLL clock source */ PLLFEED = 0xaa; PLLFEED = 0x55;
In User Manual can be read that The main oscillator operates at frequencies of 1 MHz to 24 MHz.
My Question: How can i operate the main oscillator with a constant freq? For example 12 MHz ? I need this constant frequenz, so i can configure my PLL
Anyone can help me??
Thank You
Nobody is likely to be willing to help you unless you post your code using the format tags. Have you considered peeking in a startup file to see what it does? Why re-invent the wheel?
I'm so sorry..
Hier once again:
void initclock(void) { /* Disconnect the PLL */ if ( PLLSTAT & 0x02000000 ) { PLLCON = 0x1; feed (); } /* Disable PLL */ PLLCON = 0x0; feed (); /* Selects the main oscillator as the PLL clock source*/ CLKSRCSEL = 0x1; // Init Main Oscillator SCS &= ~(1<<4); // OSCRANGE = 0. The frequency range of the main oscillator is 1 MHz to 20 MHz SCS |= (1<<5); // OSCEN = 1. The main oscillator is enabled, and will start up if the correct // external circuitry is connected to the XTAL1 and XTAL2 pins while (!(SCS & (1<<6))) // Wait until Main Oscillator is ready! /* select main OSC 12 MHz, Pllclk = 288 MHz */ PLLCFG = 0x0000000B; // N=1, M=12 feed (); /* Enable PLL, disconnected */ PLLCON = 0x1; feed (); /* Fcco = 288M, Fcclk = 288/(3+1) = 72M */ CCLKCFG = 0x03; feed(); while (!(PLLSTAT & (1<<26))); /* Wait for the PLL to lock to set frequency*/ /* Connect the PLL as the clock source */ PLLCON = 0x03; feed (); /* Enabling MAM and setting number of clocks used for Flash memory fetch*/ MAMCR = 0x0; //MAM function disabled MAMTIM = 0x3; //MAM fetch cycles are 3 CCLKs in duration MAMCR = 0x2; //MAM function fully enabled */ }
void feed(void) { PLLFEED=0xAA; PLLFEED=0x55; }