priority. Among the message interrupts, the message object's interrupt with the lowest message
number has the highest priority. A message interrupt is cleared by clearing the message object's
INTPND
bit in the
CANIFnMCTL
register or by reading the
CAN Status (CANSTS)
register. The
status Interrupt is cleared by reading the
CANSTS
register.
The interrupt identifier
INTID
in the
CANINT
register indicates the cause of the interrupt. When no
interrupt is pending, the register reads as 0x0000. If the value of the
INTID
field is different from 0,
then an interrupt is pending. If the
IE
bit is set in the
CANCTL
register, the interrupt line to the
interrupt controller is active. The interrupt line remains active until the
INTID
field is 0, meaning
that all interrupt sources have been cleared (the cause of the interrupt is reset), or until
IE
is cleared,
which disables interrupts from the CAN controller.
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 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 message object's
INTPND
bit 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.
19.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.
19.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.
June 18, 2014
1368
Texas Instruments-Production Data
Controller Area Network (CAN) Module