The CAN Subsystem of the Linux Kernel
A
Linux CAN driver
swiss army knife for automotive use-cases
Presentation for Automotive Grade Linux F2F, 2017-04-04, Microchip (Karlsruhe)
SocketCAN – concepts & usage
Controller Area Network simplified for nerds
• Media access by CSMA/CR
• Structure of a CAN frame:
S
O
F
CAN-ID
(11/29 Bit)
R I r
T D e
R E s
DLC
(4 Bit)
(0-8 Byte)
DATA
Checksum
(15 Bit)
D
E
L
A
C
K
D
E
L
EOF
(7 Bit)
Arbitration
Control
Data
Check
Acknowledge
• Simplified:
[CAN Identifier]
[Data length]
[Data 0..8]
• Content addressing (by CAN Identifier & CAN Bus)
• No MAC / Node addresses / ARP / Routing – just plain OSI Layer 2
• Incompatible Upgrade CAN FD (ISO 11898-1:2015), explained later
Oliver Hartkopp
SocketCAN – concepts & usage
Application areas for the Controller Area Network
•
•
•
•
•
•
•
•
•
Industrial control applications (e.g. using the CANopen protocol)
Food processing (e.g. on fish trawlers)
Vehicles (Passenger
Cars,
Trucks, Fork lifters, etc.)
Research (e.g. Nuclear physics)
Spacecrafts, Marina
Oil platforms
Wind energy plants
Measurement / Sensors
Special Effects
Oliver Hartkopp
SocketCAN – concepts & usage
Usage of the CAN bus in a vehicle
• Simple CAN broadcast messages
• Cyclic sent CAN messages
(for failure detection)
• Multiplex CAN messages
(containing an index for different data payload)
• Transport protocols
(virtual point-to-point connection via CAN, e.g. ISO-TP: ISO 15765-2)
Oliver Hartkopp
SocketCAN – concepts & usage
The former concepts for CAN access
application
protocol
• Only one application can use the CAN bus at a time
• There was no standard Linux CAN driver model
• Every CAN hardware vendor sells his own driver
bundled to his CAN hardware
•
The change to a different CAN hardware vendor
urges the adaptation of the CAN application(!)
=> Vendor Lock-In
• CAN application protocols and intelligent content
filters need to be implemented in userspace
Operating system
CAN controller
Oliver Hartkopp
CAN driver
评论