You are on page 1of 99

Measuring and Debugging CAN and CAN FD

With an Oscilloscope
CAN History and
Message Structure
CAN Bus Historical Timeline

1983: CAN standard (Controller Area Network) developed by Bosch


1987: First working CAN chip
1991: Mercedes implements CAN in S-model
1993: 1 Mb/s CAN is defined (ISO standard 11898)
2002: Teledyne LeCroy invents real time eye patterns for the scope industry
2004: Teledyne LeCroy invents serial data trigger and decode for the scope industry
2004: Teledyne LeCroy introduces world’s first CAN bus trigger and decode on an
oscilloscope
2004: Teledyne LeCroy implements world’s first CAN-specific measurement
parameters on an oscilloscope
2005: Teledyne LeCroy invents symbolic decoding for the scope industry
2011: CAN FD developed by Bosch

CAN = Controller Area Network


CAN FD = Controller Area Network with Flexible Data-rate
Reason for Differential Signaling

(D+) 1V

(D-) 1V

(D+) – (D-)
Common mode noise removed
Differential Signaling - CAN High and CAN Low

CAN bus uses two dedicated wires for communication. The wires are called CAN high and CAN low. When
the CAN bus is in idle mode, both lines carry 2.5V. When data bits are being transmitted, the CAN high line
increases to 3.75V and the CAN low decreases to 1.25V, resulting in a 2.5V differential between the lines.
Since communication relies on a voltage differential between the two bus lines, CAN bus is less susceptible
to inductive spikes, electrical fields and other noise.

Source: http://www.axiomatic.com/whatiscan.pdf

CAN bus can transmit 250


meters using a baud rate of 250
kbit/s. The maximum bus length
with a bit rate of 10 kbit/s is 1
km, and the shortest with 1
Mbit/s is 40 meters.
CAN Standard Data Frame

CAN standard message structure

CAN FD message structure


CAN Decode
CAN High and CAN Low captured on oscilloscope
Differential CAN signal – using math operator or differential probe
CAN Waveform
CAN Waveform with Hexidecimal Decode
CAN Waveform with Symbolic Decode
Bit Stuffing Prevents DC Bus Bias (prevent transceiver PLL from losing lock)

Whenever there are 5 consecutive bits of the same polarity, a stuff bit
of opposite polarity is inserted into the CAN message
CAN bus decode with and without stuff bits highlighted
CAN Standard and CAN-FD Decoded together on DUT which produces both
CAN Standard and CAN-FD Decoded together on DUT which produces both
Symbolic decode example
Setup for decoding multiple CAN busses
Decoding multiple CAN busses
Multi-bus decode example with SPI, I2C, and UART data traffic
CAN Decode Filtering
Searching for CAN criteria
Searching for CAN ID
CAN Decode Filtering
CAN Decode Filtering
Triggering
Triggering on CAN ID
Triggering on CAN ID + Data
Exclusion and Inclusion Triggering
Configuring Symbolic Trigger
Error Detection
ACK error captured amongst good CAN frames
CRC error captured amongst good CAN frames
Sequential Capture of CAN
Sequential capture of errors only
Time stamps of captured errors
Time stamps of captured errors
All CAN messages captured are Engine messages
CAN Measurements
CAN bus measurements
CAN-to-CAN measurement configuration across two busses
CAN-to-CAN measurement configuration across two busses
CAN-to-CAN measurement configuration across two busses
Measurement between CAN message and analog signal
Measurement between CAN message and analog signal
Measurement between CAN message and analog signal
Measurement between CAN message and analog signal
CAN message timing setup
CAN message timing setup
Counting All CAN messages
Counting Engine messages
Counting 0x410 Messages
Data log of 0x410 count
CAN load percentage of all CAN IDs
CAN load percentage of ID 0x210
Statistical analysis of load percentage
CAN Digital to Waveform Synthesis
Tracking and Trending CAN-to-Value
CAN FD Counter Circuit Data
Identifying CAN FD Counter Circuit Reset
Trending Temperature Sensor Data (Digitally Encoded)

CAN encoded data

Decoded temperatures
trended and histogrammed

Thermocouples
Trending Temperature Sensor Data (Digitally Encoded)

CAN encoded messages includes thermocouple temperature data


Decoded thermocouple temperature statistical distribution

Zoom of one CAN message shows both


thermocouple digital temperature recordings

Decoded thermocouple temperature values are trended

Data table (CAN message zoomed


values are highlighted)
Trending Motion Sensor Data (Digitally Encoded)

Decoded XYZ acceleration


values are digitally
extracted and trended
CAN encoded data

Accelerometer
Trending Motion Sensor Data (Digitally Encoded)

CAN encoded messages includes accelerometer data payload

Decoded XYZ acceleration digitally


extracted and trended
Zoom of one CAN message shows X, Y, and Z acceleration

Accelerometer data zoomed


CAN Steering Angle Extraction
Setup for extracting CAN values
Setup for extracting CAN values
Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9
Period Period Period Period Period Period Period Period Period

2.001 ns 2.004 ns 1.991 ns 2.001 ns 1.999 ns 1.995 ns 2.008 ns 1.986 ns 2.001 ns


Voltage

Time Input Waveform

2.008 ns
2.004 ns
2.001 ns 2.001 ns 2.001 ns
1.999 ns
1.995 ns
1.991 ns
Period 1.986 ns

Time

Parameter Tracking Function


