Functional Description
793
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Controller Area Network (CAN) Module
11.3.9 Receive and Transmit Priority
The receive and transmit priority for the message objects is controlled by the message number. Message
object 1 has the highest priority, while message object 32 has the lowest priority. If more than one
transmission request is pending, the message objects are transmitted in order based on the message
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.
11.3.10 Configuring a Receive Message Object
The following steps show how to configure a receive message object.
1. Program the CAN IFn Command Mask (CANIFnCMSK) register as described in the
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
section to
configure which bits are used for acceptance filtering. Note that 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. 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
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:
a. Optionally set the UMASK bit to enable the mask (MSK, MXTD, and MDIR specified in the
CANIFnMSK1 and CANIFnMSK2 registers) for acceptance filtering.
b. Optionally set the RXIE bit to enable the INTPND bit to be set after a successful reception.
c. Clear the RMTEN bit to leave the TXRQST bit unchanged.
d. Set the EOB bit for a single message object.
e. 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 registers. 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.
The CAN mask registers can be used to allow groups of data frames to be received by a message object.
The CAN mask registers, CANIFnMSKn, configure which groups of frames are received by a message
object. The UMASK bit in the CANIFnMCTL register enables the MSK bits in the CANIFnMSKn register to
filter which frames are received. The MXTD bit in the CANIFnMSK2 register should be set if only 29-bit
extended identifiers are expected by this message object.