Rainbow Electronics AT91CAP9S250A User Manual

Page 704

Advertising
background image

704

6264A–CAP–21-May-07

AT91CAP9S500A/AT91CAP9S250A

Figure 39-16. Producer / Consumer Model

In Pull Mode, a consumer transmits a remote frame to the producer. When the producer
receives a remote frame, it sends the answer accepted by one or many consumers. Using
transmit and receive mailboxes, a consumer must dedicate two mailboxes, one in Transmit
Mode to send remote frames, and at least one in Receive Mode to capture the producer’s
answer. The same structure is applicable to a producer: one reception mailbox is required to
get the remote frame and one transmit mailbox to answer.

Mailboxes can be configured in Producer or Consumer Mode. A lonely mailbox can handle the
remote frame and the answer. With

16

mailboxes, the CAN controller can handle

16

indepen-

dent producers/consumers.

Producer Configuration

A mailbox is in Producer 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 Producer Mode is enabled, the MRDY flag in the CAN_MSR register is automatically set
until the first transfer command. The software application prepares data to be sent by writing
to the CAN_MDHx and the CAN_MDLx registers, then by setting the MTCR bit in the
CAN_MCRx register. Data is sent after the reception of a remote frame as soon as it wins the
bus arbitration.

The MRDY flag remains at zero as long as the message has not been sent or aborted. No
access to the mailbox data register can be done while MRDY flag is cleared. 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.

If a remote frame is received while no data are ready to be sent (signal MRDY set in the
CAN_MSRx register), then the MMI signal is set in the CAN_MSRx register. This bit is cleared
by reading the CAN_MSRx register.

The MRTR field in the CAN_MSRx register has no meaning. This field is used only when using
Receive and Receive with Overwrite modes.

CAN Data Frame

CAN Remote Frame

CAN Data Frame

Indication(s)

Request

Request(s)

Indications

Response

Confirmation(s)

PUSH MODEL

PULL MODEL

Producer

Producer

Consumer

Consumer

Advertising