Eye Diagrams
What Is A Unit Interval?
What is an Eye Pattern?
Traditional Method
For Eye Pattern Formation
Continuous Bit Eye Pattern Rendering - Real Time Eye

Block of continuous
serial data acquired

Bits are separated


using software
clock recovery

Overlapped bits form the eye pattern


Continuous Bit Eye Pattern Rendering - Real Time Eye

NRZ data record acquired


1 from a single trigger

Clock recovered using


2 software PLL
ZERO CDR JITTER
Data record divided into 1 UI

Slice 10

Slice 12
Slice 11
Slice 1
Slice 2
Slice 3
Slice 4
Slice 5
Slice 6
Slice 7
Slice 8
Slice 9
3 segments equal to recovered
clock period

Segments overlayed to form


4 eye pattern
ZERO TRIGGER JITTER
1. This method is immune to trigger jitter because data is aligned with the unit interval, not the trigger.
2. Multiple acquisitions (multiple triggers) can be used and still no trigger jitter will be introduced
because data from those acquisitions are not combined using a trigger point reference.
CAN Eye Pattern
CAN Eye Pattern of two CAN busses
CAN Eye Pattern showing bus collision on a single CAN bus
CAN FD Plugfest – connecting multiple CAN devices to CAN network
CAN FD Debug discussion of results
CAN FD eye pattern
CAN FD Stuff Bit Error
CAN FD eye pattern is distorted. This is due to varying data bit periods (verified by
track of negative width of repeated 0x22 pattern)
The trailing bits of the CAN FD message have an amplitude value which is too high
(shown in the CAN FD eye pattern)
CAN FD probe connectivity to DB9
Recommended Sample Rate for
CAN Decode and Measurements
Analog Bandwidth: maximum signal frequency that can be input into the scope with no more than -3dB attenuation
Analog Bandwidth

All oscilloscopes and probes are specified


with an analog bandwidth

Analog bandwidth is the frequency at which


1
Bode Plot the ratio of the amplitude displayed on the
V OUT
.707 scope to the input amplitude is -3dB or .707
V IN

FREQUENCY f0
Analog Bandwidth
Example 1: A 3 GHz oscilloscope measures a 1 GHz sine wave
1 V input 1 GHz, 1 V sinewave is 1 GHz, 1 V sinewave is
1 input into oscilloscope measured by oscilloscope
.707
V OUT
V IN

FREQUENCY f0

Example 2: A 3 GHz oscilloscope measures a 3 GHz sine wave

3 GHz input 3 GHz, 1 V sinewave is 3 GHz, 0.707 V sinewave is


1 input into oscilloscope measured by oscilloscope
.707
V OUT
V IN

FREQUENCY f0
Fourier Expansion of a Square Wave
1 1
𝑥𝑥 𝑡𝑡 = 𝑠𝑠𝑠𝑠𝑠𝑠𝜔𝜔0 𝑡𝑡 + 𝑠𝑠𝑠𝑠𝑠𝑠3𝜔𝜔0 𝑡𝑡 + 𝑠𝑠𝑠𝑠𝑠𝑠5𝜔𝜔0 𝑡𝑡 + � � �
3 5
Sampling Rate: speed at which the scope can digitize and record the voltage level of an input signal

Analog-to-Digital Acquisition
Converter
Memory Display

A
Amp D
C
Analog Digitized
Waveform Waveform Processing

Trigger Circuit

A
D
C
Analog-to-Digital
Analog Waveform Converter Digitized Waveform
Nyquist: Sample Rate Needs to be 2x Frequency in Waveform (For Signal Integrity)
Sample Rate and Memory are Related

Long memory record: Capture more data at higher sample rate

Short memory record: Capture less data at higher sample rate

Short memory record: Capture more data at lower sample rate


How Many Seconds of CAN bus data can be captured?

Memory (S)
Sample Rate (S/s) =
Time (s)

Therefore,

Memory (S)
Time (s) =
Sample Rate (S/s)
Sample rate reduced to 4 sample points per bit (e.g. set 500 kS/s on 125 kb/s CAN) for decode,
maximizes time capture window
125 kb/s CAN sampled at 500 kS/s for 500 seconds (8.33 minutes)
190552 CAN messages captured in a single acquisition
Oscilloscope Display and Memory

100 pts at 500 ps/div

 100 Mpts   8" display   1 foot   1 mile  126.26 display miles


  •   •   •   =
 acquisitio n   100 pts   12"   5280 feet  acquisition

100 Mpts of memory is equivalent to 126


miles of oscilloscope display

95
Symbolic Decode for 8.33 seconds (190552 messages)
Sample Rate impact on 125 kb/s CAN bus data rate
10 GS/s scope sample rate
Sample rate / data rate = 80,000:1
Measured risetime: 21.19 ns

1 GS/s scope sample rate


Sample rate / data rate = 8,000:1
Measured risetime: 21.12 ns

100 MS/s scope sample rate


Sample rate / data rate = 800:1
Measured risetime: 22.32 ns
5% error

10 MS/s scope sample rate


Sample rate / data rate = 80:1
Measured risetime: <79.98 ns
277% error
CAN Bus Sample Rate Suggestions

Sample at least 1000:1 samples / bit for


CAN bus physical layer measurements
(e.g. rise time, fall time)

Sample at least 100:1 samples / bit for


CAN bus eye patterns

Sample at least 4:1 samples / bit for


CAN bus decode
Questions?

You might also like