Content originally posted in LPCWare by JohnR on Sun Mar 21 11:34:58 MST 2010
I am using an mbed in the LPCExpresso IDE and am trying to set the clock to 100Mhz. I am not using CMSIS.
In the file system_LPC17xx.c I have modifed the following values
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]#define[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] PLL0CFG_Val 0x00020031 [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//0x00050063[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]#define[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] CCLKCFG_Val 0x00000003 [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//0x00000003[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f][/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]which should give me an M=50, N=2 and Div = 4 to give 100Mhz.[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]In main.c I have the following simple code to turn on/off an LED[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][/COLOR][/SIZE] [/LEFT]
[SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]while[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](1) {
LPC_GPIO2->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]FIOSET[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = TEST_1;
LPC_GPIO2->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]FIOCLR[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = TEST_1;[/LEFT]
}
The time to execute the two FIOSET/FIOCLR lines is ~40ns and the time for the complete while loop is 110 nsecs.
This is about 4 times slower than the same loop run in code from the mbed compiler (10 and 40 nsec respectively). The mbed figures were what I expected and I don't understand what is happening using the LPCExpresso compiler.
In a related problem, if CCLKCFG_Val is set to 2, an error message is emitted during compiling system_LPC17xx.c,
"[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#error[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] "CCLKCFG: CCLKSEL field does not contain only odd values or 0!".[/SIZE]
[SIZE=2][/SIZE]
[SIZE=2] I don't see why this should be an error, there is no mention of this in user.manual.lpc17xx.pdf, nor does it give an error message with the mbed compiler.[/SIZE]
Any help would be most appreciated,
John Robbins.
[SIZE=2][/SIZE]
[SIZE=2]
[/SIZE][/SIZE][LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] [/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE]