Content originally posted in LPCWare by R2D2 on Sun Jul 07 01:23:04 MST 2013
What's not clear there?
Quote:
4.5.1 PLL0 operation
The PLL input, in the range of 32 kHZ to 50 MHz, may initially be divided down by a value
"N", which may be in the range of 1 to 256. This input division provides a greater number
of possibilities in providing a wide range of output frequencies from the same input
frequency.
Following the PLL input divider is the PLL multiplier. This can multiply the input divider
output through the use of a Current Controlled Oscillator (CCO) by a value "M", in the
range of 6 through 512, plus additional values listed in Table 21. The resulting frequency
must be in the range of 275 MHz to 550 MHz. The multiplier works by dividing the CCO
output by the value of M, then using a phase-frequency detector to compare the divided
CCO output to the multiplier input. The error value is used to adjust the CCO frequency.
Quote:
The PLL0 output frequency (when PLL0 is both active and connected) is given by:
FCCO = (2 × M × FIN) / N
PLL inputs and settings must meet the following:
• FIN is in the range of 32 kHz to 50 MHz.
• FCCO is in the range of 275 MHz to 550 MHz.
The equation can be solved for other PLL parameters:
M = (FCCO × N) / (2 × FIN)
N = (2 × M × FIN) / FCCO
FIN = (FCCO × N) / (2 × M)
If you start with 20MHz and want to get 100MHz there are just 2 calculations needed:
[B][COLOR=Red]1. Define a CPU Clock Configuration register (CCLKCFG)[/COLOR] [/B]value, that's usually 3.
So PLL0 output is divided by 4 (3+1) to create the CPU clock (CCLK).
Now you know: PLL0 should be 400MHz.
[COLOR=Red][B]2. Select M and M[/B][/COLOR] with:
FCCO = (2 × M × FIN) / N => 400MHz = 40MHz * M / N => 10 = M/N
So with M = 100 (0x64) and N = 10 (0x0A) you get Mvalue = 0x63 and Nvalue = 9
And a working value (surprise :)) is PLL0CFG_VAL = 0x00090063.
Perhaps it's irritating, but PLL0 is setting PLL0, not CPU clock.