So a user won't know what is the CPU clock when he powers the controller for the first time
Im using keil mdk arm version 5 when I go to configure flash tools there's a option which asks to fill up the xtal like what is it used for like if I write 100mhz would my sysclk work at 100mhz
[CODE]#include "LPC17XX.h"
int main()
{
SystemCoreClock=100;
SystemInit ();
}
void setpll()
{
// the crystal oscillator is 12 MHz
// main oscillator frequency 300 MHz: M = (300 x N) / (2 x 12)
n=2;
m=25;
// processor clock 100 MHz = 300 MHz / D
d=3;
// disconnect
LPC_SC->PLL0CON=0x00000001; pllfeed();
// disable
LPC_SC->PLL0CON=0x00000000; pllfeed();
// set new PLL values
LPC_SC->PLL0CFG=((n-1)<<16)|(m-1); pllfeed();
// enable
LPC_SC->PLL0CON=0x00000001; pllfeed();
// set cpu clock divider
LPC_SC->CCLKCFG=d-1;
// wait for lock
while (LPC_SC->PLL0STAT&0x04000000==0);
// connect
LPC_SC->PLL0CON=0x00000003; pllfeed();
}
void pllfeed()
{
__disable_irq();
LPC_SC->PLL0FEED=0x000000aa;
LPC_SC->PLL0FEED=0x00000055;
__enable_irq();
}
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT SystemInit
IMPORT __main
LDR R0, =[COLOR="#FF0000"]SystemInit[/COLOR]
BLX R0
LDR R0, =[COLOR="#FF0000"]__main[/COLOR]
BX R0
ENDP
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?