This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Problem with spurious interrupt on ARM


Firstly, let's discuss exactly what the hardware means by a "spurious 
interrupt".  Normally, this is defined as a condition where some
interrupt was asserted, but by the time the software got around to
asking "which interrupt is it?", the interrupt signal had vanished
and the only answer could be "unknown" ("spurious").

IMHO, hardware which works this way is broken.  If you have edge driven
interrupts, then there must be some way to "latch" the fact that the
edge was asserted.  The interrupt condition is then just the asserting
edge (you can measure how long until the signal is de-asserted, but
the only important thing is the edge).  If you don't have such a latch,
then there is no way to determine which edge (most systems have many)
caused the interrupt.  This would then be considered a spurious 
interrupt.  I would also assert that an interrupt system which does
not have such a latching mechanism can *not* be used with edge 
interrupts.

Ignoring such interrupts is undesirable, because normally an interrupt
condition is asserted for a reason.  Hardware seldom says "never mind!"
If you ignore the interrupt (because you can't figure out which device
asserted it), then that device will be expecting service that goes
wanting.  Most hardware will get unhappy and just not generate any more
interrupts when this happens.

I think you need to be thinking hard about what this situation is 
telling you about your hardware and how to fix it.

On Fri, 2002-08-30 at 04:53, Morten Laursen wrote:
> If it's supposed to work like this, then I don't understand the purpose of
> HAL option "Ignore spurious (fleeting) interrupts".
> 
> Anyway, it's a viable solution. Thanks.
> 
> Venlig Hilsen / Regards 
> Morten
> 
> -- 
> Morten Laursen, M.Sc.S.E.
> RTX Telecom A/S - http://www.rtx.dk/
> Direct phone: (+45) 96 32 24 03
> 
> 
> > -----Original Message-----
> > From: Andrew Lunn [mailto:andrew.lunn@ascom.ch]
> > Sent: 30. august 2002 12:34
> > To: Morten Laursen
> > Cc: 'ecos-discuss@sources.redhat.com'
> > Subject: Re: [ECOS] Problem with spurious interrupt on ARM
> > 
> > 
> > On Fri, Aug 30, 2002 at 12:11:54PM +0200, Morten Laursen wrote:
> > > According to the MCU (AT91M40800) data sheet a spurious 
> > interrupt can happen
> > > when using edge trigged interupts. I use edge trigged 
> > interrupts, because I
> > > want to know how long time the button was pressed.
> > > 
> > > So (as I understand it) the problem is not, that there is a spurious
> > > interrupt, but that it is somehow handled incorrectly?
> > 
> > I think its actually a design philosophy thing. Hardware should not
> > produce spurious interrupts. If it does, its broken. So eCos general
> > does not have to deal with spurious interrupts. If your broken
> > hardware does generate such things, you have to work around your
> > broken hardware. In this case, you need to modify either your
> > application or the HAL for the AT91M40800 to deal with this.
> > 
> > int hal_IRQ_handler(void)
> > {
> >     cyg_uint32 irq_num;
> >     cyg_uint32 ipr, imr;
> > 
> >     HAL_READ_UINT32(AT91_AIC+AT91_AIC_IPR, ipr);
> >     HAL_READ_UINT32(AT91_AIC+AT91_AIC_IMR, imr);
> >     ipr &= imr;
> >     for (irq_num = 0;  irq_num < 19;  irq_num++) {
> >         if (ipr & (1 << irq_num)) {
> >             break;
> >         }
> >     }
> > 
> >     return irq_num;
> > }
> > 
> > So this will drop out with 19 in the case of a spurious interrupt.
> > 
> > So put a handler on interrupt 19 which clears the interrupt.
> > 
> >    Andrew
> > 
> > 
> 
> -- 
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss

-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]