0% found this document useful (0 votes)
15 views

Overview of The CAN Bus Protocol - Embedded - Electronic Compone

how to measure CAN System

Uploaded by

yussuf tijani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Overview of The CAN Bus Protocol - Embedded - Electronic Compone

how to measure CAN System

Uploaded by

yussuf tijani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Do you need support?

You can post your question in the category/sub-category that


aligns with your question. Don’t see a category that fits your needs? We always have
our general Support category available where you can post your question and DigiKey’s
team of technicians and engineers, as well as our community of over 10,000 members
review and respond.

Have a suggestion or comment on our Forum? Stop by the Site Help, Information and
Feedback category and let us know how we can improve the forum.

Overview of the CAN Bus Protocol


tech-tips

kkohlhase Mar 2022

CAN stands for Controller Area Network. This type of communication is inside several
types of systems, the most common is automotive. These systems consists of typically
wired controllers (microprocessors/microcontrollers) that talk to each other. There are
protocols and methods to allow wireless communication, but wired is far more
common. Unlike SPI, I2C, USB, and other similar formats, CAN Bus uses a much
different format for data communication. CAN Bus is based off of differential voltage
levels:

There are two wires used for communication that transmit data at the same time. They
are called CAN Hi (High) and CAN Lo (Low) and have different voltage levels that are
interpreted by each controller (called CAN Nodes). CAN Hi usually measures from 2.5V
to 3.75V while CAN Lo measures from 2.5V to 1.25V. When both lines read 2.5V the
signal is called “Recessive” which would be equivalent to a binary value of 1. When CAN
Skip to main content
Hi goes to 3.75V and CAN Lo goes to 1.25V the signal is called “Dominant” which would
be equivalent to a binary value of 0. Conceptually, this may not make sense when talking
about digital logic where 0 is Low and 1 is High, but the protocol is looking for the 0
values over the 1 values. So the driver logic is inverse from typical digital logic
interpretation.

Basic Wiring Diagram

The wiring has some peculiar aspects that are unique to the protocol. One advantage
CAN Bus has over single wire protocols is the ability of nodes to be disconnected
without other nodes failing. If CAN Hi or CAN Lo was cut to a particular node, the rest of
the system would not care and still send data to the other nodes. Some systems may be
capable of transmitting data along one line if the main one went down, but this depends
on the company (not all systems can work with a down CAN Hi or CAN Lo line).
Performance gets hit on systems that can handle a line being cut though because the
120 ohm resistors have two purposes. They first provide the differential between Hi and
Lo along with matching impedance for systems that have higher frequencies. The
protocol works best with the differential voltages. The crossed wires also have two
purposes (twisted pair). First, they help block EMI emissions from outside sources.
Second, they also help with EMI issues when the protocol transmits with faster
frequencies.

Notice that there are no other lines, this means that packets (messages) are sent to all
nodes at the same time. There is no “address” in a CAN message data frame, but there
are methods in the data frame to determine what is accepted or rejected by each node
along with priority with certain messages defined by the user. The data has to have bits
set in order to avoid collision with other messages, so priority is key for CAN Bus to
avoid that problem.

CAN Bus Data Format


As with all protocols, data is organized in specific ways defined by standards
established. CAN Bus protocol started with CAN 2.0, updated with ISO 11898, and
developments are still being made (there are extended versions of the protocol for
Skip to main content
longer messages). An entire CAN Frame is typically 14 bytes long. Here is a breakdown
of a CAN Message:

SOF (Start of Frame): this marks the beginning of a new CAN message, lets the other
nodes on the bus synchronize.
The arbitration field is the identifier which contains an 11 Bit ID and a bit for RTR (remote
transit request) which is set to dominant if requesting info from another node. The ID is
what other nodes care about as they are the context for whether or not if each node
cares about that message. Think of the ID as a pseudo-address that behaves like a
"topic". If other nodes don't care about the "topic" they will ignore the message. Not only
that, the ID determines priority too for collision avoidance. If communication happens at
the same time, the nodes first wait for the lines to be idle (recessive). If one node
outputs a recessive level and the other outputs a dominant level, the dominant voltage is
always higher priority. An example is shown below.

Example:

Node1 Message: 0011 0110 0000…


Node2 Message: 0010 1000 1100…

From right to left, the fourth bit on the message from Node2 would send first because a
dominant ‘0’ on bit 4 occurs. Node 1 senses this and quits sending the message and
waits for the line to become idle.

R0 is for future development.


Data length code is a half byte long and tells how long the actual data being sent in the
data field is.
The data fields contains the desired data that you want to send to other nodes for
programming purposes.
CRC (Cyclic Redundancy Check) is for error detection. This bit is overwritten if there are
no errors with a dominant level.
ACK (Acknowledge) is a recessive bit that confirms that there was no error (dominant if
there is an error).
Skip to main content
EOF (End of Frame) is a 7 bit field that signals the end of the CAN Message frame and
disables bit stuffing (synchronization data).
The iFS (interframe space) is another 7 bit field that serves as a delay so the receiving
nodes can move info to a separate buffer.

There are 5 mechanisms of error correction in a CAN Message frame. 2 are at the bit
level and 3 are message level. Bit monitoring and bit stuffing are bit level. Bit monitoring
is done by each node and monitors to see if there is an error somewhere (done in the
arbitration field), error is flagged in a specific manner. The other bit level error correction
is bit stuffing. This adds a sixth bit of an opposite level (R or D) if 5 bits of the same level
are sent in a message, this allows synchronizing with the transmitter. This is easily
removed by the receiver as each node expects this extra bit.

The two message level mechanisms are frame checking and the CRC/ACK fields. Frame
checking verifies that all CAN parts exist and if there is a recessive bit after ACK and
CRC. When there is error, there are two thresholds. When the first error occurs, one bit is
set to dominant as a flag which increments a counter for a node. If the counter is only at
1, recessive error flags are sent and traffic continues as normal on the bus. However, if
the counter reaches 2, this indicates a serious error and that node will shut off. The
counters do go down if messages are sent successfully without error.

If you want to experiment with CAN bus on your own, there are a few evaluation boards
that can be used:

1. https://www.digikey.com/short/mjbmpb2b
2. https://www.digikey.com/short/0m2rd48h

https://www.digikey.com/short/8rwhnb24

CANバスプロトコルの概要
CAN 버스 프로토콜 개요

New & Unread Topics


EDATEC Computers: Frequently Asked Questions 0
faqs, embedded-computers, edatec Sep 2023

STEVAL-MKI123V1 3
Sep 2023

Fundamentals of DIP Switch to Microcontroller Interfacing 0


Skip to main content Nov 2023
ESP32 and WLED Help 1
embedded, development-boards-kits-pro… Nov 2023

How to mount ED-IPC3020-08320 (raspberry pi) in a my 1


home lab?
documentation, raspberry-pi, embedded-computers, edatec, single-board-computers-sbcs 3 Feb

Want to read more? Browse other topics in or view latest topics.

You might also like