can bus lecture 2019 - aalto
TRANSCRIPT
CAN bus lecture 2019
Vehicle sensor data in intelligent
transportation
Jesse Pirhonen 22.11.2019
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
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
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
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
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
Voltage levels
Voltage levels
⢠CAN_H: 2.5V â 3.5V
⢠CAN_L: 1.5V â 2.5V
Voltage difference
⢠0 = 0V (recessive)
⢠1 = 2V (dominant)
Message format
The most interesting part is the ID and DATA sections
Basically all the other sections are handled by the controller
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
đđđđđđ đŁđđđ˘đ = đđđđ đđĄ + đđđđđ â đˇđđđđđđ đŁđđđ˘đ (đđđ¤)
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
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
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
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
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
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)
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)
Captured messages example
Captured messages example
contâd⢠All the messages are captured from
the research vehicle Ford Focus
⢠Still plenty to analyze
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
HS 3
HS 2
MS
HS 1
HS 4
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
Hardware examples for CAN
communicationPEAK systems
⢠https://www.peak-system.com/
Arduino Based solution
⢠http://wiki.seeedstudio.com/CAN-BUS_Shield_V2.0/
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
Books
THE CAR HACKERâS HANDBOOK, Craig Smith
⢠http://opengarages.org/handbook/ebook/
Automotive Mechatronics, BOSCH
⢠https://aalto.finna.fi/Record/alli.695445
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
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)
Q1.CAN communication hardware
(1 point)What kind of hardware does one node in CAN communication include?
Name the purpose also.
Q2. Distributed networks (1 point)
Why we have multiple different buses, instead of just using one?
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?