This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Problem with spurious interrupt on ARM
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- To: Morten Laursen <MLA at rtx dot dk>
- Cc: "'ecos-discuss at sources dot redhat dot com'" <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 30 Aug 2002 12:33:47 +0200
- Subject: Re: [ECOS] Problem with spurious interrupt on ARM
- References: <AB439ADBB821D41181CC00D0B7458AEB0155518C@SRV-EXCHANGE>
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