Receiving data messages, Transmitting remote frame requests, Receiving/responding to remote frame requests – Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 155

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

155

Receiving Data Messages

Each incoming data message is compared sequentially with each receive enabled (T/R = 0) message center starting with the lowest-

numbered message center (highest priority) and proceeding to the highest-numbered message center. This testing continues until a

match is found (incorporating masking functions as required), at which time the incoming message is stored in the respective mes-

sage center. Higher numbered message centers that are not reviewed prior to the match are not evaluated during the current message

test. When the WTOE = 1, the CAN module can overwrite receive message centers that have DTUP = 1, which, in turn, sets ROW = 1.

When WTOE = 0, incoming messages do not overwrite receive message centers that have DTUP = 1.

Message center 15 is a special receive-only, FIFO-buffered message center designed to receive messages not accepted by the other

message centers. The ROW bit in message center 15 is associated with the overwrite of the shadow buffer for message center 15. The

EXTRQ and DTUP bits are shadow-buffered to allow the buffered message and the message center 15 values to take on different rela-

tionships. The EXTRQ and DTUP values read by the microcontroller are not those of the shadow buffer, as is the case with the ROW

bit, but are the current values associated with message center 15. The shadow buffer is automatically loaded into message center 15

when both the DTUP bit and the EXTRQ bit are cleared. If either DTUP or EXTRQ are left set when clearing the other, any message in

the shadow buffer is not transferred to the message 15 registers, and any incoming messages for message 15 are stored in the shad-

ow buffer (if WTOE = 1) or are lost (if WTOE = 0).

Transmitting Remote Frame Requests

Starting with the lowest-numbered message center (highest priority), each CAN module sequentially scans each message center.

When it finds a message center properly enabled to transmit a remote frame (T/R = 0, MSRDY = 1, and MTRQ = 1), the contents of

the respective message center are then transferred to the transmit buffer and the CAN module attempts to transmit the message. If

successful, the appropriate MTRQ bit is cleared to 0, indicating that the message was successfully sent. Following a successful trans-

mission, loss of arbitration, or an error condition, the CAN module again searches for a properly configured message center, starting

with the lowest-numbered message center. This search relationship always allows the highest priority message center to be transmit-

ted, independent of the last successful (MTRQ = 0) or unsuccessful (MTRQ = 1) message transmission. The state of the TIH bit does

not affect the transmission of a remote frame request.

If the microcontroller wants to request data from another node, it first clears the respective MSRDY bit to 0 and then writes the identi-

fier and control bits in this message center, configures the message center as a receive message center (T/R = 0) and then sets the

MTRQ bit. After a successful transmission, the CAN module clears MTRQ = 0 and sets TXS = 1. In addition to the TXS bit, if the ETI

bit is set, the successful transmission also sets the corresponding INTRQ bit. Requesting data from another node is possible in mes-

sage centers 1–14. As seen above, the CAN module sends a remote frame request and receives the data frame in any other mailbox

for which the answering incoming data frame passes the acceptance filtering of identifier and first two data bytes. Therefore, only one

mailbox is necessary to do a remote request. Remote frame requests are not supported during autobaud mode.

Receiving/Responding to Remote Frame Requests

The remote frame request is handled like a data frame with data length zero and the EXTRQ and RXS bits are set. Each incoming

remote frame request (RFR) message is compared sequentially with each enabled (MSRDY = 1) message center starting with the low-

est-numbered message center (highest priority) and proceeding to the highest-numbered message center. Testing continues until a

match is found (incorporating masking functions as required), at which time the incoming RFR message is stored in the respective

message center, the DTBYC bits are updated to indicate the requested number of return bytes, and EXTRQ and MTRQ are both set

to 1. When the message is successfully received and stored, an interrupt of the corresponding message center is asserted, if enabled

by the ERI bit. The EXTRQ bit can be left set if the message center is reconfigured to perform a transmit (T/R = 1) and used in the stan-

dard reply of a remote frame operating with transmit message centers. EXTRQ can also be cleared by software if the current message

center is not being used to reply to the remote frame request. Higher-numbered message centers (lower priority) that are not reviewed

prior to the match are not evaluated during the current message test. Depending on the state of the transmit/receive bit for that mes-

sage center, the CAN module performs one of two responses.

When a remote frame request is successfully received, message centers enabled for transmission (T/R = 1) set the EXTRQ and MTRQ

bits in the corresponding message center to mark the message as a ‘to be sent’ message. The CAN module attempts to automatical-

ly transmit the requested message if the message center is fully enabled to do so (MSRDY = 1, TIH = 0, DTUP = 1). After the trans-

mission, the TXS bit in the status register is set, the EXTRQ and MTRQ bits are reset to a 0, and a message center interrupt of the cor-

responding message center is asserted, if enabled by the respective ETI bit. If the transmit inhibit bit is set (TIH = 1), the message

center receives the RFR, modifying the DTBYC and/or arbitration bits if necessary, but the return data is not transmitted until TIH = 0.

Maxim Integrated

Advertising