1999 Microchip Technology Inc. Preliminary DS00713A-page 1
AN713
Controller Area Network (CAN) Basics
INTRODUCTION
Controller Area Network (CAN) was initially created by
German automotive system supplier Robert Bosch in
the mid-1980s for automotive applications as a method
for enabling robust serial communication. The goal was
to make automobiles more reliable, safe and fuel-effi-
cient while decreasing wiring harness weight and com-
plexity. Since its inception, the CAN protocol has gained
widespread popularity in industrial automation and
automotive/truck applications. Other markets where
networked solutions can bring attractive benefits like
medical equipment, test equipment and mobile
machines are also starting to utilize the benefits of CAN.
The goal of this application note is to explain some of
the basics of CAN and show the benefits of choosing
CAN for embedded systems networked applications.
CAN OVERVIEW
Most network applications follow a layered approach to
system implementation. This systematic approach
enables interoperability between products from differ-
ent manufacturers. A standard was created by the
International Standards Organization (ISO) as a tem-
plate to follow for this layered approach. It is called the
ISO Open Systems Interconnection (OSI) Network
Layering Reference Model and is shown in Figure 1 for
reference.
The CAN protocol itself implements most of the lower
two layers of this reference model. The communication
medium portion of the model was purposely left out of
the Bosch CAN specification to enable system design-
ers to adapt and optimize the communication protocol
on multiple media for maximum flexibility (twisted pair,
single wire, optically isolated, RF, IR, etc.). With this
flexibility, however, comes the possibility of interopera-
bility concerns.
To ease some of these concerns, the International Stan-
dards Organization and Society of Automotive Engi-
neers (SAE) have defined some protocols based on
CAN that include the Media Dependant Interface defini-
tion such that all of the lower two layers are specified.
ISO11898 is a standard for high-speed applications,
ISO11519 is a standard for low-speed applications, and
J1939 (from SAE) is targeted for truck and bus applica-
tions. All three of these protocols specify a 5V differen-
tial electrical bus as the physical interface.
The rest of the layers of the ISO/OSI protocol stack are left
to be implemented by the system software developer.
Higher Layer Protocols (HLPs) are generally used to imple-
ment the upper five layers of the OSI Reference Model.
HLPs are used to:
1) standardize startup procedures including bit rates
used,
2) distribute addresses among participating nodes
or types of messages,
3) determine the structure of the messages, and
4) provide system-level error handling routines.
This is by no means a full list of the functions HLPs perform,
however it does describe some of their basic functionality.
CAN PROTOCOL BASICS
Carrier Sense Multiple Access with Collision
Detection (CSMA/CD)
The CAN communication protocol is a CSMA/CD proto-
col. The CSMA stands for Carrier Sense Multiple
Access. What this means is that every node on the net-
work must monitor the bus for a period of no activity
before trying to send a message on the bus (Carrier
Sense). Also, once this period of no activity occurs, every
node on the bus has an equal opportunity to transmit a
message (Multiple Access). The CD stands for Collision
Detection. If two nodes on the network start transmitting
at the same time, the nodes will detect the ‘collision’ and
take the appropriate action. In CAN protocol, a non-
destructive bitwise arbitration method is utilized. This
means that messages remain intact after arbitration is
completed even if collisions are detected. All of this arbi-
tration takes place without corruption or delay of the
higher priority message.
There are a couple of things that are required to sup-
port non-destructive bitwise arbitration. First, logic
states need to be defined as dominant or recessive.
Second, the transmitting node must monitor the state of
the bus to see if the logic state it is trying to send actu-
ally appears on the bus. CAN defines a logic bit 0 as a
dominant bit and a logic bit 1 as a recessive bit.
Author: Keith Pazul
Microchip Technology Inc.