Controller Area Network (CAN) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other without a host computer. Originally developed by Bosch for automotive applications, CAN-Bus has become a widely adopted communication protocol in automotive, industrial, and embedded systems due to its reliability, real-time performance, and fault tolerance.
Overview
CAN-Bus features:
Multi-master, multi-drop serial communication protocol
Message-based communication (not address-based)
Built-in error detection and fault confinement
Real-time capabilities with deterministic latency
High noise immunity and fault tolerance
Automatic retransmission of corrupted messages
Priority-based message arbitration
Operating speeds from 10 kbps to 1 Mbps
Network length up to 1000m at lower speeds
Support for up to 110 nodes (practical limit ~64 nodes)
CAN-Bus Physical Layer
Bus Topology
CAN networks use a linear bus topology with termination resistors at both ends:
Unterminated network: Results in signal reflections and errors
CAN Frame Format
Standard CAN Frame (CAN 2.0A) - 11-bit Identifier
SOF Identifier RTR IDE r0 DLC Data Field CRC CRC ACK ACK EOF IFS
β ββ11 bitsββ β β β β4bitsβ ββ0 to 64 bitsββ β15bitsβ DEL β DEL β7bitsβ
β β β β β β β β
1 ID 0 0 0 Data CRC 0 1 1111111
bit (0-2047) bit bit bit (0-8 bytes) Field bit bit bits
Field Breakdown:
SOF = Start of Frame (1 bit dominant)
ID = Message Identifier (11 bits)
RTR = Remote Transmission Request (0=data, 1=remote)
IDE = Identifier Extension (0=standard, 1=extended)
r0 = Reserved bit (must be 0)
DLC = Data Length Code (4 bits, 0-8 bytes)
Data = Data payload (0-64 bits)
CRC = Cyclic Redundancy Check (15 bits)
CRC_D = CRC Delimiter (1 bit recessive)
ACK = Acknowledge slot (1 bit)
ACK_D = ACK Delimiter (1 bit recessive)
EOF = End of Frame (7 bits recessive)
IFS = Inter Frame Space (3 bits minimum)
Extended CAN Frame (CAN 2.0B) - 29-bit Identifier
SOF Base ID SRR IDE Extended ID RTR r1 r0 DLC Data Field CRC CRC ACK ACK EOF
β β11bitsβ β β βββ18 bitsββββ β β β β4bβ β0 to 64 bitsβ β15bβ DEL β DEL β7bβ
1 ID 1 1 ID 0 0 0 Data CRC 0 1 1 1111111
Extended Frame Additional Fields:
SRR = Substitute Remote Request (1 bit recessive)
IDE = Identifier Extension (1=extended frame)
Ext_ID = Extended Identifier (18 bits)
r1 = Reserved bit (must be 0)
Message Types
Data Frame
Purpose: Transmit data from sender to receivers
RTR bit: 0 (dominant)
Data field: 0-8 bytes of payload data
Most common: Regular communication messages
Remote Frame
Purpose: Request data from specific node
RTR bit: 1 (recessive)
Data field: Empty (DLC indicates requested data length)
Response: Node responds with corresponding data frame
Error Frame
Purpose: Signal detection of bus errors
Structure: Error flag (6 bits) + Error delimiter (8 bits)
Transmission: Any node detecting error
Effect: Destroys current message, forces retransmission
Overload Frame
Purpose: Provide extra delay between frames
Structure: Similar to error frame
Usage: Node needs more time to process messages
Message Arbitration and Priority
Priority System
Lower identifier = Higher priority
Bitwise arbitration: Dominant bits (0) win over recessive bits (1)
Non-destructive: Losing nodes automatically become receivers
Arbitration Process
Time Node A (ID=0x123) Node B (ID=0x124) Node C (ID=0x200) Bus State
t0 Starts transmission Starts transmission Starts transmission
t1 Sends 0 (dominant) Sends 0 (dominant) Sends 0 (dominant) 0
t2 Sends 0 (dominant) Sends 0 (dominant) Sends 0 (dominant) 0
t3 Sends 0 (dominant) Sends 0 (dominant) Sends 1 (recessive) 0
t3+ Continues Continues Stops (lost arbit.)
t4 Sends 1 (recessive) Sends 0 (dominant) Silent 0
t4+ Stops (lost arbit.) Continues Silent
Result: Node B wins arbitration and transmits message
Explanation:
- All nodes start simultaneously
- Node C loses at bit 3 (sends 1, but bus shows 0)
- Node A loses at bit 4 (sends 1, but Node B sends 0)
- Node B has lowest ID, wins arbitration
Transmission: Must wait 8 bit times before retransmission
Bus Off State
No communication: Cannot transmit or receive
Error counter: TEC β₯ 256
Recovery: Automatic after 128 occurrences of 11 recessive bits
Manual intervention: May require application reset
Error Counter Rules
Transmit Error Counter (TEC) Rules:
- Increment by 8 for each error during transmission
- Increment by 1 for each error during reception
- Decrement by 1 for each successful transmission
- Set to 0 when bus off recovery completes
Receive Error Counter (REC) Rules:
- Increment by 1 for each error during reception
- Increment by 8 if node transmits error frame during reception
- Decrement by 1 for each successful reception (if >127)
- Stays at 0-127 range during error active state
CAN Baud Rates and Timing
Standard Baud Rates
Baud Rate
Max Bus Length
Typical Applications
1 Mbps
25m
High-speed automotive networks
500 kbps
100m
Automotive powertrain, chassis
250 kbps
250m
Industrial automation
125 kbps
500m
Body electronics, comfort systems
100 kbps
600m
Industrial networks
50 kbps
1000m
Long-distance industrial
20 kbps
2500m
Building automation
10 kbps
5000m
Very long distance applications
Bit Timing Parameters
CAN Bit Time Structure:
Sync_Seg Prop_Seg Phase_Seg1 Phase_Seg2
β β β β
βββ1TQβββββ1-8TQβββββ1-8TQβββββ2-8TQβββ
β β β β β
Sync Propagation Phase Phase
Segment Delay Buffer1 Buffer2
β β β
ββββββSample Pointβββββ΄ββββββββββ
Parameters:
- Sync_Seg: 1 Time Quantum (TQ) - synchronization
- Prop_Seg: 1-8 TQ - signal propagation delay
- Phase_Seg1: 1-8 TQ - phase buffer before sample point
- Phase_Seg2: 2-8 TQ - phase buffer after sample point
- Sample Point: Typically at 87.5% of bit time
- Total Bit Time: Sync_Seg + Prop_Seg + Phase_Seg1 + Phase_Seg2
Timing Configuration Example (500 kbps)
System Clock: 16 MHz
Desired Baud Rate: 500 kbps
Bit Time: 2 ΞΌs (1/500k)
Time Quantum (TQ) = System Clock / (BRP Γ (1 + Prop_Seg + Phase_Seg1 + Phase_Seg2))
Example Configuration:
BRP (Baud Rate Prescaler): 2
Sync_Seg: 1 TQ
Prop_Seg: 2 TQ
Phase_Seg1: 3 TQ
Phase_Seg2: 2 TQ
Total TQ: 8
TQ = 16MHz / (2 Γ 8) = 1MHz β 1ΞΌs per TQ
Bit Time = 8 Γ 1ΞΌs = 8ΞΌs? No, this gives 125kbps
Correct Calculation:
BRP = 4, Total TQ = 8
TQ = 16MHz / 4 = 4MHz β 0.25ΞΌs per TQ
Bit Time = 8 Γ 0.25ΞΌs = 2ΞΌs = 500kbps β
[Node1]
β
β
[Node4]ββββββββ[CAN Hub]ββββββββ[Node2]
β
β
[Node3]
Advantages: Centralized control, easier diagnostics
Disadvantages: Single point of failure, more complex
CAN Transceiver ICs
Popular CAN Transceivers
Part Number
Manufacturer
Speed
Features
MCP2551
Microchip
1 Mbps
Industry standard
TJA1050
NXP
1 Mbps
Automotive qualified
SN65HVD230
Texas Instruments
1 Mbps
3.3V operation
ISO1050
Texas Instruments
1 Mbps
Galvanic isolation
MCP2562
Microchip
1 Mbps
Fault protection
Transceiver Pin Configuration (MCP2551 Example)
MCP2551 Pinout (8-pin DIP/SOIC):
βββββββ
TxD β1 8β VDD (+5V)
VSS β2 7β CANH
VRef β3 6β CANL
RxD β4 5β Rs
βββββββ
Pin Functions:
1. TxD: Transmit Data Input (from microcontroller)
2. VSS: Ground
3. VRef: Reference voltage output (VDD/2)
4. RxD: Receive Data Output (to microcontroller)
5. Rs: Slope control (normal/standby mode)
6. CANL: CAN Low bus line
7. CANH: CAN High bus line
8. VDD: Power supply (+5V)
Increased payload: Up to 64 bytes per frame (vs 8 bytes)
Variable data rate: Faster transmission in data phase
Improved CRC: Enhanced error detection
Backward compatibility: Coexists with classic CAN
CAN-FD Frame Format
Arbitration Phase (Classic CAN speed):
SOFβIDβRTRβIDEβFDFβr0βBRSβESIβDLCβ
Data Phase (Higher speed):
Data Field (up to 64 bytes)
CRC Phase (Classic CAN speed):
CRCβDELβACKβDELβEOF
New Bits:
FDF = FD Format (1 = CAN-FD frame)
BRS = Bit Rate Switch (1 = switch to fast data rate)
ESI = Error State Indicator
Current consumption: Termination and transceiver limits
Grounding and EMI
Grounding Strategy
Proper CAN Network Grounding:
Power Supply Ground βββ¬ββ Node 1 Ground
βββ Node 2 Ground
βββ Node 3 Ground
βββ Shield Ground (one point only)
Guidelines:
- Single point grounding preferred
- Avoid ground loops
- Shield connection at one end only
- Separate digital and analog grounds in nodes
EMI Mitigation
Twisted pair cables: Reduces radiated emissions
Shielding: Prevents interference pickup
Ferrite cores: Suppress common-mode noise
Proper PCB layout: Ground planes, trace routing
Isolation: Galvanic isolation in harsh environments