Texas Instruments TMS470R1x Controller Area Network (CAN) Reference (Rev. E) User guide

Category
Networking
Type
User guide

This manual is also suitable for

TMS470R1x Controller Area Network
(CAN) Reference Guide
Literature Number: SPNU197E
July 2005
ii
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections,
modifications, enhancements, improvements, and other changes to its products and services at
any time and to discontinue any product or service without notice. Customers should obtain the
latest relevant information before placing orders and should verify that such information is current
and complete. All products are sold subject to TI’s terms and conditions of sale supplied at the
time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of
sale in accordance with TI’s standard warranty. Testing and other quality control techniques are
used to the extent TI deems necessary to support this warranty. Except where mandated by
government requirements, testing of all parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are
responsible for their products and applications using TI components. To minimize the risks asso-
ciated with customer products and applications, customers should provide adequate design and
operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any
TI patent right, copyright, mask work right, or other TI intellectual property right relating to any
combination, machine, or process in which TI products or services are used. Information published
by TI regarding third-party products or services does not constitute a license from TI to use such
products or services or a warranty or endorsement thereof. Use of such information may require
a license from a third party under the patents or other intellectual property of the third party, or a
license from TI under the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is
without alteration and is accompanied by all associated warranties, conditions, limitations, and
notices. Reproduction of this information with alteration is an unfair and deceptive business prac-
tice. TI is not responsible or liable for such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated
by TI for that product or service voids all express and any implied warranties for the associated TI
product or service and is an unfair and deceptive business practice. TI is not responsible or liable
for any such statements.
Following are URLs where you can obtain information on other Texas Instruments products and
application solutions:
Copyright 2005, Texas Instruments Incorporated
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DSP dsp.ti.com Broadband www.ti.com/broadband
Interface interface.ti.com Digital Control www.ti.com/digitalcontrol
Logic logic.ti.com Military www.ti.com/military
Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork
Microcontrollers microcontroller.ti.com Security www.ti.com/security
Telephony www.ti.com/telephony
Video & Imaging www.ti.com/video
Wireless www.ti.com/wireless
Mailing Address: Texas Instruments
Post Office Box 655303 Dallas, Texas 75265
REVISION HISTORY
REVISION DATE NOTES
E7/05
Page 43, note on wakeup delay from STANDBY due to bus-off condition added.
Page 68, SRES bit reset value corrected.
Page 70, ABO bit description updated.
Page 78, BO bit description updated.
Page 95, note on clearing the CCR bit after bus-off condition added
v
Contents
1 CAN Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1 CAN Protocol Processor Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 SCC Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 HECC Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Overview of the CAN Network and Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 CAN Protocol Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 CAN Controller Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Standard CAN Controller (SCC) Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1 SCC Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 SCC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 High-End CAN Controller (HECC) Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1 SCC-Compatible Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2 HECC Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3 HECC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5 Message Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.1 SCC Message Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2 HECC Message Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.3 CAN Message Mailbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.3.1 Transmit Mailbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.3.2 Receive Mailbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.3.3 Handling of Remote Frames. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.3.4 CPU Message Mailbox Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.3.5 Message Identifier Register (MID) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.3.6 Message Control Field Register (MCF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.3.7 Message Data Registers (MDL, MDH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.4 CAN Acceptance Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.4.1 SCC Acceptance Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.4.2 HECC Acceptance Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.4.3 Local Acceptance Mask Register (LAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6 CAN Module Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.1 CAN Bit-Timing Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.2 CAN Bit Rate Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7 CAN Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.1 Interrupts Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7.2 Message Object Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
vi
Contents
8 CAN Power-Down Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
8.1 Local Power Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
8.2 Global Power Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
9 Timer Management Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
9.1 Time Stamp Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.2 Local Network Time Register (LNT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9.3 Message Object Time Stamp Registers (MOTS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10 Time-Out Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
10.1 Message Object Time-Out Registers (MOTO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.2 Time Out Control-Register (TOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
10.3 Time Out Status Register (TOS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
11 CAN SCC/HECC Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
11.1 Mailbox Enable Register (CANME) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
11.2 Mailbox Direction Register (CANMD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
11.3 Transmission Request Set Register (CANTRS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
11.4 Transmission Request Reset Register (CANTRR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
11.5 Transmission Acknowledge Register (CANTA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
11.6 Abort Acknowledge Register (CANAA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
11.7 Receive Message Pending Register (CANRMP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
11.8 Receive Message Lost Register (CANRML). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
11.9 Remote Frame Pending Register (CANRFP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
11.10 Global Acceptance Mask Register (CANGAM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
11.11 Master Control Register (CANMC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
11.12 Bit-Timing Configuration Register (CANBTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
11.13 Error and Status Register (CANES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
11.14 CAN Error Counter Registers (CANTEC/CANREC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
11.15 Global Interrupt Flag Registers (CANGIF0/CANGIF1) . . . . . . . . . . . . . . . . . . . . . . . . . . 82
11.16 Global Interrupt Mask Register (CANGIM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.17 Mailbox Interrupt Mask Register (CANMIM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
11.18 Mailbox Interrupt Level Register (CANMIL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
11.19 Overwrite Protection Control Register (CANOPC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
11.20 CAN I/O Control Registers (CANTIOC, CANRIOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12 CAN Operation Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94
12.1 Configuration of SCC or HECC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
12.2 Transmit Mailbox. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95
12.2.1 Configuring a Mailbox for Transmit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.2.2 Transmitting a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.3 Receive Mailbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
12.3.1 Configuring Mailboxes for Receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
12.3.2 Receiving a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
12.3.3 Handling of Overload Situations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
12.4 Handling of Remote Frame Mailboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
12.4.1 Requesting Data From Another Node. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
12.4.2 Answering a Remote Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
12.4.3 Updating the Data Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Contents vii
Contents
12.5 Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
12.5.1 Configuring for Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
12.5.2 Handling Mailbox Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
viii
Figures
1 CAN Data Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Architecture of the SCC and HECC CAN Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 SCC Functional Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 HECC Functional Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5 HECC Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6 Message Identifier Register (MID) Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7 Message Control Field Register (MCF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8 Message Data Low Register with DBO = 0 (MDL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9 Message Data High Register with DBO = 0 (MDH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
10 Message Data Low Register with DBO = 1 (MDL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
11 Message Data High Register with DBO = 1 (MDH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
12 Local Acceptance Mask Register (LAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
13 Configuration Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
14 Partition of the Bit Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
15 SCC Interrupts Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
16 HECC Interrupts Scheme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
17 Local Network Time Register (LNT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
18 Message Object Time Stamp Registers (MOTS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
19 Message Object Time-Out Registers (MOTO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
20 Time-Out Control Register (TOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
21 Time-Out Status Register (TOS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
22 Mailbox Enable Register (CANME) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
23 Mailbox Direction Register (CANMD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
24 Transmission Request Set Register (CANTRS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
25 Transmission Request Reset Register (CANTRR) Field Descriptions . . . . . . . . . . . . . . . . . . 60
26 Transmission Acknowledge Register (CANTA) Field Descriptions . . . . . . . . . . . . . . . . . . . . . 62
27 Abort Acknowledge Register (CANAA) Field Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
28 Receive Message Pending Register (CANRMP) Field Descriptions . . . . . . . . . . . . . . . . . . . . 64
29 Receive Message Lost Register (CANRML) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 65
30 Remote Frame Pending Register (CANRFP) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 66
Contents ix
31 Global Acceptance Mask Register (CANGAM) Field Descriptions . . . . . . . . . . . . . . . . . . . . 67
32 Master Control Register (CANMC) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
33 Bit-Timing Configuration Register (CANBTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
34 Error and Status Register (CANES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
35 Transmit Error Counter Register (CANTEC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
36 Receive Error Counter Register (CANREC). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
37 Global Interrupt Flag 0 Register (CANGIF0 ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
38 Global Interrupt Flag 1 Register (CANGIF1 ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
39 Global Interrupt Mask Register (CANGIM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
40 Mailbox Interrupt Mask Register (CANMIM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
41 Mailbox Interrupt Level Register (CANMIL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
42 Overwrite Protection Control Register (CANOPC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
43 CAN I/O Control Register (CANTIOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
44 RX I/O Control Register (CANRIOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
x
Tables
1 SCC and HECC Features Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Combined SCC/HECC Registers Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 Combined SCC/HECC Registers Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 SCC Message Object Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 HECC Message Object Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Message Object Behavior Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7 Message Identifier Register (MID) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8 Message Control Field Register (MCF) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9 Local Acceptance Mask Register (LAM) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . 32
10 Local Network Time Register (LNT) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
11 Message Object Time Stamp Registers (MOTS) Field Descriptions . . . . . . . . . . . . . . . . . . . . 46
12 Message Object Time-Out Registers (MOTO) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 48
13 Time-Out Control Register (TOC) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
14 Time-Out Status Register (TOS) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
15 Combined SCC/HECC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
16 Mailbox Enable Register (CANME) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
17 Mailbox Direction Register (CANMD) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
18 Transmission Request Set Register (CANTRS) Field Descriptions . . . . . . . . . . . . . . . . . . . . . 59
19 Transmission Request Reset Register (CANTRR) Field Descriptions . . . . . . . . . . . . . . . . . . . 61
20 Transmission Acknowledge Register (CANTA) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 62
21 Abort Acknowledge Register (CANAA) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
22 Receive Message Pending Register (CANRMP) Field Descriptions . . . . . . . . . . . . . . . . . . . . 64
23 Receive Message Lost Register (CANRML) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . 65
24 Remote Frame Pending Register (CANRFP) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . 66
25 Global Acceptance Mask Register (CANGAM) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 67
26 Master Control Register (CANMC) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
27 Bit-Timing Configuration Register (CANBTC) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 73
28 Error and Status Register (CANES) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
29 Global Interrupt Flag Registers (CANGIF0/CANGIF1) Field Descriptions. . . . . . . . . . . . . . . . 82
30 Global Interrupt Mask Register (CANGIM) Field Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . 85
Contents xi
31 Mailbox Interrupt Mask Register (CANMIM) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . 88
32 Mailbox Interrupt Level Register (CANMIL) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . 89
33 Overwrite Protection Control Register (CANOPC) Field Descriptions . . . . . . . . . . . . . . . . . . 90
34 CAN I/O Control Register (CANTIOC) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
35 RX I/O Control Register (CANRIOC) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
xii
Controller Area Network (CAN) (SPNU197E) 1
Controller Area Network (CAN)
This reference guide describes the Controller Area Network (CAN). The CAN
uses established protocol to communicate serially with other controllers in
harsh environments. This chapter describes the TMS470 CAN controllers,
the Standard CAN Controller (SCC) and the High-End CAN Controller
(HECC). Unless otherwise stated in the text, all information is related to both
the SCC and HECC.
1 CAN Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Overview of the CAN Network and Module . . . . . . . . . . . . . . . . . . . . . . 6
3 Standard CAN Controller (SCC) Overview . . . . . . . . . . . . . . . . . . . . . . . 9
4 High-End CAN Controller (HECC) Overview . . . . . . . . . . . . . . . . . . . . 13
5 Message Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6 CAN Module Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7 CAN Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
8 CAN Power-Down Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
9 Timer Management Unit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10 Time-Out Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
11 CAN SCC/HECC Control Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
12 CAN Operation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Topic Page
2
CAN Overview
1 CAN Overview
The TMS470 CAN controller is available in two different implementations that
are both fully compliant with the CAN protocol, version 2.0B. The two different
CAN controller versions use the same CAN protocol kernel module to
perform the basic CAN protocol tasks. Only the message controller differs
between the two CAN controller versions. See Table 1.
Key features of the CAN module include:
Common CAN protocol kernel (CPK) to perform protocol tasks
Standard CAN controller (SCC) for standard CAN applications
Sixteen message objects
Three receive identifier masks
High-end CAN controller (HECC) for complex applications
Thirty-two message objects
Thirty-two receive identifier masks
Table 1. SCC and HECC Features Overview
Feature SCC HECC
Number of message objects 16 Rx/Tx 32 Rx/Tx
Number of receive identifier masks
332
CAN, version 2.0B compliant
XX
Low-power mode
XX
Programmable wake-up on bus activity
XX
Programmable interrupt scheme
XX
Automatic reply to a remote request
XX
Automatic retransmission in case of error
XX
Protect against reception of new message
XX
32-bit time stamp
X
Local network time counter
X
Programmable priority register for each message
X
Programmable transmission and reception time-out
X
Controller Area Network (CAN) (SPNU197E) 3
CAN Overview
1.1 CAN Protocol Processor Features
The CAN protocol kernel (CPK) performs the basic CAN protocol tasks
according to CAN protocol specification 2.0B. The CPK is the basic module
of all CAN controller implementations.
The CPK provides the following features:
Full implementation of CAN protocol, version 2.0B
Standard and extended identifiers
Data and remote frames
Bus speed of up to 1 Mbps with an 8-MHz system clock
Programmable prescaler from 1 to 256
Programmable bit time according to the CAN specification
Programmable sampling mode
One or three samples used to determine the received bit value
Selectable edge of receive bit flow for synchronization
Both edges or falling edge only
Automatic retransmission of a frame in case of loss of arbitration
Low-power mode
Bus failure diagnostic
Bus on/off
Error passive/active
Bus error warning
Bus stuck dominant
Frame error report: cyclic redundancy check (CRC), stuff, form, bit, and
acknowledgment errors
Readable error counters
Self-test mode
Operate in a loop-back mode (receiving its own message)
Dummy acknowledge
4
CAN Overview
1.2 SCC Features
The TMS470 device family has the following SCC features:
All the CPK features
Full implementation of CAN protocol, version 2.0B
Sixteen message objects, each with the following properties:
Configurable as receive or transmit
Configurable with standard or extended identifier
Protects against reception of new message
Supports data and remote frame
Composed of 0 to 8 bytes of data
Employs a programmable interrupt scheme with two interrupt levels
Has a message priority based on object number
Two programmable local identifier masks for objects 0–2 and 3–5
Configurable as standard or extended message identifier
Has an acceptance mask register for identifier extension bit
One global programmable identifier mask for objects 6–15
Configurable as standard or extended message identifier
Has an acceptance mask register for identifier extension bit
Low-power mode
Programmable wake-up on bus activity
Automatic reply to a remote request message
Automatic retransmission of a frame in case of loss of arbitration or error
1.3 HECC Features
The TMS470 device family has the following HECC features:
All the CPK features
Full implementation of CAN protocol, version 2.0B
Thirty-two message objects, each with the following properties:
Configurable as receive or transmit
Controller Area Network (CAN) (SPNU197E) 5
CAN Overview
Configurable with standard or extended identifier
Has a programmable receive mask
Supports data and remote frame
Composed of 0 to 8 bytes of data
Uses a 32-bit time stamp on receive and transmit message
Protects against reception of new message
Holds the dynamically programmable priority of transmit message
Employs a programmable interrupt scheme with two interrupt levels
Employs a programmable alarm on transmission or reception time-out
Low-power mode
Programmable wake-up on bus activity
Automatic reply to a remote request message
Automatic retransmission of a frame in case of loss of arbitration or error
32-bit local network time counter synchronized by a specific message
(communication in conjunction with mailbox 16)
SCC-compatible mode
Upwardly compatible software
Software written for the SCC can run without any changes on the HECC
SCC-compatible mode is automatically activated after RESET
6
Overview of the CAN Network and Module
2 Overview of the CAN Network and Module
The controller area network (CAN) uses a serial multimaster communication
protocol that efficiently supports distributed real-time control, with a very high
level of security, and a communication rate of up to 1 Mbps. The CAN bus is
ideal for applications operating in noisy and harsh environments, such as in
the automotive and other industrial fields that require reliable communication
or multiplexed wiring.
Prioritized messages of up to 8 bytes in data length can be sent on a
multimaster serial bus using an arbitration protocol and an error-detection
mechanism for a high level of data integrity.
2.1 CAN Protocol Overview
The CAN protocol supports four different frame types for communication:
Data frames that carry data from a transmitter node to the receiver nodes
Remote frames that are transmitted by a node to request the transmission
of a data frame with the same identifier
Error frames that are transmitted by any node on a bus-error detection
Overload frames that provide an extra delay between the preceding and
the succeeding data frames or remote frames.
In addition, CAN specification version 2.0B defines two different formats that
differ in the length of the identifier field: standard frames with an 11-bit
identifier and extended frames with 29-bit identifier.
CAN standard data frames contain from 44 to 108 bits and CAN extended
data frames contain 64 to 128 bits. Furthermore, up to 23 stuff bits can be
inserted in a standard data frame, and up to 28 stuff bits in an extended data
frame, depending on the data-stream coding. The overall maximum data
frame length is then 131 bits for a standard frame and 156 bits for an
extended frame.
Controller Area Network (CAN) (SPNU197E) 7
Overview of the CAN Network and Module
Bit fields within the data frame, shown in Figure 1, identify:
Start of the frame
Arbitration field containing the identifier and the type of message being
sent
Control field containing the number of data
Up to 8 bytes of data
Cyclic redundancy check (CRC)
Acknowledgment
End-of-frame bits
Figure 1. CAN Data Frame
2.2 CAN Controller Overview
The TMS470 CAN controllers provide the CPU with full functionality of the
CAN protocol, version 2.0B. The CAN controller minimizes the CPU’s load in
communication overhead and enhances the CAN standard by providing
additional features.
The architecture of both the SCC and the HECC controllers, shown in Figure
2, is composed of a CAN protocol kernel (CPK) and a message controller.
Bit length 1 12 or 32
Start bit
Arbitration field that contains:
6 0-8 bytes
Data field
Control bits
16
CRC bits
7
End
2
Acknowledge
– 11-bit identifier + RTR bit for standard frame format
– 29-bit identifier + SRR bit + IDE bit + RTR bit for extended frame format
Where: RTR = Remote Transmission Request
SRR = Substitute Remote Request
IDE = Identifier Extension
Note: Unless otherwise noted, numbers are amount of bits in field.
8
Overview of the CAN Network and Module
Figure 2. Architecture of the SCC and HECC CAN Controllers
Two functions of the CPK are to decode all messages received on the CAN
bus according to the CAN protocol and to transfer these messages into a
receive buffer. Another CPK function is to transmit messages on the CAN bus
according to the CAN protocol.
The message controller of a CAN controller is responsible for determining if
any message received by the CPK must be preserved for the CPU use or be
discarded. At the initialization phase, the CPU specifies to the message
controller all message identifiers used by the application. The message
controller is also responsible for sending the next message to transmit to the
CPK according to the message’s priority.
The SCC and the HECC differ only by their message controller - the CPK
always offers the same services. The message management of the message
controller is not part of the CAN protocol specification.
CAN Bus
TMS470
CAN controller
Message Controller
CAN Protocol Kernel (CPK)
Receive Buffer
Transmit Buffer
CAN Transceiver
RX TX
CPU
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78
  • Page 79 79
  • Page 80 80
  • Page 81 81
  • Page 82 82
  • Page 83 83
  • Page 84 84
  • Page 85 85
  • Page 86 86
  • Page 87 87
  • Page 88 88
  • Page 89 89
  • Page 90 90
  • Page 91 91
  • Page 92 92
  • Page 93 93
  • Page 94 94
  • Page 95 95
  • Page 96 96
  • Page 97 97
  • Page 98 98
  • Page 99 99
  • Page 100 100
  • Page 101 101
  • Page 102 102
  • Page 103 103
  • Page 104 104
  • Page 105 105
  • Page 106 106
  • Page 107 107
  • Page 108 108
  • Page 109 109
  • Page 110 110
  • Page 111 111
  • Page 112 112
  • Page 113 113
  • Page 114 114

Texas Instruments TMS470R1x Controller Area Network (CAN) Reference (Rev. E) User guide

Category
Networking
Type
User guide
This manual is also suitable for

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI