Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

[SOLVED]Interval Timer - Interrupt Jitter

Problem is solved. Timer Interval is working pretty well. Problem is my messurement.

I use the interrupt timer as an periodic irq. My problem is, that the number of interrupt differ from run to run(Run takes always 10s. Its also a very huge difference(From 80k to 100k interrupts/10s -> 8k to 10k irqs/s

Where is the bug?

Here my config:

IOWR(TIMER_BASE,1,(1<<3) | (1 << 1) |(1 << 0) );//Stop Timer, IRQ enable, counter continue when getting 0

IOWR(TIMER_BASE,0,0); // Clear TO Bit(Reaching 0)

IOWR(TIMER_BASE,2,(alt_u16)(10000-1)); // Interrupt Time will rise every 100µs

IOWR(TIMER_BASE,3,(alt_u16)( (10000-1) >> 16 ));

alt_irq_register(1, NULL, timer_interrupt); //Register Interrupt

IOWR(TIMER_BASE,1,(1<<2) | (1 << 1) | (1 << 0) );//Start Timer, IRQ enable, Continuous enable

I got a main loop like this

while(10s)

{

}

ISR:

static void timer_interrupt(void* context, alt_u32 id){

IOWR(TIMER_BASE,0,0); //Clear TO(timeout) bit)

interrupts++;

...

}

Prototypes:

...

static void timer_interrupt(void* context, alt_u32 id);

int alt_irq_register (alt_u32 id,void* context,void (*isr)(void*, alt_u32));

...

Interval Timer clock is running at 100Mhz
No RepliesBe the first to reply