[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Timer interrupts



>Why?

The only plausible explanation is that you get a second timer 
interrupt before the first has been handled.

>I handle the multiple-interrupt interrupt, so that shouldn't be an
>issue.  However, my interrupt handlers are fairly bulky - is there
>a recommendation as to how much time should be spent in an
>interrupt handler?

How do you implement the interrupt handling? Can you get timer
interrupts while handling the serial port interrupt? How do
you prioritize interrupts in multiple interrupt (you should
prioritize the timer IRQ)? Does the multiple IRQ handler
take care of all interrupts or just one of them?

Is it possible that you have a new pending RS422 interrupt
as soone as you handled the first? (i.e. maybe you need a
loop to handle all data as in the Ethernet driver).

Consider the following scenario
1. You get RS422 interrupt
2. You get timer IRQ while handling interrupt above
3. You clear the RS422 interrupt
4. You get a new RS422 interrupt before leaving the IRQ handler
5. You now get a multiple IRQ because timer IRQ and RS422 IRQ is active
6. RS422 interrupt is called beause it is prioritized

Can this happen in your code? 

If you don't allow the timer interrupt to iterrupt the RS422
interrupt you may get problems if you do a while(more data)
loop in the RS422 driver.

Do you have the watchdog enabled? That may help you to detect
if there is any long loop with IRQs disabled in your code.

Good luck
/Mikael

-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com]On">mailto:owner-dev-etrax@xxxxxxx.com]On
Behalf Of ulf.sjostedt@xxxxxxx.se
Sent: Tuesday, January 28, 2003 4:54 PM
To: dev-etrax
Subject: Timer interrupts


Hello all!


I'm running an interrupt-driven application on two OS-less
Device Server Platforms.
They pass data between two LANs on a 422 link.

I've got two events hanging on timer0.
I run the timer at 300 Hz, divider 3, ie. 100 Hz.

Each time, I check the RS422 port for data available, and if
there is any, I force an end-of-packet interrupt on the DMA
channel.
I also subtract 1 from a counter which is initialised to 1000.
When the counter reaches 0, I create and send a monitoring
packet.  This should in other words happen every 10 seconds.

I have observed the following anomaly:
When running at fairly high loads (2.5 Mbps in either direction),
the monitoring packets are sent less frequently.  It's not that
every other packet is lost, the frequency is simply lowered so
that they arrive at intervals of 12, 15 seconds or more.

Why?

The monitoring is only done in one of the units, and the packets
are sent on the 422 line before being passed to the LAN.

I handle the multiple-interrupt interrupt, so that shouldn't be an
issue.  However, my interrupt handlers are fairly bulky - is there
a recommendation as to how much time should be spent in an
interrupt handler?

Thanks again,


/Uffe Sjöstedt
SaabTech Systems AB
ulf.sjostedt@xxxxxxx.se