1 micro sec Timer

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

1 micro sec Timer

1,307件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Philipp on Sun Nov 07 23:52:46 MST 2010
Hallo

is it possible to create a Timer which triggers an interrupt every micro sec?
I tried it with Systick and the normal 16-/32 Bit Timers, toggles every 5 micro sec.I tried it with a loop too but i only get an interrupt which triggers every 2 micro sec. I've got the LPC 1114.
In the Example there ist (SystemCoreClock/1000)-1 = 1ms, than (SystemCoreClock/1000000)-1 = 1 micro sec. For my Controller (48 000 000/ 1000 000)-1= 47(10) =2F(16).
Thanks for help.
0 件の賞賛
返信
7 返答(返信)

1,244件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Mon Apr 11 09:04:19 MST 2011
Hello Philipp,

Other possibility is via the CLKOUT pin (p0.1).

See User Manual UM10398 fig 3. [FONT=Arial][COLOR=#005042][FONT=Arial][COLOR=#005042][FONT=Arial][COLOR=#005042][FONT=Times New Roman][I]LPC111x/LPC11Cxx CGU block diagram[/I][/FONT]
[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT]
0 件の賞賛
返信

1,244件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rompacz on Fri Apr 08 00:36:00 MST 2011
Thanks Zero, works fine.
0 件の賞賛
返信

1,244件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Apr 07 02:32:02 MST 2011

Quote: rompacz
[SIZE=2][FONT=Courier New]So any suggestions how to achieve 50MHz intervals?[/FONT][/SIZE]


Use CLKOUT and CLKOUTDIV to divide clock by 2.
//set  clockout 50MHz
LPC_PINCON->PINSEL3 |= (1<<22);        //select clockout = PIN 1.27
LPC_SC->CLKOUTCFG =  0  | (1<<4) | (1<<8);//CPU clock/2 out enable
0 件の賞賛
返信

1,244件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Thu Apr 07 02:15:46 MST 2011
hello Philipp,

what's the purpose of this short/fast interrupt?
Where do you need it for?
0 件の賞賛
返信

1,244件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OXO on Thu Apr 07 02:00:14 MST 2011
Use a timer with output compare and NO interrupt?

or do it in hardware..
0 件の賞賛
返信

1,244件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rompacz on Thu Apr 07 00:39:21 MST 2011
Hi,

I have similar problem, but in LPC1768 (Core clock=100MHz).
I need to generate a signal with frequency 50MHz so I tried to use SysTick:

[FONT=Courier New][SIZE=2]if (SysTick_Config(SystemCoreClock / [B]50000000[/B]))
{
while (1);  // Capture error
}

And I achieved only 1MHz.
Dividing SystemCoreClock by larger number doesn't affect generated frequency.


My systick interrupt code:
void SysTick_Handler(void)
{
  int pinstate;
                            
  pinstate = LPC_GPIO1->FIOPIN;
  LPC_GPIO1->FIOCLR |= pinstate & (1 << 30);
  LPC_GPIO1->FIOSET |= ((~pinstate) & (1 << 30));
}
 
So any suggestions how to achieve 50MHz intervals?

[/SIZE][/FONT]
0 件の賞賛
返信

1,244件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Mon Nov 08 01:54:28 MST 2010
Of course it is possible to trigger an interrupt every 1 us. The real problem is to service the interrupt in less than one us. It's either impossible or almost impossible at 48 MHz considering Flash memory wait states at 48 MHz and microcode overhead for context switching. I guess the interrupt sevice would need to fit in about 10 machine instructions - not an easy task and not always possible.

BTW. The Systick runs at half the core frequency.
0 件の賞賛
返信