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  [ 2 posts ] 
Author Message
 Post subject: CAN receive and erros
PostPosted: Fri Jun 15, 2012 8:55 am 
Offline

Joined: Sun Nov 18, 2007 9:48 am
Posts: 2
If CAN errors happen when the CAN module receives a message the receiver message object interrupt happens?
My interrupt must be like
__arm void CANISRHandler (void)
{
volatile unsigned int status = AT91F_CAN_GetStatus(AT91C_BASE_CAN);
if (status & AT91C_CAN_WAKEUP)
{
... //do something when CAN_WAKEUP happens
}else
if (status & (AT91C_CAN_CERR | AT91C_CAN_SERR | AT91C_CAN_AERR | AT91C_CAN_FERR | AT91C_CAN_BERR))
{
... //do something when CAN_ERROR happens
}else
{
... //do something when CAN_ERROR is absent
}
}
OR like (as all examples)
__arm void CANISRHandler (void)
{
volatile unsigned int status = AT91F_CAN_GetStatus(AT91C_BASE_CAN);
if (status & AT91C_CAN_WAKEUP)
{
... //do something when CAN_WAKEUP happens
}else
if (status & (0x0000FFFF))
{
... //do something when CAN_ERROR is absent
}
if (status & (AT91C_CAN_CERR | AT91C_CAN_SERR | AT91C_CAN_AERR | AT91C_CAN_FERR | AT91C_CAN_BERR))
{
... //do something when CAN_ERROR happens
}
}


Top
 Profile  
 
 Post subject: Re: CAN receive and erros
PostPosted: Tue Oct 30, 2012 3:04 am 
Offline

Joined: Tue May 17, 2011 8:33 pm
Posts: 15
There is only one CAN interrupt attached to the AIC. You can tell what triggered the interrupt by inspecting the status register. Remember that some bits in the status are cleared upon reading.


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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:  
cron