CAN Bus Explained - A Simple Intro [2023] – CSS Electronics
CAN Bus Explained - A Simple Intro [2023] – CSS Electronics
Contact
▶a simple intro to
CAN
Need a simple, practical intro to CAN bus?
In this tutorial we explain the Controller Area Network (CAN bus) 'for dummies' incl. message interpretation, CAN logging - and the
link to OBD2, J1939 and CANopen.
Read on to learn why this has become the #1 guide on CAN bus.
You can also view our CAN protocol intro above or get the PDF.
In this article
1. What is CAN bus?
2. Top 4 benefits of the CAN protocol
3. CAN history & future
4. What is a CAN frame?
5. CAN logging use cases
6. How to log CAN data
7. How to decode CAN data
8. CAN vs. J1939, OBD2 & CANopen
Download as PDF
The Controller Area Network (CAN bus) is the nervous system, enabling communication.
In turn, 'nodes' or 'electronic control units' (ECUs) are like parts of the body, interconnected via the CAN bus. Information sensed by
one part can be shared with another.
So what is an ECU?
In an automotive CAN bus system, ECUs can e.g. be the engine control unit, airbags, audio system etc. A modern car may have up to
70 ECUs - and each of them may have information that needs to be shared with other parts of the network.
CAN High
CAN Low
CAN Low
CAN High
The CAN bus system enables each ECU to communicate with all other ECUs - without complex dedicated wiring.
Specifically, an ECU can prepare and broadcast information (e.g. sensor data) via the CAN bus (consisting of two wires, CAN low and
CAN high). The broadcasted data is accepted by all other ECUs on the CAN network - and each ECU can then check the data and
decide whether to receive or ignore it.
The CAN bus physical layer defines things like cable types, electrical signal levels, node requirements, cable impedance etc. For
example, ISO 11898-2 dictates a number of things, including below:
Baud rate: CAN nodes must be connected via a two wire bus with baud rates up to 1 Mbit/s (Classical CAN) or 5 Mbit/s (CAN FD)
Cable length: Maximal CAN cable lengths should be between 500 meters (125 kbit/s) and 40 meters (1 Mbit/s)
Termination: The CAN bus must be properly terminated using a 120 Ohms CAN bus termination resistor at each end of the bus
7 layer OSI model
Application
Easy access
The CAN bus provides 'one point-of-entry' to communicate with all network ECUs - enabling central diagnostics, data logging and
configuration
Extremely robust
The system is robust towards electric disturbances and electromagnetic interference - ideal for safety critical applications (e.g.
vehicles)
Efficient
CAN frames are prioritized by ID so that top priority data gets immediate bus access, without causing interruption of other frames or
CAN errors
Today, CAN is standard in automotives (cars, trucks, buses, tractors, ...), ships, planes, EV batteries, machinery and more.
Bosch launches CAN is standardized CAN FD is standardized Start of CAN XL
the CAN protocol (ISO 11898) (ISO 11898-1) development
CAN ISO
11898 CAN FD ISO
11898-1 CAN XL
1986 1993 2015 2018
Bosch publishes CAN 2.0 Separation of data link Physical CAN layer for
(CAN 2.0A, CAN2.0B) and physical layer data-rates up to 5 Mbit/s
In particular, the rise in connected vehicles (V2X) and cloud will lead to a rapid growth in vehicle telematics and IoT CAN loggers.
In turn, bringing the CAN bus network 'online' also exposes vehicles to security risks - and may require a shift to new CAN protocols
like CAN FD.
Below is a standard CAN frame with 11 bits identifier (CAN 2.0A), which is the type used in most cars. The extended 29-bit identifier
frame (CAN 2.0B) is identical except the longer ID. It is e.g. used in the J1939 protocol for heavy-duty vehicles.
Note that the CAN ID and Data are highlighted - these are important when recording CAN bus data, as we'll see below.
1 11 1 6 0-64 16 2 7
#bits
SOF: The Start of Frame is a 'dominant 0' to tell the other nodes that a CAN node intends to talk
ID: The ID is the frame identifier - lower values have higher priority
RTR: The Remote Transmission Request indicates whether a node sends data or requests dedicated data from another node
Control: The Control contains the Identifier Extension Bit (IDE) which is a 'dominant 0' for 11-bit. It also contains the 4 bit Data
Length Code (DLC) that specifies the length of the data bytes to be transmitted (0 to 8 bytes)
Data: The Data contains the data bytes aka payload, which includes CAN signals that can be extracted and decoded for
information
CRC: The Cyclic Redundancy Check is used to ensure data integrity
ACK: The ACK slot indicates if the node has acknowledged and received the data correctly
EOF: The EOF marks the end of the CAN frame
The CAN frame has to satisfy a number of properties to be valid. If an erroneous CAN frame is transmitted, CAN nodes will
automatically detect this and take action accordingly. This is referred to as CAN bus error handling, in which CAN nodes keep track
of their own 'CAN error counters' and change state (active, passive, bus off) depending on their counters. The ability of problematic
CAN nodes to transmit data is thus gracefully reduced to avoid further CAN errors and bus jamming. For details, see our intro to
CAN bus error handling.
obd2 logging →
j1939 telematics →
Predictive maintenance
Vehicles and machinery can be monitored via IoT CAN loggers in the cloud to predict and avoid breakdowns
predictive maintenance →
Vehicle/machine blackbox
A CAN logger can serve as a 'blackbox' for vehicles or equipment, providing data for e.g. disputes or diagnostics
Do you have a CAN logging use case? Reach out for free sparring!
contact us →
To record CAN data you need a CAN logger. This lets you log timestamped CAN data to an SD card. In some cases, you need a CAN
interface to stream data to a PC - e.g. for car hacking.
Further, the CANedge2 adds WiFi, letting you auto-transfer data to your own server - and update devices over-the-air.
To interpret it, you need to decode the CAN frames into scaled engineering values aka physical values (km/h, degC, ...).
For example, the CAN standard does not specify how to handle messages larger than 8 bytes - or how to decode the raw data.
Therefore a set of standardized protocols exist to further specify how data is communicated between CAN nodes of a given network.
Some of the most common standards include SAE J1939, OBD2 and CANopen. Further, these higher-layer protocols will increasingly be
based on the 'next generation' of CAN, CAN FD (e.g. CANopen FD and J1939-17/22).
a simple intro to
J1939
SAE J1939
J1939 is the standard in-vehicle network for heavy-duty vehicles (e.g. trucks & buses). J1939 parameters (e.g. RPM, speed, ...) are
identified by a suspect parameter number (SPN), which are grouped in parameter groups identified by a PG number (PGN).
j1939 intro →
j1939 telematics →
a simple intro to
OBD2
OBD2
On-board diagnostics (OBD, ISO 15765) is a self-diagnostic and reporting capability that e.g. mechanics use to identify car issues.
OBD2 specifies diagnostic trouble codes (DTCs) and real-time data (e.g. speed, RPM), which can be recorded via OBD2 loggers.
obd2 intro →
obd2 logging →
a simple intro to
CANopen
CANopen
CANopen is used widely in embedded control applications, incl. e.g. industrial automation. It is based on CAN, meaning that a CAN
bus data logger is also able to log CANopen data. This is key in e.g. machine diagnostics or optimizing production.
canopen intro →
canopen logger →
a simple intro to
CAN FD
CAN FD
CAN bus with flexible data-rate (CAN FD) is an extension of the Classical CAN data link layer. It increases the payload from 8 to 64
bytes and allows for a higher data bit rate, dependent on the CAN transceiver. This enables increasingly data-intensive use cases like
EVs.
can fd intro →
can fd logger →
J1939
logger
CANedge
J1939 DATA LOGGER - SIMPLE TELEMATICS
OBD2
logger
CANedge/CLX000
OBD2 DATA LOGGER - LOG VEHICLE DATA EASILY
CANopen
logger
CANedge
CANOPEN DATA ANALYZER - EASILY ANALYZE MACHINES
Contact
[email protected]
+45 91 25 25 63
Terms of Service
Privacy Policy
About Us
Newsletter