Atmel Evaluation Kit AT91SAM9X25-EK AT91SAM9X25-EK Data Sheet

Product codes
AT91SAM9X25-EK
Page of 1151
912
SAM9X25 [DATASHEET]
11054E–ATARM–10-Mar-2014
41.8.2 CAN Controller Interrupt Handling
There are two different types of interrupts. One type of interrupt is a message-object related interrupt, the other is a 
system interrupt that handles errors or system-related interrupt sources.
All interrupt sources can be masked by writing the corresponding field in the CAN_IDR register. They can be unmasked 
by writing to the CAN_IER register. After a power-up reset, all interrupt sources are disabled (masked). The current mask 
status can be checked by reading the CAN_IMR register.
The CAN_SR register gives all interrupt source states. 
The following events may initiate one of the two interrupts:
Message object interrupt
Data registers in the mailbox object are available to the application. In Receive Mode, a new message was 
received. In Transmit Mode, a message was transmitted successfully. 
A sent transmission was aborted.
System interrupts
Bus off interrupt: The CAN module enters the bus off state.
Error passive interrupt: The CAN module enters Error Passive Mode.
Error Active Mode: The CAN module is neither in Error Passive Mode nor in Bus Off mode.
Warn Limit interrupt: The CAN module is in Error-active Mode, but at least one of its error counter value 
exceeds 96.
Wake-up interrupt: This interrupt is generated after a wake-up and a bus synchronization.
Sleep interrupt: This interrupt is generated after a Low-power Mode enable once all pending messages in 
transmission have been sent.
Internal timer counter overflow interrupt: This interrupt is generated when the internal timer rolls over. 
Timestamp interrupt: This interrupt is generated after the reception or the transmission of a start of frame or 
an end of frame. The value of the internal counter is copied in the CAN_TIMESTP register.
All interrupts are cleared by clearing the interrupt source except for the internal timer counter overflow interrupt and the 
timestamp interrupt. These interrupts are cleared by reading the CAN_SR register.
41.8.3 CAN Controller Message Handling
41.8.3.1  Receive Handling
Two modes are available to configure a mailbox to receive messages. In Receive Mode, the first message received is 
stored in the mailbox data register. In Receive with Overwrite Mode, the last message received is stored in the mailbox.
Simple Receive Mailbox
A mailbox is in Receive Mode once the MOT field in the CAN_MMRx register has been configured. Message ID and 
Message Acceptance Mask must be set before the Receive Mode is enabled.
After Receive Mode is enabled, the MRDY flag in the CAN_MSR register is automatically cleared until the first message 
is received. When the first message has been accepted by the mailbox, the MRDY flag is set. An interrupt is pending for 
the mailbox while the MRDY flag is set. This interrupt can be masked depending on the mailbox flag in the CAN_IMR 
global register. 
Message data are stored in the mailbox data register until the software application notifies that data processing has 
ended. This is done by asking for a new transfer command, setting the MTCR flag in the CAN_MCRx register. This 
automatically clears the MRDY signal.
The MMI flag in the CAN_MSRx register notifies the software that a message has been lost by the mailbox. This flag is 
set when messages are received while MRDY is set in the CAN_MSRx register. This flag is cleared by reading the 
CAN_MSRs register. A receive mailbox prevents from overwriting the first message by new ones while MRDY flag is set 
in the CAN_MSRx register. See