Atmel Evaluation Kit AT91SAM9X25-EK AT91SAM9X25-EK Data Sheet

Product codes
AT91SAM9X25-EK
Page of 1151
911
SAM9X25 [DATASHEET]
11054E–ATARM–10-Mar-2014
41.8 Functional Description
41.8.1 CAN Controller Initialization
After power-up reset, the CAN controller is disabled. The CAN controller clock must be activated by the Power 
Management Controller (PMC) and the CAN controller interrupt line must be enabled by the interrupt controller (AIC).
The CAN controller must be initialized with the CAN network parameters. The CAN_BR register defines the sampling 
point in the bit time period. CAN_BR must be set before the CAN controller is enabled by setting the CANEN field in the 
CAN_MR register. 
The CAN controller is enabled by setting the CANEN flag in the CAN_MR register. At this stage, the internal CAN 
controller state machine is reset, error counters are reset to 0, error flags are reset to 0. 
Once the CAN controller is enabled, bus synchronization is done automatically by scanning eleven recessive bits. The 
WAKEUP bit in the CAN_SR register is automatically set to 1 when the CAN controller is synchronized (WAKEUP and 
SLEEP are stuck at 0 after a reset). 
The CAN controller can start listening to the network in Autobaud Mode. In this case, the error counters are locked and a 
mailbox may be configured in Receive Mode. By scanning error flags, the CAN_BR register values synchronized with the 
network. Once no error has been detected, the application disables the Autobaud Mode, clearing the ABM field in the 
CAN_MR register.
Figure 41-10.Possible Initialization Procedure
Errors ?
No
Yes
(ABM == 1 and CANEN == 1)
CANEN = 1 (ABM ==  0)
ABM = 0 and CANEN = 0
(CAN_SR or CAN_MSRx)
Change CAN_BR value
End of Initialization
Configure a Mailbox in Reception Mode
Enable CAN Controller Interrupt Line
Enable CAN Controller Clock
(AIC)
(PMC)