Clock frequency increase LPC1114

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

Clock frequency increase LPC1114

392 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zlajoan on Mon May 26 09:41:34 MST 2014
Hi,

i am working with LPC1114 microprocessor and IRC Oscillator as clock. That clock works with 12 MHZ. I have simple program that tests the max output frequency. With code below, I get frequency 120kHZ on pin 0.9. Value in TIME_INTERVAL is max possible for processor to output some values on pin 0.9.

Where If difference between 12 MHZ and 120kHZ (100 times) lost?

int main(void) {
      __disable_irq();

      GPIOInit();
      GPIOSetDir(0, 9, 1);

      init_timer32(0, TIME_INTERVAL);

       enable_timer32(0);

       __enable_irq();

       while(1);

       return 0;
}

#define TIME_INTERVAL(SystemCoreClock / 1000000 - 1)
int status = 1;

void TIMER32_0_IRQHandler(void)
{
  if ( LPC_TMR32B0->IR & 0x01 )
  {
LPC_TMR32B0->IR = 1;/* clear interrupt flag */
timer32_0_counter++;
GPIOSetValue(0, 9, status);
status ^= 1;
  }
  if ( LPC_TMR32B0->IR & (0x1<<4) )
  {
LPC_TMR32B0->IR = 0x1<<4;/* clear interrupt flag */
timer32_0_capture++;
  }
  return;
}


Best regards,
Zlatko
0 Kudos
Reply
3 Replies

362 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 26 10:15:17 MST 2014

Quote: zlajoan
So I need to use some faster external clocks to get more frequency?Is there any easier way :) ?



Yes, don't use interrupts , don't use slow pin switching  :)

Clockout:

http://www.lpcware.com/content/forum/changing-the-clock-frecuency-for-the-lpc1227

or PWM  :quest:
0 Kudos
Reply

362 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zlajoan on Mon May 26 10:01:33 MST 2014

Quote: R2D2

Quote: zlajoan
Where If difference between 12 MHZ and 120kHZ (100 times) lost?



Code  :O

Believe it or not, MCU is busy with a lot of funny stuff like jump at ISR and return from ISR...

And then it's busy in ISR also, even if you optimize your code...

Therefore it's useful to use faster options to generate a frequency  :)



So I need to use some faster external clocks to get more frequency?
Is there any easier way :) ?
0 Kudos
Reply

362 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 26 09:56:02 MST 2014

Quote: zlajoan
Where If difference between 12 MHZ and 120kHZ (100 times) lost?



Code  :O

Believe it or not, MCU is busy with a lot of funny stuff like jump at ISR and return from ISR...

And then it's busy in ISR also, even if you optimize your code...

Therefore it's useful to use faster options to generate a frequency  :)


0 Kudos
Reply