can bus lecture 2019 - aalto
TRANSCRIPT
![Page 1: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/1.jpg)
CAN bus lecture 2019
Vehicle sensor data in intelligent
transportation
Jesse Pirhonen 22.11.2019
![Page 2: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/2.jpg)
Controller Area Network
Development of Controller Area Network bus started originally in
1983 at Robert Bosch GmbH
• Developed for automotive applications, now used in various systems
• When ECU numbers started to grow
• Added flexibility in the communication
• Communication speed increase
• Still a serial communication line• Multi-master serial bus
![Page 3: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/3.jpg)
Motivation
• If all communication
between control units
would be done this way
it would be a mess
• Wires for each function and actuator
• Adding a control unit would require a lot of work
![Page 4: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/4.jpg)
ISO-standards
• ISO 11898-1 for the data link layer
• ISO 11898-2 for the CAN physical layer for high-speed CAN
• ISO 11898-3 was released later and covers the CAN physical layer
for low-speed, fault-tolerant CAN
• SAE J1939 Serial Control and Communications Heavy Duty Vehicle
Network
![Page 5: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/5.jpg)
CAN bus speed
Theoretical limit up to 1Mbit/s
• Powertrain usually 500 kbit/s
• Comfort / convenience 125 – 250 kbit/s
Comparison to other networks:
• Ethernet: all the way up to10 Gbit/s (vehicles have been using max 100 Mbit/s)
• MOST (Media Oriented Systems Transport):150Mbit/s (Most150)
• FT CAN : 125 kbit/s
• LIN: 20 kbit/s
![Page 6: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/6.jpg)
Physical layer
Components needed for CAN communication
• Twisted pair cable with termination resistors
• ECUs, including DSP, controller and transceiver
DSP / μC:
• Data handling
• Control
CAN controller:
• Bit level filtering
• Message buffering
CAN transceiver:
• Connection related protection
• Voltage level to voltage
difference for the controller
![Page 7: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/7.jpg)
Voltage levels
Voltage levels
• CAN_H: 2.5V – 3.5V
• CAN_L: 1.5V – 2.5V
Voltage difference
• 0 = 0V (recessive)
• 1 = 2V (dominant)
![Page 8: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/8.jpg)
Message format
The most interesting part is the ID and DATA sections
Basically all the other sections are handled by the controller
![Page 9: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/9.jpg)
Message data meaning
Typical raw message can be hard to read, needs to be converted
into human readable form
A good starting point can be formed with the following formula
𝑆𝑐𝑎𝑙𝑒𝑑 𝑣𝑎𝑙𝑢𝑒 = 𝑂𝑓𝑓𝑠𝑒𝑡 + 𝑆𝑐𝑎𝑙𝑒 ∗ 𝐷𝑒𝑐𝑖𝑚𝑎𝑙 𝑣𝑎𝑙𝑢𝑒 (𝑟𝑎𝑤)
![Page 10: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/10.jpg)
Message meaning example
Message sent with ID: 0x2A includes engine coolant temp, fuel temp
and other temp values (turbo, intercooler, etc.)
The first byte includes the temperature value of the engine
NOTE!
HEX:2A
DEC:42
BIN:101010
ID D1 D2 D3 D4 D5 D6 D7 D8
HEX 2A 18 7B 43 E6 2D 4C 4D B2
DEC 42 24 123 67 230 45 76 77 178
ID D1 D2 D3 D4 D5 D6 D7 D8
DEC 42 24 123 67 230 45 76 77 178
![Page 11: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/11.jpg)
Message meaning example cont’d
ID D1 D2 D3 D4 D5 D6 D7 D8
DEC 42 24 123 67 230 45 76 77 178
• D1 range: 0…255
• Engine coolant
temp range: -40…130
![Page 12: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/12.jpg)
Message meaning example cont’d
ID D1 D2 D3 D4 D5 D6 D7 D8
DEC 42 24 123 67 230 45 76 77 178
• D1 range: 0…255
• Engine coolant
temp range: -40…130
OFFSET
![Page 13: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/13.jpg)
Message meaning example cont’d
ID D1 D2 D3 D4 D5 D6 D7 D8
DEC 42 24 123 67 230 45 76 77 178
• D1 range: 0…255
• Engine coolant
temp range: -40…130
SCALE
The main idea is to map the bit
value to match the, in this case,
the coolant temp value
![Page 14: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/14.jpg)
Another example from heavy
machinery using J1939• DBC Format configuration file
• CAN be found in data loggers
• 29-bit ID’s used in heavy machinery are standardized to some
extent
• Passenger vehicles configurations are still most oftenproprietary
![Page 15: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/15.jpg)
Another example from heavy
machinery using J1939
sender
message name data lenmessage ID
(29-bit identifier)
start bit
size of signal
@1+ → little-endian format
scale offset unit
min and max
1 signal (row)
![Page 16: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/16.jpg)
One full message in DBC file
One messages can include maximum of 8 bytes → 64 bits
1 byte
Message data frame 64 bits (with ID 200)
![Page 17: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/17.jpg)
Captured messages example
![Page 18: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/18.jpg)
Captured messages example
cont’d• All the messages are captured from
the research vehicle Ford Focus
• Still plenty to analyze
![Page 19: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/19.jpg)
Distributed networks
• Modern vehicles can include closer to 100 control units
• All the control units can not be connected to a single network
• Too much information
• Different speed requirements
• Vulnerable
• Multiple networks and control units between the networks are
required
![Page 20: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/20.jpg)
HS 3
HS 2
MS
HS 1
HS 4
![Page 21: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/21.jpg)
Vehicle networks
There are many different
networks
• Purpose of use defines the used network:• Speed
• Robustness
• Real time demand
• Number of control unit / actuators
• Data inside the node
![Page 22: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/22.jpg)
Hardware examples for CAN
communicationPEAK systems
• https://www.peak-system.com/
Arduino Based solution
• http://wiki.seeedstudio.com/CAN-BUS_Shield_V2.0/
![Page 23: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/23.jpg)
Software examples for CAN
communication• SocketCAN / CANutils in Linux (demo after the lecture)
• With a matching hardware provides a solid base for reading, sending and analyzing CAN frames
• Wireshark, supports analysis for other protocols and busses
• Simulink with various add-ons, requires specific hardware
• Arduino IDE, serial monitor
![Page 24: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/24.jpg)
Books
THE CAR HACKER’S HANDBOOK, Craig Smith
• http://opengarages.org/handbook/ebook/
Automotive Mechatronics, BOSCH
• https://aalto.finna.fi/Record/alli.695445
![Page 25: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/25.jpg)
Videos
Kvaser video set about CAN (recap)
• https://www.kvaser.com/course/can-protocol-tutorial/
SocketCAN video tutorial
• https://www.youtube.com/watch?v=Ym8xFGO0llY&t=1068s
![Page 26: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/26.jpg)
Lecture quiz 6 Vehicle
Mechatronics L, MEC-E5006Consider the information you learnt during the lecture. Write down your
answers and use them to answer lecture quiz by Dec 9, 2019 on
MyCourses
Answer the next 3 questions (Q1…Q3)
![Page 27: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/27.jpg)
Q1.CAN communication hardware
(1 point)What kind of hardware does one node in CAN communication include?
Name the purpose also.
![Page 28: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/28.jpg)
Q2. Distributed networks (1 point)
Why we have multiple different buses, instead of just using one?
![Page 29: CAN bus lecture 2019 - Aalto](https://reader034.vdocuments.mx/reader034/viewer/2022042623/6264e61210342f3fe40acd03/html5/thumbnails/29.jpg)
Q3. CAN bus utilization (1 point)
How would you utilize the CAN messages shown in the lecture slides to
come up with an improvement to an already existing system or a new
one in vehicles?