CAN Bus Sahit Bollineni Artem Dudkov Steven Ma

advertisement
CAN Bus
Sahit Bollineni
Artem Dudkov
Steven Ma
1
What is a CAN Bus?
•
Controller Area Network
•
Message based protocol
•
Serial bus
•
Vehicle bus standard
•
Allow microcontrollers and devices to communicate
2
Brief History
•
Developed by Robert Bosch GmbH in 1983 to be used in passenger cars
•
Official release in 1986 at the Society of Automotive Engineers (SAE) congress
•
CANopen created in 1993 by Bosch
•
Smart Distributed Systems (SDS) created by Cincinnati Milacron in the 1990s
•
Constantly updated
•
Current version CAN FD is released in 2012
3
What is CAN used for?
Developed for passenger cars
First used in Europe for textile and other machine work
http://criader.com/1993-bmw-8-series/
Used as fieldbus in automation environments due to low cost
First car used it was the BMW 850 coupe
Wiring in the car reduced so much it weighed 100 pounds less
Designed to control everything in cars from engine control unit to mirror adjustment
4
Benefits of CAN
•
Reduced wiring (light weight)
•
Asynchronous
•
Fast speed/Data rates
•
Multimaster multidrop
•
Noise tolerant
•
Priority arbitration
•
http://www.ni.com/white-paper/2732/en/
Reliability
5
How Does CAN Bus Work?
• CAN architecture
• ISO 11898-2
• ISO 11898-3
• Can Node
• Open-collector schema
• ID allocation
• CAN Frames
• Bit timing
6
CAN Bus Architecture
• High speed CAN ISO 11898-2
• From 10kbits/sec to 1Mbits/sec
• Linear bus
• 120Ω terminal resistance
• Runs from one end of the environment to the other
• Used in automotive industry
• Low speed CAN (fault tolerant) ISO 11898-3
• Restricted to 125kbps
• Star bus
• ≥ 100Ω overall terminal resistance
• Used to combine nodes together
https://en.wikipedia.org/wiki/CAN_bus
7
CAN Bus Nodes
CPU, Microcontroller or Microprocessor
Controls the data flow
Other devices can be connected it
CAN Controller
Receiving: stores the message to be fetched by CPU
Transmitting: sends bits serially onto the bus
http://www.embedded.com/electronicsblogs/murphy-s-law/4024614/A-short-trip-on-theCAN-bus
CAN Transceiver
Receiving: converts the data stream from CAN bus levels to levels that the CAN controller uses
Transmitting: converts the data stream from the CAN controller to CANbus levels
Contains protective circuitry for CAN controller
8
CAN Speed Class Ratings
Low-speed: 10Kbps
Class A:
Power mirrors, seats, windows, door locks, lights
From 10Kbps to 125Kbps (SAE J1850 or Europe's ISO 9141-2)
Class B:
Instrumentation, Transmission control, Climate control, Security
Up to 1 Mbps (typically 500 Kbps)
Class C:
Powertrain, air-bag, ABS, stability control modules
Over 8 Mbps
Class D:
Up-coming
9
Open-Collector
Common solution to shared wires
Simple to implement
Always takes 0 over 1
Hard to fry
High power consumption, due to
constant current from Vdd to GDN
https://en.wikipedia.org/wiki/Open_collector
10
CAN Bus ID Allocation
Each message on the bus must have a unique ID
CAN ID is synonym for Priority
Lower CAN ID == Higher Priority
Open collector implementation
ID is assigned based on the message deadline
Allows up to 80% bus utilization
https://en.wikipedia.org/wiki/CAN_bus
11
CAN Arbitration vs I2C Arbitration
I2C
https://blog.digilentinc.com/index.php/i2c-how-does-it-work/
CAN
http://canbus.pl/index.php?id=4&lang=en
12
CAN Frames
● Data Frame - Frame for actual data transmission
○ General form of sending data onto bus
● Remote Frame - Used by a destination node to request data from a source
○ RTR bit = 1 (Recessive)
○ No Data Field
● Error Frame - Frame transmitted by a node detecting an error
○ Retransmit the message
● Overload Frame - Used to inject a delay between frames
○ Internal conditions of a receiver, which requires a delay of the next data frame or remote
frame
13
CAN Frame Format
http://hem.bredband.net/stafni/developer/CAN.htm
14
Data Transmission
https://en.wikipedia.org/wiki/CAN_bus
15
Bit Timings
https://en.wikipedia.org/wiki/CAN_bus
16
Bit Stuffing
17
https://en.wikipedia.org/wiki/CAN_bus
In Summary
Reduce wires, reduce weight
Reliable
○ Failure of one module does not usually stop the whole bus
Efficient for small networks
Flexible
○ Easy to add and remove modules
Easy to debug
○ Easy access underneath the steering column
○ Cheap bus analyzing tools, starting at $30
○ Open diagnostic codes
18
CAN devices
~$2 CAN Transceiver
http://www.mouser.com/ProductDetail/Microchip/MCP2551-IP/?qs=8g3RLJaa2Uis1lC9gEMPXA%3D%3D&gclid=CPHXiPbP0ssCFaoy0wod9dsMfw
~$25 “Pirate BUS” CAN to everything
http://www.digikey.com/product-detail/en/TOL-
09544/1568-1076ND/5230945?WT.mc_id=IQ_7595_G_pla5230945&wt.srch=1&wt.medium=cpc&WT.srch=1&gclid=CNfv
0sbQ0ssCFUO3Gwod_IsIXQ
~$25 CAN shield for Arduino
http://www.amazon.com/CAN-BUS-Shield-Compatib
le-Arduino-Seeeduino/dp/B00NQVH666
19
And on that bombshell, we end our presentation!
Brought to you by:
Sahit Bollineni
Artem Dudkov
Steven Ma
20
References
1. History:
a. http://www.ideasinmotioncontrol.com/2005/06/why-use-a-canbus-network-and-canopencommunication-protocol-for-decentralized-axes-control.html#.VuWTYMfNB6Q
b. http://www.canopen.us/history.htm
c. https://sewelldirect.com/learning-center/canbus-technology
2. Open-collector:
a. Overview of IEEE Standard 91-1984 Explanation of Logic Symbols
b. Horowitz, Paul; Winfield Hill (1989). The Art of Electronics. Cambridge University Press.
3. CAN Frames
a. Controller Area Network (CAN) Overview, National Instruments. http://www.ni.com/whitepaper/2732/en/
4. Can speed:
a. http://www.aa1car.com/library/can_systems.htm
21
Reasons CAN is important
It is EVERYWHERE:
2003: Ford Excursion, Ford F-250 & F-350, Ford Focus & Thunderbird, General Motors Saturn ION, Lincoln LS,
Mazda 6, and SAAB 9-3
2005: Audi A4 & A6, Buick LaCrosse, Rendevous & Ranier, Cadillac STS, Chevrolet Cobalt, Corvette & Malibu,
Chevrolet Equinox, Chevrolet SSR, Chevrolet Trailblazer EXT, Chrysler 300C, Dodge Dakota & Magnum, Ford
Crown Victoria, Five Hundred, Focus & Mustang, Ford E-150, Ford Escape & Expedition, Ford Freestyle, GMC
Envoy ESV & XL, Isuzu Ascender, Jeep Grand Cherokee, Lexus LS400 & GX470, Lincoln Town Car, Mercury Grand
Marquis, Montigo & Sable, Mercury Mariner, Pontiac G6, Grand Prix & GTO, Land Rover LR3, Mazda MPV &
Tribute, Mercedes SLK350, SAAB 9-7X, 2005 Toyota Avalon, Toyota 4Runner, Sequoia, Tacoma & Tundra, and
2005 Volvo S60, S80, V50, V70, XC90
Essentially ALL 2008 and newer model year passenger cars and light trucks
More Cars
2004: Buick Rendezvous, Cadillac CTS, XLR & SRX, Dodge Durango, Ford Explorer, Ford F-150, E-250 & E-350,
Ford Taurus, Lexus LS430, Mercury Mountaineer, Mercury Sable, Mazda 3 & RX-8, Toyota Prius, and Volvo S40
22
CAN vs other Serial Protocols
• Less wiring (only 2 lines)
• Asynchronous, no clock in transaction
• CAN have multiple transaction initiators (masters)
• Resolves Arbitration based on priority
• Noise tolerant
23
Download