The message object memory is a set of 32 identical memory blocks that hold the current configuration,
status, and actual data for each message object. These memory blocks are accessed via either of
the CAN message object register interfaces.
The message memory is not directly accessible in the TM4C1294NCPDT memory map, so the
TM4C1294NCPDT CAN controller provides an interface to communicate with the message memory
via two CAN interface register sets for communicating with the message objects. These two interfaces
must be used to read or write to each message object. The two message object interfaces allow
parallel access to the CAN controller message objects when multiple objects may have new
information that must be processed. In general, one interface is used for transmit data and one for
receive data.
19.3.1
Initialization
To use the CAN controller, the peripheral clock must be enabled using the
RCGC0
register (see
page 395). In addition, the clock to the appropriate GPIO module must be enabled via the
RCGC2
register (see page 395). To find out which GPIO port to enable, refer to Table 26-4 on page 1797. Set
the GPIO
AFSEL
bits for the appropriate pins (see page 770). Configure the
PMCn
fields in the
GPIOPCTL
register to assign the CAN signals to the appropriate pins. See page 787 and Table
Software initialization is started by setting the
INIT
bit in the
CAN Control (CANCTL)
register (with
software or by a hardware reset) or by going bus-off, which occurs when the transmitter's error
counter exceeds a count of 255. While
INIT
is set, all message transfers to and from the CAN bus
are stopped and the
CANnTX
signal is held High. Entering the initialization state does not change
the configuration of the CAN controller, the message objects, or the error counters. However, some
configuration registers are only accessible while in the initialization state.
To initialize the CAN controller, set the
CAN Bit Timing (CANBIT)
register and configure each
message object. If a message object is not needed, label it as not valid by clearing the
MSGVAL
bit
in the
CAN IFn Arbitration 2 (CANIFnARB2)
register. Otherwise, the whole message object must
be initialized, as the fields of the message object may not have valid information, causing unexpected
results. Both the
INIT
and
CCE
bits in the
CANCTL
register must be set in order to access the
CANBIT
register and the
CAN Baud Rate Prescaler Extension (CANBRPE)
register to configure
the bit timing. To leave the initialization state, the
INIT
bit must be cleared. Afterwards, the internal
Bit Stream Processor (BSP) synchronizes itself to the data transfer on the CAN bus by waiting for
the occurrence of a sequence of 11 consecutive recessive bits (indicating a bus idle condition)
before it takes part in bus activities and starts message transfers. Message object initialization does
not require the CAN to be in the initialization state and can be done on the fly. However, message
objects should all be configured to particular identifiers or set to not valid before message transfer
starts. To change the configuration of a message object during normal operation, clear the
MSGVAL
bit in the
CANIFnARB2
register to indicate that the message object is not valid during the change.
When the configuration is completed, set the
MSGVAL
bit again to indicate that the message object
is once again valid.
19.3.2
Operation
Two sets of CAN Interface Registers (
CANIF1x
and
CANIF2x
) are used to access the message
objects in the Message RAM. The CAN controller coordinates transfers to and from the Message
RAM to and from the registers. The two sets are independent and identical and can be used to
queue transactions. Generally, one interface is used to transmit data and one is used to receive
data.
Once the CAN module is initialized and the
INIT
bit in the
CANCTL
register is cleared, the CAN
module synchronizes itself to the CAN bus and starts the message transfer. As each message is
1359
June 18, 2014
Texas Instruments-Production Data
Tiva
™
TM4C1294NCPDT Microcontroller