**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

Changing clock speed of NXP LPC1xxx MCUs

The clock speed that the MCU runs your code at is set by the initialisation code contained within the CMSISv1p30_LPC17xx / CMSISv1p30_LPC13xx / CMSISv1p30_LPC11xx library project (assuming of course that you are linking your projects with CMSIS).

The default settings used are 48MHz (LPC11), 72MHz (LPC13) and 100MHz (LPC17). These are set up in the system_LPCnnxx.c file (replace nn with part number) within the appropriate CMSIS library project.

If you access the SystemCoreClock variable within your code base, then you can see what clock speed has been set up. [Note that if you don't actually reference SystemCoreClock from your code, the linker will normally remove it from the final image - so you won't then be able to see it within the debugger.]

Modifying the clock speed

If you want to modify the clock speed of, say, an LPC1768, you need to look at the #define's and the SystemInit() code in system_LPC17xx.c together with the LPC17 user manual, and modify as appropriate.

You may also want to make use of the LPC17xx PLL Parameter Calculator that NXP have available from their website at:

http://ics.nxp.com/support/documents/microcontrollers/

Similar spreadsheets for LPC11 and LPC13 are not (at the time of writing) available from the NXP website, however an LPC11 spreadsheet is available from the NXP's LPCXpresso forum at:

http://knowledgebase.nxp.com/showthread.php?t=337

You should note that changing the code within the CMSIS library project will cause all projects in that workspace to use the modified code. If this is problem for you, then you may want to create a copy of the CMSIS project and modify the copy [making sure you update the links from your application project], or to copy the CMSIS files into the application project you want to use the modified clock speed in.

For more information on CMSIS please see the FAQ Support for CMSIS.

Debug problems after modifying clock speed

If you program code into the device flash which incorrectly sets up the clock speed of the MCU, it is possible to put the MCU into such a state that the debug tools can no longer connect to the board - causing "Failed to connect" type of errors when trying to download code.

For details of how to recover from this, please see the FAQ Getting debug access to target chip.

LPC1xxxChangeClock (last edited 2013-06-03 13:19:29 by CrSupportAb)