LPC1227 recover from bad PLL value

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1227 recover from bad PLL value

318 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Kartman on Wed Apr 06 05:22:17 MST 2011
I was a little unhappy about my LPC1227 running at only 24MHz so I set about changing the PLL value to give me 48MHz, so in the file system_LPC12xx.c I changed this line:

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#define[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] SYSPLLCTRL_Val 0x00000043 //was 0x41[/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]unfortunately, I can no longer use the LPC-Link to talk to the device. It has trouble writing to the flash. How can I recover from this?
[/SIZE]
0 Kudos
4 Replies

307 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Kartman on Thu Apr 07 06:51:53 MST 2011
Yes, i did realise I was going into dangerous territory, but I thought I'd give it a try. I was less gung-ho this evening and tried 36MHz. If the sysinit code fixes up the wait states then I'm probably losing more than I'm trying to gain by the higher clock rate.nevertheless, a little learnt along the way.

Thanx
0 Kudos

307 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Wed Apr 06 10:37:41 MST 2011
Hello Kartman,

Please be aware that the LPC122x devices are [B]NOT[/B]specified to operate at [B]48MHz[/B], and what you are attempting is technically operating the part beyond it's guaranteed operating conditions.

From the datasheet:
"...running at frequencies of up to [B]45 MHz[/B] (one wait state from flash) or [B]30 MHz[/B] (zero wait states from flash)."

Also please pay attention to the fact that operating at frequencies above 30MHz requires that you enable two cycle read timing. The start up code does this with the following block (however if you are changing frequencies at run time outside of SystemInit(), you may need to perform this task manually):

#if (__SYSTEM_CLOCK > 30000000)
  /*
  Enable 2 cycle reads for high frequency operation
  Must be done prior to setting up PLL   
  */
  LPC_FLASHCTRL->FLASHCFG = 0;
  LPC_SYSCON->PRESETCTRL &= ~(1<<15);
#endif 

I realize that 30 and 45MHz are not a native multiples of the 12MHz clock sources (IRC, Crystal on LPCXpresso boards), however you can use the System AHB clock divider (LPC_SYSCON->SYSAHBCLKDIV) to post divide a higher PLL frequency down to be within spec.

The subtlety in operating at these frequencies is the reason the LPCXpresso examples use 24MHz, as they are the highest native multiple of the XTAL and IRC which will operate with single cycle read timing.

If you have further questions please don't hesitate to ask.
0 Kudos

307 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Kartman on Wed Apr 06 06:06:09 MST 2011
Thanx for the fix, Zero. Worked like a charm.
0 Kudos

307 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Apr 06 05:39:27 MST 2011
Switch to ISP mode:

See:

NXP LPCxxxx ISP

http://support.code-red-tech.com/CodeRedWiki/DebugAccessChip

Note: Try SYSPLLCTRL_Val 0x00000023
0 Kudos