object with the lowest message number. This prioritization is separate from that of the message
identifier which is enforced by the CAN bus. As a result, if message object 1 and message object
2 both have valid messages to be transmitted, message object 1 is always transmitted first regardless
of the message identifier in the message object itself.
19.3.10
Configuring a Receive Message Object
The following steps illustrate how to configure a receive message object.
1.
Program the
CAN IFn Command Mask (CANIFnCMASK)
register as described in the
“Configuring a Transmit Message Object” on page 1361 section, except that the
WRNRD
bit is set
to specify a write to the message RAM.
2.
Program the
CANIFnMSK1
and
CANIFnMSK2
registers as described in the “Configuring a
Transmit Message Object” on page 1361 section to configure which bits are used for acceptance
filtering. Note that in order for these bits to be used for acceptance filtering, they must be enabled
by setting the
UMASK
bit in the
CANIFnMCTL
register.
3.
In the
CANIFnMSK2
register, use the
MSK[12:0]
bits to specify which of the bits in the 29-bit
or 11-bit message identifier are used for acceptance filtering. Note that
MSK[12:0]
are used
for bits [28:16] of the 29-bit message identifier; whereas
MSK[12:2]
are used for bits [10:0] of
the 11-bit message identifier. Use the
MXTD
and
MDIR
bits to specify whether to use
XTD
and
DIR
for acceptance filtering. A value of 0x00 enables all messages to pass through the
acceptance filtering. Also note that in order for these bits to be used for acceptance filtering,
they must be enabled by setting the
UMASK
bit in the
CANIFnMCTL
register.
4.
Program the
CANIFnARB1
and
CANIFnARB2
registers as described in the “Configuring a
Transmit Message Object” on page 1361 section to program
XTD
and
ID
bits for the message
identifier to be received; set the
MSGVAL
bit to indicate a valid message; and clear the
DIR
bit
to specify receive.
5.
In the
CANIFnMCTL
register:
■ Optionally set the
UMASK
bit to enable the mask (
MSK
,
MXTD
, and
MDIR
specified in the
CANIFnMSK1
and
CANIFnMSK2
registers) for acceptance filtering
■ Optionally set the
RXIE
bit to enable the
INTPND
bit to be set after a successful reception
■ Clear the
RMTEN
bit to leave the
TXRQST
bit unchanged
■ 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.
6.
Program the number of the message object to be received in the
MNUM
field in the
CAN IFn
Command Request (CANIFnCRQ)
register. Reception of the message object begins as soon
as a matching frame is available on the CAN bus.
When the message handler stores a data frame in the message object, it stores the received Data
Length Code and eight data bytes in the
CANIFnDA1
,
CANIFnDA2
,
CANIFnDB1
, and
CANIFnDB2
register. Byte 0 of the CAN data frame is stored in
DATA[7:0]
in the
CANIFnDA1
register. If the
Data Length Code is less than 8, the remaining bytes of the message object are overwritten by
unspecified values.
June 18, 2014
1364
Texas Instruments-Production Data
Controller Area Network (CAN) Module