Functional Description
796
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Controller Area Network (CAN) Module
The INTID field of the CANINT register points to the pending message interrupt with the highest interrupt
priority. The SIE bit in the CANCTL register controls whether a change of the RXOK, TXOK, and LEC bits
in the CANSTS register can cause an interrupt. The EIE bit in the CANCTL register controls whether a
change of the BOFF and EWARN bits in the CANSTS register can cause an interrupt. The IE bit in the
CANCTL register controls whether any interrupt from the CAN controller actually generates an interrupt to
the interrupt controller. The CANINT register is updated even when the IE bit in the CANCTL register is
clear, but the interrupt is not indicated to the CPU.
A value of 0x8000 (INTID = 0x8000, which means the interrupt identifier is a status interrupt) in the
CANINT register indicates that an interrupt is pending because the CAN module has updated (but not
necessarily changed) the CANSTS register, indicating that either an error or status interrupt has been
generated. A write access to the CANSTS register can clear the RXOK, TXOK, and LEC bits in that same
register; however, the only way to clear the source of a status interrupt is to read the CANSTS register.
The source of an interrupt can be determined in two ways during interrupt handling. The first is to read the
INTID bit in the CANINT register to determine the highest priority interrupt that is pending, and the second
is to read the CAN Message Interrupt Pending (CANMSGnINT) register to see all of the message objects
that have pending interrupts.
An interrupt service routine reading the message that is the source of the interrupt may read the message
and clear the INTPND bit of the message object at the same time by setting the CLRINTPND bit in the
CANIFnCMSK register. Once the INTPND bit has been cleared, the CANINT register contains the
message number for the next message object with a pending interrupt.
11.3.13 Test Mode
A Test Mode is provided which allows various diagnostics to be performed. Test Mode is entered by
setting the TEST bit in the CANCTL register. Once in Test Mode, the TX[1:0], LBACK, SILENT and BASIC
bits in the CAN Test (CANTST) register can be used to put the CAN controller into the various diagnostic
modes. The RX bit in the CANTST register allows monitoring of the CANnRX signal. All CANTST register
functions are disabled when the TEST bit is cleared.
11.3.13.1 Silent Mode
Silent Mode can be used to analyze the traffic on a CAN bus without affecting it by the transmission of
dominant bits (Acknowledge Bits, Error Frames). The CAN Controller is put in Silent Mode setting the
SILENT bit in the CANTST register. In Silent Mode, the CAN controller is able to receive valid data frames
and valid remote frames, but it sends only recessive bits on the CAN bus and cannot start a transmission.
If the CAN Controller is required to send a dominant bit (ACK bit, overload flag, or active error flag), the bit
is rerouted internally so that the CAN Controller monitors this dominant bit, although the CAN bus remains
in recessive state.
11.3.13.2 Loopback Mode
Loopback mode is useful for self-test functions. In Loopback Mode, the CAN Controller internally routes
the CANnTX signal on to the CANnRX signal and treats its own transmitted messages as received
messages and stores them (if they pass acceptance filtering) into the message buffer. The CAN Controller
is put in Loopback Mode by setting the LBACK bit in the CANTST register. To be independent from
external stimulation, the CAN Controller ignores acknowledge errors (a recessive bit sampled in the
acknowledge slot of a data/remote frame) in Loopback Mode. The actual value of the CANnRX signal is
disregarded by the CAN Controller. The transmitted messages can be monitored on the CANnTX signal.
11.3.13.3 Loopback Combined with Silent Mode
Loopback Mode and Silent Mode can be combined to allow the CAN Controller to be tested without
affecting a running CAN system connected to the CANnTX and CANnRX signals. In this mode, the
CANnRX signal is disconnected from the CAN Controller and the CANnTX signal is held recessive. This
mode is enabled by setting both the LBACK and SILENT bits in the CANTST register.