received, it goes through the message handler's filtering process, and if it passes through the filter,
is stored in the message object specified by the
MNUM
bit in the
CAN IFn Command Request
(CANIFnCRQ)
register. The whole message (including all arbitration bits, data-length code, and
eight data bytes) is stored in the message object. If the Identifier Mask (the
MSK
bits in the
CAN IFn
Mask 1
and
CAN IFn Mask 2 (CANIFnMSKn)
registers) is used, the arbitration bits that are masked
to "don't care" may be overwritten in the message object.
The CPU may read or write each message at any time via the CAN Interface Registers. The message
handler guarantees data consistency in case of concurrent accesses.
The transmission of message objects is under the control of the software that is managing the CAN
hardware. Message objects can be used for one-time data transfers or can be permanent message
objects used to respond in a more periodic manner. Permanent message objects have all arbitration
and control set up, and only the data bytes are updated. At the start of transmission, the appropriate
TXRQST
bit in the
CAN Transmission Request n (CANTXRQn)
register and the
NEWDAT
bit in the
CAN New Data n (CANNWDAn)
register are set. If several transmit messages are assigned to the
same message object (when the number of message objects is not sufficient), the whole message
object has to be configured before the transmission of this message is requested.
The transmission of any number of message objects may be requested at the same time; they are
transmitted according to their internal priority, which is based on the message identifier (
MNUM
) for
the message object, with 1 being the highest priority and 32 being the lowest priority. Messages
may be updated or set to not valid any time, even when their requested transmission is still pending.
The old data is discarded when a message is updated before its pending transmission has started.
Depending on the configuration of the message object, the transmission of a message may be
requested autonomously by the reception of a remote frame with a matching identifier.
Transmission can be automatically started by the reception of a matching remote frame. To enable
this mode, set the
RMTEN
bit in the
CAN IFn Message Control (CANIFnMCTL)
register. A matching
received remote frame causes the
TXRQST
bit to be set, and the message object automatically
transfers its data or generates an interrupt indicating a remote frame was requested. A remote frame
can be strictly a single message identifier, or it can be a range of values specified in the message
object. The CAN mask registers,
CANIFnMSKn
, configure which groups of frames are identified
as remote frame requests. The
UMASK
bit in the
CANIFnMCTL
register enables the
MSK
bits in the
CANIFnMSKn
register to filter which frames are identified as a remote frame request. The
MXTD
bit in the
CANIFnMSK2
register should be set if a remote frame request is expected to be triggered
by 29-bit extended identifiers.
19.3.3
Transmitting Message Objects
If the internal transmit shift register of the CAN module is ready for loading, and if a data transfer is
not occurring between the CAN Interface Registers and message RAM, the valid message object
with the highest priority that has a pending transmission request is loaded into the transmit shift
register by the message handler and the transmission is started. The message object's
NEWDAT
bit
in the
CANNWDAn
register is cleared. After a successful transmission, and if no new data was
written to the message object since the start of the transmission, the
TXRQST
bit in the
CANTXRQn
register is cleared. If the CAN controller is configured to interrupt on a successful transmission of a
message object, (the
TXIE
bit in the
CAN IFn Message Control (CANIFnMCTL)
register is set),
the
INTPND
bit in the
CANIFnMCTL
register is set after a successful transmission. If the CAN
module has lost the arbitration or if an error occurred during the transmission, the message is
re-transmitted as soon as the CAN bus is free again. If, meanwhile, the transmission of a message
with higher priority has been requested, the messages are transmitted in the order of their priority.
June 18, 2014
1360
Texas Instruments-Production Data
Controller Area Network (CAN) Module