■ Optionally set the
RMTEN
bit to enable the
TXRQST
bit to be set on the reception of a matching
remote frame allowing automatic transmission
■ Set the
EOB
bit for a single message object
■ Configure the
DLC[3:0]
field to specify the size of the data frame. Take care during this
configuration not to set the
NEWDAT
,
MSGLST
,
INTPND
or
TXRQST
bits.
7.
Load the data to be transmitted into the
CAN IFn Data (CANIFnDA1, CANIFnDA2, CANIFnDB1,
CANIFnDB2)
registers. Byte 0 of the CAN data frame is stored in
DATA[7:0]
in the
CANIFnDA1
register.
8.
Program the number of the message object to be transmitted in the
MNUM
field in the
CAN IFn
Command Request (CANIFnCRQ)
register.
9.
When everything is properly configured, set the
TXRQST
bit in the
CANIFnMCTL
register. Once
this bit is set, the message object is available to be transmitted, depending on priority and bus
availability. Note that setting the
RMTEN
bit in the
CANIFnMCTL
register can also start message
transmission if a matching remote frame has been received.
19.3.5
Updating a Transmit Message Object
The CPU may update the data bytes of a Transmit Message Object any time via the CAN Interface
Registers and neither the
MSGVAL
bit in the
CANIFnARB2
register nor the
TXRQST
bits in the
CANIFnMCTL
register have to be cleared before the update.
Even if only some of the data bytes are to be updated, all four bytes of the corresponding
CANIFnDAn
/
CANIFnDBn
register have to be valid before the content of that register is transferred
to the message object. Either the CPU must write all four bytes into the
CANIFnDAn
/
CANIFnDBn
register or the message object is transferred to the
CANIFnDAn
/
CANIFnDBn
register before the
CPU writes the new data bytes.
In order to only update the data in a message object, the
WRNRD
,
DATAA
and
DATAB
bits in the
CANIFnMSKn
register are set, followed by writing the updated data into
CANIFnDA1
,
CANIFnDA2
,
CANIFnDB1
, and
CANIFnDB2
registers, and then the number of the message object is written to
the
MNUM
field in the
CAN IFn Command Request (CANIFnCRQ)
register. To begin transmission
of the new data as soon as possible, set the
TXRQST
bit in the
CANIFnMSKn
register.
To prevent the clearing of the
TXRQST
bit in the
CANIFnMCTL
register at the end of a transmission
that may already be in progress while the data is updated, the
NEWDAT
and
TXRQST
bits have to be
set at the same time in the
CANIFnMCTL
register. When these bits are set at the same time,
NEWDAT
is cleared as soon as the new transmission has started.
19.3.6
Accepting Received Message Objects
When the arbitration and control field (the
ID
and
XTD
bits in the
CANIFnARB2
and the
RMTEN
and
DLC[3:0]
bits of the
CANIFnMCTL
register) of an incoming message is completely shifted into
the CAN controller, the message handling capability of the controller starts scanning the message
RAM for a matching valid message object. To scan the message RAM for a matching message
object, the controller uses the acceptance filtering programmed through the mask bits in the
CANIFnMSKn
register and enabled using the
UMASK
bit in the
CANIFnMCTL
register. Each valid
message object, starting with object 1, is compared with the incoming message to locate a matching
message object in the message RAM. If a match occurs, the scanning is stopped and the message
handler proceeds depending on whether it is a data frame or remote frame that was received.
June 18, 2014
1362
Texas Instruments-Production Data
Controller Area Network (CAN) Module