Timer interrupt frequency Limit ?

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

Timer interrupt frequency Limit ?

4,051件の閲覧回数
leeyoungjae
Contributor II

HI

I am using Timer1 to generate an interrupt at every 0.125 us ( 8MHz timer counter )

I modify timer setup code of Periph_blinky in LPCOpen.

Problem : I couldn’t generate an INT at Every 0.125us even through modify timer match value

MCU : LPC4370

Test Board: LPC-Link2 (included LPC4370)

 

Please check the following code that is set up timer INT for 0.125us (micro second)

 

static void timer_setup(void)

{

       /* Enable timer 1 clock and reset it */

       Chip_TIMER_Init(LPC_TIMER1);

       Chip_RGU_TriggerReset(RGU_TIMER1_RST);

       while (Chip_RGU_InReset(RGU_TIMER1_RST)) {}

 

       /* Timer setup for match and interrupt at SAMPLERATE */

 

       Chip_TIMER_Reset(LPC_TIMER1);

       Chip_TIMER_MatchEnableInt(LPC_TIMER1, 1);

 

 

//     Chip_TIMER_SetMatch(LPC_TIMER1, 1, (Chip_Clock_GetRate(CLK_MX_TIMER1) / SAMPLERATE));

// Chip_Clock_GetRate(CLK_MX_TIMER1): 204000000

// SAMPLERATE : 5

 

// Modified code for 0.125us (8MHZ) timer INT

Chip_TIMER_SetMatch(LPC_TIMER1, 1, (Chip_Clock_GetRate(CLK_MX_TIMER1) / 25000000 ));

 

       Chip_TIMER_ResetOnMatchEnable(LPC_TIMER1, 1);

       Chip_TIMER_Enable(LPC_TIMER1);

 

       /* Enable timer interrupt */

       NVIC_EnableIRQ(TIMER1_IRQn);

       NVIC_ClearPendingIRQ(TIMER1_IRQn);

}

 

result frequency: 1.6MHz (maximum).

 

Question

1. Is there any limit for timer Interrupt frequency ?

- I want to generate 8Mhz timer Interrupt

2. How can I generate timer Interrupt at every 0.125us ( 8MHz ) ?

Thanks for you review.

ラベル(5)
0 件の賞賛
返信
5 返答(返信)

3,359件の閲覧回数
jamn
Contributor I

Had you solved this Problem? I face the same question. Thanks!

0 件の賞賛
返信

3,593件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi LEE Young Jae,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
1. Is there any limit for timer Interrupt frequency ?
    Yes, it's up to the CLK_M4_TIMER0, as illustrated in the Table 780 in the reference manual.
2. How can I generate timer Interrupt at every 0.125us ( 8MHz ) ?
    You need to increase the system clock frequency as quick as possible, the 204 MHz is maximum, then simplify the interrupt function as 00125us doesn't allow any extra operation.
Hope it helps.
Have a great day,

TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

3,356件の閲覧回数
jamn
Contributor I

 My clock is 204MHz, but I get only 2MHz. Could you tell me anything to do? Thanks!

0 件の賞賛
返信

3,351件の閲覧回数
frank_m
Senior Contributor III

Having an interrupt at a 8MHz rate is a very bad idea. Each interrupt invokes the saving and restoring of the context, which is 12 cycles each without FPU registers.

This eats away core performance. And even with a moderate handler routine, you will quickly reach the saturation point.

 

0 件の賞賛
返信

3,336件の閲覧回数
jamn
Contributor I

Thanks! That is right, I got it.

0 件の賞賛
返信