need to run my lpc1768 at 100mhz

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

need to run my lpc1768 at 100mhz

731 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elimathew on Wed Mar 12 20:42:17 MST 2014
hey guys  i am beginner with lpc1768  and trying to run it at 100mhz with a 12mhz onboard crystal this is the code i have written is it right?am i missing something?
#include "LPC17xx.h"



volatile uint32_t temp;

void _delay(uint32_t del);


void pllfeed()
{

LPC_SC->PLL0FEED=0x000000AA;
LPC_SC->PLL0FEED=0x00000055;
   
} 
 









void setpll()
{
uint16_t n,m,d;
// the external 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();
//select the on board crystal
LPC_SC->CLKSRCSEL =1;
// 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();
SystemCoreClockUpdate(); 
}











int main (void) 
{
SystemInit();
setpll();
LPC_SC->PCONP |= ( 1 << 15 ); // power up GPIO
LPC_GPIO1->FIODIR |= 1 << 29; // puts P1.29 into output mode.
while(1)
{
LPC_GPIO1->FIOPIN |= 1 << 29; // make P1.29 high
_delay( 1 << 30 );
LPC_GPIO1->FIOPIN &= ~( 1 << 29 ); // make P1.29 low
_delay( 1 << 30 );
}


}
void _delay(uint32_t del)
{
uint32_t i;
for(i=0;i<del;i++)
temp = i;
}



Labels (1)
0 Kudos
2 Replies

605 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Thu Mar 13 13:04:09 MST 2014
configure the system tick timer ISR to toggle a pin.
it should be 10ms
0 Kudos

605 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elimathew on Wed Mar 12 20:42:41 MST 2014
the led on board is blinking but is there anyway to confirm that lpc1768 is running on 100mhz?
0 Kudos