Rainbow Electronics AT91CAP9S250A User Manual

Page 705

Advertising
background image

705

6264A–CAP–21-May-07

AT91CAP9S500A/AT91CAP9S250A

After a remote frame has been received, the mailbox functions like a transmit mailbox. The
message with the highest priority is sent first. The transmitted message may be aborted by
setting the MACR bit in the CAN_MCR register. Please refer to the section

”Transmission

Handling” on page 702

.

Figure 39-17. Producer Handling

Consumer Configuration

A mailbox is in Consumer Mode once the MOT field in the CAN_MMRx register has been con-
figured. Message ID and Message Acceptance masks must be set before Receive Mode is
enabled.

After Consumer Mode is enabled, the MRDY flag in the CAN_MSR register is automatically
cleared until the first transfer request command. The software application sends a remote
frame by setting the MTCR bit in the CAN_MCRx register or the MBx bit in the global
CAN_TCR register. The application is notified of the answer by the MRDY flag set in the
CAN_MSRx register. The application can read the data contents in the CAN_MDHx and
CAN_MDLx registers. An interrupt is pending for the mailbox while the MRDY flag is set. This
interrupt can be masked according to the mailbox flag in the CAN_IMR global register.

The MRTR bit in the CAN_MCRx register has no effect. This field is used only when using
Transmit Mode.

After a remote frame has been sent, the consumer mailbox functions as a reception mailbox.
The first message received is stored in the mailbox data registers. If other messages intended
for this mailbox have been sent while the MRDY flag is set in the CAN_MSRx register, they
will be lost. The application is notified by reading the MMI field in the CAN_MSRx register. The
read operation automatically clears the MMI flag.

If several messages are answered by the Producer, the CAN controller may have one mailbox
in consumer configuration, zero or several mailboxes in Receive Mode and one mailbox in
Receive with Overwrite Mode. In this case, the consumer mailbox must have a lower number
than the Receive with Overwrite mailbox. The transfer command can be triggered for all mail-
boxes at the same time by setting several MBx fields in the CAN_TCR register.

MTCR

(CAN_MCRx)

MRDY

(CAN_MSRx)

CAN BUS

Remote Frame

Message 1

Message 1

Message 2

(CAN_MDLx

CAN_MDHx)

MMI

(CAN_MSRx)

Remote Frame

Remote Frame

Message 2

Reading CAN_MSRx

Advertising