Sunteți pe pagina 1din 72

車用匯流排CAN之

架構及其應用
南台科大 電子系 唐經洲

中山資工 2017/02/24
大綱
 Why In-Vehicle Networking (車內網路)?
 CAN Bus 發展歷史
 CAN Bus 基本概念
 Topology/Node
 Repeater/Bridge/Gateway
 CAN Bus 相關標準介紹/討論
 Physical Layer
 Data Link Layer

中山資工 2017/02/24 2
Why In-Vehicle Networking (IVN) ?
(車內網路) ?

中山資工 2017/02/24
Vehicle Design Evolution

那些沒有變化 ?
引擎, 輪胎, 大燈, 尾燈, 玻璃窗, 喇叭, 方向盤…
中山資工 2017/02/24 4
http://www.justanswer.com/classic-cars/285m1-need-downlooad-wiring-diagram-1950-ford-car.html

1950 Ford Passenger Car

中山資工 2017/02/24 5
Electronics in the Car
偏航 加速度 溫度

Throttle Ignition and Yaw and acceleration Occupant Door sensors Temperature/
position sensor engine control sensors and air bag position for internal humidity
and control electronics deployment sensors and lights sensors and
雨滴 controls (smart comfort control
Charge sensor Rain sensor air bags)
(battery) and wiper 倒車
control Parking
Oil/fuel (proximity)
pressure and sensors
flow sensors
and controls

夜視

氧氣
Wireless phone Emissions
O2 sensor Seat belt
and GPS sensor (NOX)
Collision (air/fuel) sensor
avoidance
Steering angle Angular
and night Combustion Passenger Tire Zero vehicle
pressure sensor and weight sensor pressure speed (ABS) acceleration
vision
sensor and stability control (smart air bags) sensor sensor and sensors
sensor
中山資工 2017/02/24 control 轉向角度 胎壓 control (suspension)6
一部車要用到多少Flash Memory/ ECU?

-40 ~ 85oC
Q1: 那一個 ECU 可以指揮這些 ECUs + Memory ? AEC-Q100
Q2: 感測完後的 資料(訊) 要傳到拿裡去 ?
Source: Audi
中山資工 2017/02/24 7
Car Runs on Code (1/3)
 今日一部車子的 ECUs 數目
 Low end: 30 ~ 50 (doors, roof… etc)
 High end: 70~100
 Lines of code: ~100 million (1 億)
 Future: 200~300 million
 Benz S Class 的 Radio 與 Navigation 系統的軟
體行數: > 20M 行
 比 A389 還多
 電子/與軟體在一部車的 Cost 比重: 35% ~ 40%
 Hybrid 車子的比重會更高
 How can we ensure timely and reliable
