Chapter 23 Controller Area Network (CAN).pdf
Chapter 23 Controller Area Network (CAN).pdf
Chapter 23 Controller Area Network (CAN).pdf
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Functional Description www.ti.com<br />
<strong>23</strong>.3.10 Interrupt Functionality<br />
Interrupts can be generated on two interrupt lines: D<strong>CAN</strong>INT0 and D<strong>CAN</strong>INT1. These lines can be<br />
enabled by setting the IE0 and IE1 bits, respectively, in the <strong>CAN</strong> control register. The interrupts are level<br />
triggered at the chip level.<br />
The D<strong>CAN</strong> provides three groups of interrupt sources: message object interrupts, status change<br />
interrupts, and error interrupts (see Figure <strong>23</strong>-9 and Figure <strong>23</strong>-10).<br />
The source of an interrupt can be determined by the interrupt identifiers Int0ID/Int1ID in the interrupt<br />
register (see Section <strong>23</strong>.4.1.5). When no interrupt is pending, the register will hold the value zero.<br />
Each interrupt line remains active until the dedicated field in the interrupt register D<strong>CAN</strong> INT (Int0ID /<br />
Int1ID) again reach zero (this means the cause of the interrupt is reset), or until IE0 / IE1 are reset.<br />
The value 0x8000 in the Int0ID field indicates that an interrupt is pending because the <strong>CAN</strong> core has<br />
updated (not necessarily changed) the Error and Status register (D<strong>CAN</strong> ES). This interrupt has the highest<br />
priority. The CPU can update (reset) the status bits WakeUpPnd, RxOk, TxOk and LEC by reading the<br />
error and status register D<strong>CAN</strong> ES, but a write access of the CPU will never generate or reset an<br />
interrupt.<br />
Values between 1 and the number of the last message object indicates that the source of the interrupt is<br />
one of the message objects, Int0ID resp. Int1ID will point to the pending message interrupt with the<br />
highest priority. The Message Object 1 has the highest priority; the last message object has the lowest<br />
priority.<br />
An interrupt service routine that reads the message that is the source of the interrupt may read the<br />
message and reset the message object’s IntPnd at the same time (ClrIntPnd bit in the IF1/IF2 command<br />
register). When IntPnd is cleared, the interrupt register will point to the next message object with a<br />
pending interrupt.<br />
<strong>23</strong>.3.10.1 Message Object Interrupts<br />
Message object interrupts are generated by events from the message objects. They are controlled by the<br />
flags IntPND, TxIE and RxIE that are described in Section <strong>23</strong>.3.18.1.<br />
Message object interrupts can be routed to either D<strong>CAN</strong>INT0 or D<strong>CAN</strong>INT1 line, controlled by the<br />
interrupt multiplexer register (D<strong>CAN</strong> INTMUX12 to D<strong>CAN</strong> INTMUX78), see Section <strong>23</strong>.4.1.17.<br />
<strong>23</strong>.3.10.2 Status Change Interrupts<br />
The events WakeUpPnd, RxOk, TxOk and LEC in error and status register ( D<strong>CAN</strong> ES) belong to the<br />
status change interrupts. The status change interrupt group can be enabled by bit in <strong>CAN</strong> control register.<br />
If SIE is set, a status change interrupt will be generated at each <strong>CAN</strong> frame, independent of bus errors or<br />
valid <strong>CAN</strong> communication, and also independent of the message RAM configuration.<br />
Status change interrupts can only be routed to interrupt line D<strong>CAN</strong>0INT, which has to be enabled by<br />
setting IE0 in the <strong>CAN</strong> control register.<br />
NOTE: Reading the error and status register will clear the WakeUpPnd flag. If in global power-down<br />
mode, the WakeUpPnd flag is cleared by such a read access before the D<strong>CAN</strong> module has<br />
been waken up by the system, the D<strong>CAN</strong> may re-assert the WakeUpPnd flag, and a second<br />
interrupt may occur.<br />
<strong>23</strong>.3.10.3 Error Interrupts<br />
The events PER, BOff and EWarn, monitored in the Error and Status register, D<strong>CAN</strong> ES, belong to the<br />
error interrupts. The error interrupt group can be enabled by setting bit EIE in the <strong>CAN</strong> Control register.<br />
Error interrupts can only be routed to interrupt line D<strong>CAN</strong>0INT, which has to be enabled by setting IE0 in<br />
the <strong>CAN</strong> Control register.<br />
4050 <strong>Controller</strong> <strong>Area</strong> <strong>Network</strong> (<strong>CAN</strong>) SPRUH73E–October 2011–Revised May 2012<br />
Submit Documentation Feedback<br />
Copyright © 2011–2012, Texas Instruments Incorporated