Oh, yeah, I thought he might have reffered to the CCO…
So are you saying that in practice the CCO can only take values of 275-290Mhz even though the manual says 156-32Mhz?
I have the C version of the chip by the way - I dont know if you considered that old or not…
I have also gone through the PLL code and can find no errors - I’ll paste it here just in case someone spots something obvious that I missed:
====================ProcInit.cpp====================
#include “ProcInit.h”
#include “board.h”
// Commit the Changes made to the PLL.
void PllCommit(void);
void ProcInit(void)
{
// Disable memory acceleration:
MAMCR = 0x0;
// Set PLL Settings configured in board.h:
PLLCFG_bit.MSEL = PLL_M - 1; // MSEL should be M-1
PLLCFG_bit.PSEL = PLL_PSEL; // PSEL should be log2(P)
// Commit the changes (Required by the LPC after any changes to the PLL settings)
PllCommit();
// Enable the PLL and connect it as the clock source:
PLLCON_bit.PLLE = 1; // Enable the PLL
// Commit the changes (Required by the LPC after any changes to the PLL settings)
PllCommit();
while (!PLLSTAT_bit.PLOCK); // Wait for PLOK (PLL lock to the requested frequency)
PLLCON_bit.PLLC = 1; // Connect the PLL
// Commit the changes (Required by the LPC after any changes to the PLL settings)
PllCommit();
// TODO: Initialize timer! (for using ticks and interrupts and not big whiles)
};
void PllCommit(void)
{
// This is needed to commit settings to the PLL after changing something:
PLLFEED_bit.FEED = 0xAA;
PLLFEED_bit.FEED = 0x55;
};
================================================
=======================board.h====================
#include “lpc2138.h”
…
…
// PLL Settings:
// The Fosc * PLL multiplier make up the CPU clock:
#define FOSC 14745600 // Onboard Oscillator.
// We want operate at ~60Mhz which means we multiply by 4.
#define PLL_M 4 // Pll Multiplier. MSEL should be PLL_M - 1.
// We need the Fcco to be between 156Mhz and 320Mhz. Fcco = Fosc2PLL_M*PLL_P.
// PLL_P = 2 fits the requirement, which means we set PSEL to 1
#define PLL_PSEL 1
…
…
================================================