communication via the “wires”?
[http://www.spectrum.ieee.org/feb09/7649]
中山資工 2017/02/24 8
Car Runs on Code (2/3)
IVDC: Interactive Vehicle Dynamic Control (互動式車身動態穩定控制系統 )
ISG: Integrated Starter Generator (起動機—發電機一體化技術 )
EPAS: Electric Power Assistant Steering (電動輔助轉向系統 )
ESP: Electronic Stability Program (電子車身穩定系統 )
Function
Growth
Lane-
Remote
keeping
Processor Diagnostics

Sensor Actuator Rear Multi- ISG In Car PC


Software media Satellite
Radio El. Water
Auto lights
Adaptive Pump
Transducer Auto wipers Headlamps
EM Valves
Surround ACC
Sound IVDC
Telematics E-Connectivity
Adaptive PTC Heater
suspension Steer-by-
Optical Buses Active
Wire
Navigation steering
Security Brake-by-
ABS Adv. Voice Activation Wire
Engine Control Body Elec. Blind Spot
Instruments Airbag Restraints
Keyless Detection Fuel Cell
Transmission Control ESP EPAS Vehicle
1980 1990 2000 2010
中山資工 2017/02/24 CY 9
[http://www.spectrum.ieee.org/feb09/7649]

Car Runs on Code (3/3)


 Lines of software code:
 F-22 Raptor (猛禽戰鬥機 ): 1.7M 行
 F-35 Joint Strike Fighter (閃電II攻擊戰鬥機):
5.7M 行
 Boeing 787 Dreamliner(夢幻客機): 6.5M 行

F-35 Joint Strike Fighter

787 Dreamliner
F-22 Raptor

中山資工 2017/02/24 10
An increased regulatory pressure to
reduce CO2 emissions
g CO2 /km
Tesla model S 的碳排放量約 163 g/mile
200

2015
180
154 g CO2 /km
160
2016

140
140g CO2/km
2020
120 2015
CO2: g/Km 95g CO2/km
US: 195(2010)  140 (2016)
130g CO2/km
100
CN: 190(2010)  154 (2015)
EU: 150(2010)  95 (2020)

80
2010
中山資工 2017/02/24 2012 2014 2016 2018 2020
11
為何需要 IVN ?
 Too complex, too much energy
consumption
 Too many ECUs
 Too many cables/harness
 Too many connectors
 Too much weight
 Too many different networks

 Too many too many…


中山資工 2017/02/24 12
CAN Bus 發展歷史

中山資工 2017/02/24 1886 The Benz Patent Motorwagen


CAN Bus發展歷史 (1/5)
 傳統的 Vehicle Harness
 利用專用的電線線束,以點對點的方式連接ECU、
使用者開關、控制器與末端元件,以完成控制及資
料交換。

中山資工 2017/02/24 http://www.stoneridge.com/products/wire-harness/ 14


CAN Bus發展歷史 (2/5)
 傳統harness 的缺點
 極為複雜的車內網路
 增加車輛重量、生產成本
 過多的連接線路還會降低系統的可靠度
 因此傳統點對點的配線方式已經不符現
代新型車種的要求

中山資工 2017/02/24 15
http://canbuskit.com/what.php

CAN Bus發展歷史 (3/5)

採用CAN Bus系統的接線示意圖

Engine Control Body Control

簡化佈線
提高可靠度與維護性
Engine Control Body Control
中山資工 2017/02/24 16
Dr. Wolfhard Lawrenz
University of Applied Science in Braunschweig-Wolfenbüttel, Germany

CAN Bus發展歷史 (4/5)


 1983: Bosch 公司開始發展
 1986: Bosch 在SAE (Society of Automotive Engineers) 公開

802.3i: 10Base-T/Ethernet-- 1990

 1987: 1st CAN Controller--by Intel (82526) & Philips (82C200)


 1990: Bosch 提出標準申請
 1991: Mercedes 成為第一個使用CAN 的車廠 (S-Class)
 1992: 第一個CAN User Group CiA 成立
 CAL: CAN Application Layer
 1993: 列入ISO 11898國際標準

中山資工 2017/02/24 17
CAN Bus發展歷史 (5/5)
 1994: DeviceNet(Allen-Bradely)
 維護: Open DeviceNet Vendors Association (ODVA)
 美日
 1995: CANopen(CiA)
 標準: CENELEC EN 50325-4
 歐洲
 2000: Time-Triggered CAN (TTCAN)
 2004: 超過 15 家Foundry/50 種 CAN Controller
 2008: OBDII 確認 CAN 是其中一種訊號
 2011: Bosch提出CAN with Flexible Data-Rate (CAN FD)
 2012: Taiwan CS8959  Luxgen SUV
 2014: Taiwan CAN Transceiver CS8972

中山資工 2017/02/24 18
CAN Bus 的發明者
 Dr. Wolfhard Lawrenz
 University of Applied Science in Braunschweig-
Wolfenbüttel, Germany

中山資工 2017/02/24 19
Harness before CAN

中山資工 2017/02/24 20
Harness with CAN

儀表板

中山資工 2017/02/24 21
VW 的 CAN Bus 發展歷史
 1997: PASSAT
 Comfort: 62.5K
 1998: PASSAT & GOLF
 Powertrain: 500K
 2000: PASSAT & GOLF
 Gateway (第二代 CAN Bus)
 2001:
 Comfort: 100K
 Powertrain: 500K
 2002: PQ24 (A4) 平台 (第三代 CAN Bus)
 2003: PQ35 (A5) 平台 •P 表示乘用車(passenger car)平台
•Q 表示橫置引擎(quer)
 5 個 CAN segment •2 表示平台的大小或級別
 LIN •5 表示第幾代
中山資工 2017/02/24 22
VW Phaeton2002
 Electrical parts: 11,136
 Communication: 61 ECUs in total
 External diagnosis: 31 ECUs via serial
communication
 Optical bus for high bandwidth Infotainment-data
 Sub-networks based on proprietary serial bus
 35 ECUs connected by 3 CAN-busses
 Sharing approximately 2500 signals
in 250 CAN messages

中山資工 2017/02/24 23
http://www.sequentialtaillights.com/dodge/Tip89_DodgeCANBUS.htm

Dodge 的 CAN Bus 系統

中山資工 2017/02/24 24
ECM 與 TCM 的訊號關係
Engine Control Unit
Transmission
Control Unit
ECM

TCM

中山資工 2017/02/24 25
BMW 第一個CAN Bus
 1993 740i/iL
 DME: Digital Motor Electronics
 AGS: Automatic Electronic Gearbox Control
(EGS) /變速齒輪機箱
Transmission - 自動變速箱
Engine Temperature
Engine RPM (TD)
Engine Load (tL)
Injector on Time (ti)
Throttle Position (DKV)

Transmission Range
Torque Reduction (ME)
TCC Lockup Status
中山資工 2017/02/24 http://www.bmwsections.com/info/abbreviations.php
http://prodcds.bmwuniversity.com/library/bmw/Technician/Archived%20Courses/ST051%20Body%20Electronics%20I_archive%2010-10/10%20Introduction%20to%20Bus%20Systems.pdf 26
BMW E38 750iL CAN Bus1995-1997

不是雙絞線
是 Shield cable

引擎控制器 變速機箱 動態穩定 節氣門


http://www.e38.org/bussystem.pdf 控制系統

DSC - Dynamic Stability Control


EML - Electronic Motor Load regulation
中山資工 2017/02/24 27
BMW CAN Bus LED Bulb2014
http://detail.1688.com/offer/796570750.html

CAN-BUS LED解码灯 宝马车仪表灯


LED解码车灯 CANBUS车灯 http://www.hq-auto-lighting.co.uk/2x-501-194-w5w-canbus-smd-led-car-bulbs-bmw-e46/

中山資工 2017/02/24 28
JAGUAR X-TYPE XK8 XKR X2 –LED 2W

Price: £ 4.99

中山資工 2017/02/24 29
In-Vehicle CAN Networking (1/2)

Brake
(ABS / VSC / TRC / EBD) Throttle
Speed Sensor Shift Steering
Body(TRC / ACC)

CAN Bus
CAN_H
CAN_L

Brake
Pedal Accelerate Wheel actuator(4WS)
AT
AFS Pedal
中山資工 2017/02/24 30
In-Vehicle CAN Networking (2/2)

中山資工 2017/02/24
http://documentation.renesas.com/doc/products/mpumcu/apn/rej05b0804_m16cap.pdf
Source: Renesas 31
CAN Bus Topology

中山資工 2017/02/24
BMW 5xx 的 CAN Bus 電纜

BMW 5 Series 的 CAN High (黑色) 與 CAN Low (黃色) 電纜


中山資工 2017/02/24 33
BMW 3xx 的 CAN Bus 電纜

Blue BL
Brown BR
Yellow GE
Green GN
Grey GR
Orange OR
Red RT
Black SW
Transparent TR
Violet VI
White WS

BMW 3 Series 的 CAN High (黃色/紅色 Yellow/Red) 與 CAN Low (黃色/棕色 Yellow/Brown) 34
中山資工 2017/02/24
BMW 的 Motorcycles OBD
http://www.hexcode.co.za/products/gs-911/images-1/connector/gs-911_s1000rrm.jpg

SR1000RR 在後座下的OBDII Connector

中山資工 http://developer.mbed.org/users/fossum_13/notebook/obd-on-bmw-motorcycles/
2017/02/24 35
BMW 的 OBDII Connector

BMW (Early models)

Plug Number Pin Number Description


2 3 CAN HIGH
2 4 CAN LOW
1 6 Ground
1 8 12V
BMW (Late models)
Plug Number Pin Number Description
4 36 CAN HIGH
4 37 CAN LOW
1 6 Ground
1 8 12V
中山資工 2017/02/24 36
CAN Bus 的 Topology (1/3)

Bus
Star
(Star Link)

中山資工 2017/02/24 37
CAN Bus 的 Topology (2/3)
Source: Automotive Fuel and Emissions Control Systems
Chapter 12, Pearson
By James D. Halderman and James Linder

Router

Tree
Message rate control
Message multicasting Ring Link
Message scheduling
Identifier validation and translation
Message checks
Message content translation
中山資工 2017/02/24 Diagnosis and management 38
CAN Bus 的 Topology (3/3)

Gateway: 有加上 filter 的 Bridge


Layer 2 元件
中山資工 2017/02/24 http://www.warwickcontrol.com/ata/Infobackup_and_library/Basicbus.pdf 39
Star Link + Data Link Connector

Source: Automotive Fuel and Emissions Control Systems


Chapter 12, Pearson
By James D. Halderman and James Linder

A star link network connects all of the modules together using splice packs.
中山資工 2017/02/24 40
Basic Configuration

Engine Management System

中山資工 2017/02/24 41
Typical ECU Components

Power
Conditioning

CAN CAN
Micro-Controller Protocol Bus
Controller Driver

Memory Interface
I/O

中山資工 2017/02/24 42
ECU Connection to the bus
Power
ECU 1 Power
ECU 2
Conditioning Conditioning

CAN CAN CAN_H CAN CAN


CAN_H
Micro-Controller Protocol Bus Micro-Controller Protocol Bus
Controller Driver Controller Driver
CAN_L

Memory Interface Memory Interface


I/O I/O

CAN_H
Terminator CAN_L Terminator

$19.95
中山資工 2017/02/24 http://www.oemdevices.com/index.php?route=product/product&product_id=64 43
CAN Bus上的CAN Nodes

http://www.ti.com/
中山資工 2017/02/24 44
CAN Bus 相關標準介紹/討論

中山資工 2017/02/24
ISO 11898 Standards
 ISO 11898-1: 2003 Road vehicles — Part 1: Data link layer and
physical signaling
 ISO 11898-2: 2003 Road vehicles — Part 2: High-speed medium
access unit
 ISO 11898-3: 2006 Road vehicles — Part 3: Low-speed, fault-
tolerant, medium dependent interface
 LSFT CAN/FTCAN

 ISO 11898-4: 2004 Road vehicles — Part 4: Time-triggered


communication
 TTCAN

 ISO 11898-5: 2007 Road vehicles — Part 5: High-speed medium


access unit with low-power mode
 ISO/NP 11898-6 Road vehicles — Part 6: High-speed medium
access unit with selective wake-up functionality
 CAN (FD) with Flexible Data-Rate, Bosch White Paper 2011
中山資工 2017/02/24 46
HS vs. FT vs. SW CAN
High Speed CAN Fault Tolerant Single Wire
Low Speed CAN Low Speed CAN
Application Engine Control Body & Comfort Body & Comfort
CAN classification SAE CAN Class C SAE CAN Class B/C SAE CAN Class B
Standard ISO 11898-2 ISO 11898-3
Topology Line Topology various Topology
Baud Rate 125K~1000K bps ≦ 125bps ≦100 bps
Signals 500~800 Signals 1200~2500 Signals
Messages 30~50 Messages 250~350 Messages
Nodes 2~10 Nodes 30~50 Nodes

ISO 16845:2004 Road vehicles -- Controller area network (CAN) -- Conformance test plan
ISO/CD 16845-1: Road vehicles -- Controller area network (CAN) conformance test plan -- Part
1: Data link layer and physical signaling
ISO 16845-2: 2014 Road vehicles -- Controller area network (CAN) conformance test plan --
Part 2: High-speed medium access unit with selective wake-up functionality
中山資工 2017/02/24 47
1 bit error each 0,7s, 500 kbit/s, working 8 h/day at 365 days/year.
Statistical average: 1 undetected error in 1000 years!

CAN Bus 的基本規格數據


規格名稱 CAN Bus數據
CAN Bus現有的通訊協定標準 Bosch CAN 2.0,ISO 11898
最大資料傳輸率 1 Mbps (此時僅有40 m傳輸長度)
最大線路長度 10km (此時僅有5kbps資料傳輸率)
平均錯誤率 小於4.71011
ISO規範之高速CAN Bus傳輸率要求 資料傳輸率大於125kbps
ISO規範之低速CAN Bus傳輸率要求 資料傳輸率小於125kbps
CAN Bus資料傳遞最小延遲時間 134 s
CAN Bus傳遞一個完整資料平均時間 1 ms (千分之一秒)
同一條CAN Bus通常連接的控制元件 32個 (理論上並無上限,不過為了系
個數 統穩定,一般最多只接到32個控制
元件)

中山資工 2017/02/24 一個CAN Frame 最多有 13011/15429 bits = 130/154 us48


有效線路長度與傳輸速率的關係
傳輸速率 最大線路長度
1 Mbps 40 m
500kbps 130 m
250kbps 270 m
125kbps 530 m
100kbps 620 m
50kbps 1.3km
20kbps 3.3km
10kbps 6.7km
5kbps 10km

中山資工 2017/02/24 49
Typical CAN Node (1/2)
Data Link Layer Physical Layer

µController TXD CAN_H

CAN Bus
CAN CAN
Controller Transceiver
ADC Interface

RXD CAN_L

CAN Bus is a simple 2-wire differential serial bus


CAN Bus is terminated on each side by a 120 Ohm resistor
中山資工 2017/02/24 50
CAN匯流排組成元件 (1/3)
 CAN匯流排基本組成元件有6項,包括:

Controller (控制器) x1
Transceiver (收發器) x1
一般會將控制器與收發
Bus Terminator 器整合在一個ECU上
(終端電阻) x 2

Bus line (匯流排導線) x2

中山資工 2017/02/24 51
CAN匯流排組成元件 (2/3)
 CAN Controller
 可接收來自車輛控制模組所傳送來的數位資料,控制器處理
之後可將其轉給收發器
 當然,控制器也可接收來自收發器的數位資料,將其處理後
轉給車輛控制模組
 CAN Transceiver
 包含了發送器 (Transmitter) 與接收器(Receiver)
 它可將控制器送來的數位資料轉成電子訊號,接著送到匯流
排導線進行傳輸
 收發器也可將匯流排導線上收到的電子訊號轉成控制器可解
讀的數位資料,並傳送給控制器
 Terminator
 匯流排終端電阻的功能是避免電子信號在匯流排導線末端發
生反射現象,提高匯流排導線上信號的穩定性

中山資工 2017/02/24 52
CAN匯流排組成元件 (3/3)
 CAN High x 1, CAN Low x1
 CAN匯流排上所傳遞的資料,所有的控制器都可以收到

中山資工 2017/02/24 53
CAN Bus Transceiver (1/2)
一般Transceiver 內部的電路圖

Source: TI
中山資工 2017/02/24 54
CAN Bus Transceiver (2/2)
幾乎與 RS 485 2-wire Multi-Drop 系統結構
一樣,只是 終端電阻為100 Ohm

RS 485 Multi-Drop
中山資工 2017/02/24 55
NXP FTCAN Transceiver
 FTCAN: Fault Tolerant CAN
 TJA 1055T

SJA1000

中山資工 2017/02/24 56
Bus 電壓定義: ISO-IS 11898 (1/2)

弱勢 強勢 弱勢

CAN Bus 因為是差動傳輸,所以理想上不會有幅射訊號產生出來 .

CAN Bus 驅動電路的對稱性


中山資工 2017/02/24 Source: TI 57
Bus 電壓定義: ISO-IS 11898 (2/2)

一般示波器上所應該看到的正常CAN_H 與CAN_L 訊號
中山資工 2017/02/24 Source: TI 58
Arbitration (仲裁)

中山資工 2017/02/24
CAN Bus Arbitration (1/4)
 CAN匯流排上的訊息交換方式

ECM TCM Dashboard

中山資工 2017/02/24 60
CAN Bus Arbitration (2/4)
Identifier (29 bits) Data (8 bytes)
ECU 1 1 0 1 1 0 0 0 1 1 1 ... 1 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 ...
ECU 2 1 0 1 1 1 ECU 2 ceases transmission
and prepares to resend later
Bus
Result 1 0 1 1 0 0 0 1 1 1 ... 1 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 ...
Arbitration Field NO Arbitration
Lower numbered identifiers assume higher priority

CAN_H
CAN_L
VCAN_H
Voltage

CSMA/CD, CA, CR VCAN_L


Vdiff

recessive dominant recessive

1 Bit

中山資工 2017/02/24 Time 61


RTR (Remote transmission request)

CAN Bus Arbitration (3/4)


ID

因為 Arbitration 透過硬體  軟體實現變成容易,即時性也提高


中山資工 2017/02/24 http://www.canlab.c/dictionary/arbitration.gif 62
CAN Bus Arbitration (4/4)
Voltage
Difference

Logic value

中山資工 2017/02/24 63
http://www.go-gddq.com/down/2012-07/12072204023817.pdf

CAN BUS 的Arbitration–範例 (1/2)

 福斯汽車之煞車、引擎、自動變速箱控制模組
之狀態欄位範例

中山資工 2017/02/24 64
http://www.go-gddq.com/down/2012-07/12072204023817.pdf

CAN BUS 的Arbitration–範例 (2/2)


注意: ESP 系統的權限會比 Brake 更高

 煞車、
 引擎、
 自動變速箱控制模組之
訊息優先順序示意圖

中山資工 2017/02/24 65
CAN匯流排資料傳輸步驟 (1/2)

 資料傳輸步驟包含五項,分別為:
1. 提供資料(Provide Data)
2. 傳送資料(Send Data)
3. 接收資料(Receive Data)
4. 檢查資料(Check Data)
5. 接收資料(Accept Data)

中山資工 2017/02/24 66
http://www.go-gddq.com/down/2012-07/12072204023817.pdf

CAN匯流排資料傳輸步驟 (2/2)

 CAN匯流排資料傳送與接收步驟示意圖

5 5
1
4 4

3 2 3 3

中山資工 2017/02/24 67
CAN 的 Broadcast/Filter 特性
CAN CAN CAN CAN
Station 1 Station 2 Station 3 Station 4
(consumer) (Producer) (consumer) (consumer)

Local Local Local Local


intelligence intelligence intelligence intelligence

Filter Frame l Filter Filter Filter

bus lines
中山資工 2017/02/24 68
Message Frames (訊框)
 Data Frame (資料訊框)
 最為普遍的類型
 資料被從一個節點傳送到所有的節點
 Remote Frame (遠端訊框)
 與 Data Frame 極為相似
 只有 RTR bit 被設為 1
 被用來向其它的 CAN node 主動要求資料之用
 Error Frame (錯誤訊框)
 用來表示在 CAN bus 上有錯誤狀況被偵測到
 Overload Frame (超載訊框)
 用來告知其他的 CAN nodes, 必須有更多的時間來處
理收到的資料. 主要的功能是延遲下一個封包被傳送的
時間
中山資工 2017/02/24 69
Key Reasons for Using CAN
 可靠 (Reliability)
 Error-free communication
 費用低 (Economy )
 Low wiring cost
 Low hardware cost
 彈性 (Scalability)
 Easy expandability
 Low node-connection costs
 資源豐富 (Availability)
 More chips with CAN hardware
 More off-the-shelf tools
 通用 (Popularity)
 Knowledge base expanding

中山資工 2017/02/24 70
Limitations of CAN
 速度太低 (<1Mbps)
 當有太多資料同時要傳輸,匯流排的使用
(Utilization) 就會降低
 很多Nodes 要經常重新傳(retransmitted)
 某些CAN Nodes 可能會阻塞匯流排
 Babbling idiot
 常常因為要 Arbitration,所以Message 的
傳遞時間經常無法預估
 對於安全性可能有隱憂

中山資工 2017/02/24 http://www.cse.chalmers.se/~svenk/mikrodatorsystem/lectures/TTCAN_ppt.pdf 71


感謝聆聽

中山資工 2017/02/24 72

S-ar putea să vă placă și