The CAN Bus Protocol Tutorial

The CAN Bus Protocol Tutorial gives an overview of the ISO 11898-1 and ISO 11898-2 controller area network standards. This tutorial provides a great introduction to the fundamentals of CAN (controller area network) as it is used in automotive design, industrial automation controls, and many more applications.

Table of Contents

  1. Introduction: The CAN Bus
  2. CAN Messages
  3. CAN Physical Layer
  4. CAN Oscilloscope Pictures
  5. CAN Connectors
  6. CAN Bit Timing
  7. CAN Error Handling
  8. Higher Layer Protocols

can-8-video-clips

Take our e-Learning course!

Our updated 8-part video course sets a new standard in CAN training.

Introduction: The CAN Bus

What is CAN?

CAN is short for ‘controller area network’. Controller area network is an electronic communication bus defined by the ISO 11898 standards. Those standards define how communication happens, how wiring is configured and how messages are constructed, among other things. Collectively, this system is referred to as a CAN bus.

What We'll Cover

To get deeper into the details of CAN, the CAN bus is a broadcast type of bus. This means that all nodes can “hear” all transmissions. There is no way to send a message to just a specific node; all nodes will invariably pick up all traffic. The CAN hardware, however, provides local filtering so that each node may react only on the interesting messages. We’ll discuss this more in Section 2, “CAN Messages”.

We’ll also discuss how the bus uses Non-Return To Zero (NRZ) with bit-stuffing. In this system, the modules are connected to the bus in a wired-and fashion: if just one node is driving the bus to a logical 0, then the whole bus is in that state regardless of the number of nodes transmitting a logical 1.

The CAN standard defines four different message types. The messages uses a clever scheme of bit-wise arbitration to control access to the bus, and each message is tagged with a priority.

The CAN standard also defines an elaborate scheme for error handling and confinement which is described in more detail in Section 7, “CAN Error Handling”.

Bit timing and clock synchronization is discussed in Section 6 of this tutorial. Here’s a bit timing calculator you can use to calculate the CAN bus parameters and register settings.

CAN bus wiring may be implemented using different physical layers (Section 3), some of which are described here, and there are also a fair number of CAN bus connector types (Section 5) in use. We also provide a number of oscilloscope pictures (Section 4) for those interested in the details of a message.

CAN Messages

The CAN bus is a broadcast type of bus. This means that all nodes can ‘hear’ all transmissions. There is no way to send a message to just a specific node; all nodes will invariably pick up all traffic. The CAN hardware, however, provides local filtering so that each node may react only on the interesting messages.

The CAN messages
CAN uses short messages – the maximum utility load is 94 bits. There is no explicit address in the messages; instead, the messages can be said to be contents-addressed, that is, their contents implicitly determines their address.

Message Types
There are four different message types (or ‘frames’) on a CAN bus:

  1. the Data Frame
  2. the Remote Frame
  3. the Error Frame
  4. the Overload Frame

The Data Frame

Summary: “Hello everyone, here’s some data labeled X, hope you like it!”

The Data Frame is the most common message type. It comprises the following major parts (a few details are omitted for the sake of brevity):