Atmel Evaluation Kit AT91SAM9X25-EK AT91SAM9X25-EK 데이터 시트

제품 코드
AT91SAM9X25-EK
다운로드
페이지 1151
916
SAM9X25 [DATASHEET]
11054E–ATARM–10-Mar-2014
41.8.3.2  Transmission Handling
A mailbox is in Transmit Mode once the MOT field in the CAN_MMRx register has been configured. Message ID and 
Message Acceptance mask must be set before Receive Mode is enabled.
After Transmit Mode is enabled, the MRDY flag in the CAN_MSR register is automatically set until the first command is 
sent. When the MRDY flag is set, the software application can prepare a message to be sent by writing to the CAN_MDx 
registers. The message is sent once the software asks for a transfer command setting the MTCR bit and the message 
data length in the CAN_MCRx register. 
The MRDY flag remains at zero as long as the message has not been sent or aborted. It is important to note that no 
access to the mailbox data register is allowed while the MRDY flag is cleared. 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. 
It is also possible to send a remote frame setting the MRTR bit instead of setting the MDLC field. The answer to the 
remote frame is handled by another reception mailbox. In this case, the device acts as a consumer but with the help of 
two mailboxes. It is possible to handle the remote frame emission and the answer reception using only one mailbox 
configured in Consumer Mode. Refer to the section 
.
Several messages can try to win the bus arbitration in the same time. The message with the highest priority is sent first. 
Several transfer request commands can be generated at the same time by setting MBx bits in the CAN_TCR register. 
The priority is set in the PRIOR field of the CAN_MMRx register. Priority 0 is the highest priority, priority 15 is the lowest 
priority. Thus it is possible to use a part of the message ID to set the PRIOR field. If two mailboxes have the same 
priority, the message of the mailbox with the lowest number is sent first. Thus if mailbox 0 and mailbox 5 have the same 
priority and have a message to send at the same time, then the message of the mailbox 0 is sent first.
Setting the MACR bit in the CAN_MCRx register aborts the transmission. Transmission for several mailboxes can be 
aborted by writing MBx fields in the CAN_MACR register. If the message is being sent when the abort command is set, 
then the application is notified by the MRDY bit set and not the MABT in the CAN_MSRx register. Otherwise, if the 
message has not been sent, then the MRDY and the MABT are set in the CAN_MSR register.
When the bus arbitration is lost by a mailbox message, the CAN controller tries to win the next bus arbitration with the 
same message if this one still has the highest priority. Messages to be sent are re-tried automatically until they win the 
bus arbitration. This feature can be disabled by setting the bit DRPT in the CAN_MR register. In this case if the message 
was not sent the first time it was transmitted to the CAN transceiver, it is automatically aborted. The MABT flag is set in 
the CAN_MSRx register until the next transfer command.
 shows three MBx message attempts being made (MRDY of MBx set to 0).
The first MBx message is sent, the second is aborted and the last one is trying to be aborted but too late because it has 
already been transmitted to the CAN transceiver. 
Figure 41-15.Transmitting Messages
MTCR
(CAN_MCRx)
MRDY
(CAN_MSRx)
CAN BUS
MBx message
Reading CAN_MSRx
Writing CAN_MDHx &
 CAN_MDLx
MBx message
MACR
(CAN_MCRx)
Abort MBx message 
Try to Abort MBx message
MABT
(CAN_MSRx)