CAN Bus Explained - A Simple Intro
This guide provides an introduction to the Controller Area Network (CAN bus), covering its components, benefits, history, and how to log and decode data.
Table of Contents
- What is CAN bus?
- Top 4 Benefits of CAN Protocol
- CAN History & Future
- CAN OSI Model
- What is a CAN Frame?
- CAN Higher-Layer Protocols
- How to Log CAN Data
- How to Decode CAN Data
What is CAN bus?
- Purpose: Allows ECUs (Electronic Control Units) within vehicles to communicate without a host computer.
- Analogy: Functions like a nervous system with ECUs as body parts.
- Physical Connection: Uses a two-wire system (CAN high and CAN low).
What is an ECU?
- Controls vehicle functions like engine, transmission, brakes, etc.
- Consists of a microcontroller, CAN controller, and CAN transceiver.
CAN bus Variants
- Low-speed CAN: Fault-tolerant, being replaced by LIN bus.
- High-speed CAN: Most common, focus of this guide.
- CAN FD: Longer payloads, faster speed.
- CAN XL: Bridges gap to Automotive Ethernet.
Top 4 Benefits
- Simple & Low Cost: Reduces wiring complexity, weight, and cost.
- Easy Access: Centralized diagnostics and data logging.
- Extremely Robust: Resistant to EMI and supports error detection.
- Efficient: Prioritizes frames by ID for bus access.
CAN History & Future
- Developed by Bosch in 1986, standardized in 1993.
- Future trends include higher data rates, connected vehicles, and open vs. proprietary data handling.
CAN OSI Model
- CAN bus is described by data link layer (ISO 11898-1) and physical layer (ISO 11898-2).
- Represents the two lowest layers in the OSI model.
What is a CAN Frame?
- Communication occurs via CAN frames.
- Components: SOF, ID, RTR, Control, Data, CRC, ACK, EOF.
- Four frame types: Data frame, Error frame, Remote frame, Overload frame.
CAN Higher-Layer Protocols
- Provide additional structure for communication beyond basic CAN.
- Examples: OBD2, UDS, CCP/XCP, CANopen, SAE J1939, NMEA 2000, ISOBUS.
How to Log CAN Data
- Select Hardware: Choose between CAN-to-USB, CAN-to-SD, or CAN-to-cloud.
- Identify Adapter Cable: Options include OBD2, J1939, M12, contactless.
- Configure Device: Match baud-rate, configure request messages.
- Review Raw Data: Analyze data with tools like asammdf.
How to Decode CAN Data
- Understand Signal Extraction: Requires byte order, bit start/length, offset, scale.
- Get a DBC File: Necessary for decoding; can be obtained from OEMs or reverse engineering.
- Use Software/API: Tools like asammdf GUI, MATLAB, Python for analysis.
Use Cases
- Logging/streaming from cars, heavy-duty fleet telematics, predictive maintenance, and blackbox logging.
For more detailed exploration, consider downloading the 'Ultimate CAN Guide' PDF.