in-vehicle networking
Post on 30-Dec-2015
31 Views
Preview:
DESCRIPTION
TRANSCRIPT
January 9, 2008 BAE 5030-363
In-Vehicle Networking
Lecture 1 Introduction to CAN (Controller Area Network) BAE 5030 – 363
Spring 2009Instructors: Marvin Stone
Biosystems and Agricultural EngineeringOklahoma State University
January 9, 2008 BAE 5030-363
Automotive Body Network
CAN
CAN
Power Train
Light
Sub-Bus
ITS
Window Lift
InteriorLight
Lock
Mirror
Lock
Mirror
Lock
Lock
Seat
Htng
Seat
Htng
Instruments
CentralBody Ctrl
Climate
Universal Motor
Universal Panel
Light
Roof
1 backbone, 13 nodes8 subnets, 1-8 local nodes52 nodes total
St-Wheel Panel
x6Htng
Htng
Seat
Wiper
Trunk
WHtg
Universal Light
January 9, 2008 BAE 5030-363
Hierarchical networks are here today
VW Phaeton• 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
CAN applications are broad
January 9, 2008 BAE 5030-363
• 63 ECUs• 33 CAN nodes• 2 250 k CAN Networks
Ntech RT500 Fertilizer Applicator
January 9, 2008 BAE 5030-363
J1850pier to pier
prioritized messages
Costs and Speeds for Automotive NetworksSp
eed
[bit
/s]
LINmaster-slave
single wire busno quartz
CAN-Bevent triggeredfault tolerantdual wire
25.6M
20K
2M
1M
125K
incremental cost per node [$]1 2 4.5 10
ISO 11783CAN-Cevent triggeredQuad wire
Byteflightoptical bus
TTx (in definition)
time triggeredfault tol, dependable2x2 wire
D2B, MOSTtoken ringoptical bus
January 9, 2008 BAE 5030-363
What is CAN?
– CAN = Controller Area Network• Serial data communications protocol for real-time application
using a multiple access bus– Messages have assignable priority
» most critical can dominate during heavy load– Messages are short (controlled length)
» opportunities to insert a new message come often
– CAN provides multiplexed serial communications– Reduction in wiring complexity– Better information sharing– All communications share the same communication path
– Low probability of an undetected error• 4.7 x 10-11 x message error rate
– For a message error rate of 25/sec: 1 undetected error per 10,000 hours operation
January 9, 2008 BAE 5030-363
An overview of CAN based networking
• Elements of the CAN protocol– Message components
• Identifier / Data
– Bus Access - Arbitration / Prioritization• CSMA/CR (carrier sense multiple access / collision resolution
– Bitwize priority access strategy– Non-destructive collisions
– Error Detection / Error Confinement– Filtering– Other features
• In Frame Acknowledgement
• RTR
January 9, 2008 BAE 5030-363
Capacity Comparison
Capacity (bits/sec.)
1.00E+00
1.00E+02
1.00E+04
1.00E+06
1.00E+08
V.90 Modem J1939 / ISO11783
Ethernet10base2
Loga
rithm
ic D
ata
Rat
e (b
aud)
56K250K
10,000K
January 9, 2008 BAE 5030-363
Capacity and Performance (Based on 250 KBaud)
• Use of bus bandwidth by messages– 100 messages per second (10 ms repetition) =5%
• Torque/Speed control on engine
• Hitch control
– 10 messages per second (100 ms repetition) =0.5%• Throttle position
• GPS Lat/Lon data
• Implement application rate control (process data)
– 1 message per second (1s repetition) =0.05%• Display updates
• System status
January 9, 2008 BAE 5030-363
Message latency (Based on 250 KBaud)
• 134 bit message– @ 4s per bit = 536s = 0.5 ms per message max
• Highest priority message– must wait no more than ~0.5 ms
• Low priority messages– must wait till higher priority messages clear– latency may be long at high bus loads
January 9, 2008 BAE 5030-363
Harness Hell!
January 9, 2008 BAE 5030-363
Conventional Wiring (No Bus)
DataLogging
SensorsECUs
GPS
NozzlesNOZZLE
ECU
SerialCommunicationLinks
January 9, 2008 BAE 5030-363
A Simple CAN Application (Serial Bus)
DataLogging
SensorsECUs
GPS
NozzlesNOZZLE
ECU
Data B
us
Dat
a B
us
January 9, 2008 BAE 5030-363
Multiplexed communication
EngineController
ECU 1
TransmissionController
ECU 2
DashboardController
ECU 3
Shared Communications Bus
BusTerminator
BusTerminator
January 9, 2008 BAE 5030-363
Typical ECU Components
Micro-ControllerCAN
ProtocolController
CANBus
Driver
Memory InterfaceI/O
PowerConditioning
January 9, 2008 BAE 5030-363
ECU Connection to the bus
Micro-ControllerCAN
ProtocolController
CANBus
Driver
Memory InterfaceI/O
PowerConditioning
Micro-ControllerCAN
ProtocolController
CANBus
Driver
Memory InterfaceI/O
PowerConditioning
ECU 1 ECU 2
CAN_HCAN_LTerminator Terminator
CAN_H
CAN_L
CAN_H
January 9, 2008 BAE 5030-363
CAN - continued• Developed by Bosch GmBh
(See http://www.semiconductors.bosch.de/pdf/can2spec.pdf)
– About 1986, Version 2.0 in 1991 for auto apps.• Version 1.2 (Equivalent to 2.0A)
– 11 bit ID (not interoperable with 29 bit 2.0b)
• Version 2.0 (2.0A + 2.0B)– 2.0B - 11 and 29 bit ID
» 11 and 29 are compatible on same bus» 11 bit only 2.0B is called 2.0B passive» 29 bit (and 11bit) 2.0B called 2.0B active
– CAN provides only Data Link functions• Media access control• Logical link control
January 9, 2008 BAE 5030-363
Components of a “CAN Protocol”
ISO 7498 – Open Systems Interconnection (OSI)
Netw
ork M
anag
emen
tNet
wo
rk M
anag
emen
t Application Layer
Presentation Layer
Session Layer
Transport Layer
Network Layer
Physical Layer
Application Layer
Presentation Layer
Session Layer
Transport Layer
Network Layer
Physical Layer
CAN CAN Data Link LayerData Link Layer
To form a complete communications system you need more than CAN
January 9, 2008 BAE 5030-363
Network Protocols based on CAN
• SAE J1939• Heavy Duty Diesel Systems
– On-Highway Truck– Agricultural Equipment– Construction Equipment– Generator Sets
• ISO 11783• Ag and Forestry Equipment
• NMEA 2000/IEC 61162-3• Marine / GPS / Navigation
• CANopen• Broad industrial applications - (CiA)• EN 50325-4
• DeviceNet• Industrial automation – PLCs (Allen Bradley)
• CAN Kingdom• Meta protocol - (Kvaser)
January 9, 2008 BAE 5030-363
Physical Signaling Example (ISO 11878)
CAN Arbitration
Identifier (29 bits) Data (8 bytes)1 0 1 1 0 0 0 1 1 1 ...ECU 1
ECU 2
BusResult
1 0 1 1 1 1 1 1 1 0 0 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 ceases transmissionand prepares to resend later
Arbitration Field NO Arbitration
1 0 1 1 0 0 0 1 1 1 ...
1 0 1 1 1
VCAN_H
VCAN_L
Vdiff
recessive dominant recessive
1 Bit
Lower numbered identifiers assume higher priority
January 9, 2008 BAE 5030-363
Consequences of identifier prioritization in CAN
• Unique Identifiers– Developer must assure all identifiers within a bus system are
unique
• Resyncronization– CAN controllers assure message transmissions always start
at the same time among controllers on the bus
• All messages queued are sent simultaneously– System appears to have one large queue where highest
priority message is sent first
January 9, 2008 BAE 5030-363
CAN Frame Components
11 bits or 29 bits
Identifier Data
0 to 8 bytes (0 to 64 bits)
CAN Frame (up to 134 bits)
Serial bit streamStart
January 9, 2008 BAE 5030-363
SOF
1
Identifier
11
SRR
1
IDE
1
DLC
4
Data Field
0 - 64
ACKField
2Bits
CRCDelimiter
1
Arbitration Field32 Bits
r0
1
ControlField6 Bits
DataField
CRC
15 7
EOF
Bit Stuffing
CAN Extended Data Frame
Maximum frame length with bit stuffing = 150 bits
r1
1
IdentifierExt.
RTR
118
B. CAN Extended Frame Format
No BitStuffing
CAN Frame Format - CAN 2.0B
11 bits or 29 bits
Identifier Data
0 to 8 bytes (0 to 64 bits)
CAN Frame (up to 134 bits)
January 9, 2008 BAE 5030-363
Acknowledgement
• In-Frame acknowledgement– Any receiver of a message that receives a message correctly
asserts a dominant acknowledge bit within the frame of the message being sent.
• Transmitter can know message was received by some receiver– Further message confirmation must be built at a higher level in the
protocol– Transmitter alone on a bus will go bus OFF
• Receiver with an error– Transmits an error frame immediately after the message causing a
Frame Error for all receivers
January 9, 2008 BAE 5030-363
Remote transmission request (RTR)
• Request message hardware feature– Allows setting a bit of an identifier to request a controller with
a matching identifier to send the message– Can allow a response of a queued message without CPU
interaction– Commonly not exploited in higher level standardized
protocols
January 9, 2008 BAE 5030-363
Error Detection
• 5 Error Types Detected– Bit Error (Sent bit doesn’t match monitored bit)– Stuff Error (more than 6 successive in one state)– CRC error– Form Error– Acknowledge Error
• Probability of an undetected error– 4.7 x 10-11 x message error rate
• for a message error rate of 25/sec, 1 undetected error per 10,000 hours operation
January 9, 2008 BAE 5030-363
Message Filtering - Example
MASK
MATCH
1 = Care, 0= Don’t Care
Accept if:(ID AND MASK) XOR MATCH = 0
11100000000
IDENTIFIER10111100100
10100000000
ID AND MASK10100000000 =
(ID AND MASK) XOR MATCH00000000000 =
Pattern must match
January 9, 2008 BAE 5030-363
Bus Timing
• Bus bit rate is controlled by bit time– 1 MBaud 1 s/bit– 250 KBaud 4s/bit
• Bit time is controlled by– Time Quanta (TQ)
– Bit segment settings (no. of TQ per bit)– Bit Time = TQ * (Sync_Seg + Prop_Seg + Phase_Seg1 + Phase_Seg2)
January 9, 2008 BAE 5030-363
Bit Timing
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
Propagation segment
• Twice the sum of Driver, cable , and comparator delay (See Microchip AN754)
• Propagation delay of cable– Typically 60-70% of c for 120 Ohm cables– Example:
• Driver/Comparator delays – See datasheet– 50 ns
LC
1
tprop = 2 (⋅ tcmp + tbus + tdrv)
Nominal Velocity Velocity, Light Velocity, cable delay per meter Bus Length Bus delay(%) (m/s) (m/s) (s) (m) (ns)
n c v = nc t = 1/v l d = 2lt60% 3.00E+08 1.80E+08 5.56E-09 40 2.22E+02
January 9, 2008 BAE 5030-363
Error handling
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
Collaborative Error Frame Generation
• Error Frames are generated for any error detected by a CAN protocol controller
• CAN protocol controller responds with an error echo if another node generates an error frame
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
CRC errors
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
Acknowledge Errors
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
Form Errors
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
Stuff Errors
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
Bit Errors
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
System Fault Confinement
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
System Fault Confinement
Microchip CAN Seminar, 2006
January 9, 2008 BAE 5030-363
System Fault Confinement
Microchip CAN Seminar, 2006
top related