Content originally posted in LPCWare by vivien.wong on Sun Jan 31 22:08:43 MST 2016
Hi there,
I'm using the LPC1857 and I'm running at 96MHz with a clk in crystal of 12MHz. At some point of the code I wish to step up to 180MHz for higher performance and when that is done, i want to step back down to 96MHz. What is the best way to do this? Right now, i'm setting it this way:
void SystemSetClockRateOptimalCurrent()
{
/* Setup PLL for maximum clock */
Chip_Clock_SetupMainPLLHz(CLKIN_CRYSTAL, CRYSTAL_MAIN_FREQ_IN, CLOCK_FREQ_LOW, CLOCK_FREQ_LOW);
Chip_Clock_SetBaseClock(CLK_BASE_MX, CLKIN_MAINPLL, true, false);
Chip_CREG_SetFlashAcceleration(CLOCK_FREQ_LOW);
}
void SystemCoreClockUpdate(void)
{
/* CPU core speed */
SystemCoreClock = Chip_Clock_GetRate(CLK_MX_MXCORE);
}
Do i just setup for 180MHz and update the system core clock and then setup for 96MHz and do the same? Is there a better way in doing this?
Thanks
Regards
Vivien