Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Spurious CAN interrupt, not losing the original interrupt??
PostPosted: Wed Feb 16, 2011 11:08 am 
Offline

Joined: Mon Nov 22, 2010 2:09 pm
Posts: 3
Hi all,

I'm facing with spureos interrupt in some occasions, I modified the default spurious interrupt handler in my application with the following code:

void defaultSpuriousHandler( void )
{

spurious = AT91C_BASE_AIC->AIC_SPU;
*AT91C_AIC_EOICR = *AT91C_AIC_EOICR;

return;

}

Inmediately after the code is finished, I check if a spureos interrupt has happened, if so, I enable the CAN interrupt so the original interruption is handled properly, as I can't simply discard that interruption. But I'm not dure if I'm losing it, or whether I should make any other action.

The following code shows you how I manage when I try to disable the interrupt, and how to detect if a spurious interrupt happended:

//Wait for pending register to be clear, so we decrease the number of spurious
do {
}while (AT91C_BASE_AIC->AIC_IPR != 0);

//Once we know that there is no interrupt pending, we try to disable the CAN interrrupt
//And start the critical section
//only disable the CAN interrupt because I know that there is no other interrupt happening
AT91C_BASE_AIC->AIC_IDCR = 1 << AT91C_ID_CAN;

//This is a little weird, but I checked that this value tells me that the spurious exception happened
if (spurious != 0 )
{
//If a spurious interrupt happened I enable the interrupt so the original interrupt
//will be handled by the CAN handler so I'm not losing CAN messages

AT91C_BASE_AIC->AIC_IECR = 1 << AT91C_ID_CAN;
spurious = 0;
return -1; // We finished the method and try later to run the critical section
}
Thank you very much for your help.

Javier Barbarán.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: