Thursday, 26 December 2024

A Comprehensible Guide To Controller Area Network

A Comprehensible Guide to Controller Area Network (CAN Bus) by Wilfried VossFor the longest time the major misconception about Controller Area Network (CAN) was that it is merely used in automobiles. The truth is, CAN, since its introduction in 1986, proved to be a robust, simple and versatile technology and, consequently, CAN found its way into all areas of applications where microprocessors need to communicate among each other.

Along with its undeniable use in automobiles, CAN applications do not only include industrial automation tasks, but any application where distributed control is advantageous and/or a serial bus system will eliminate excessive wiring. CAN proved to be superior to any other field-bus system in regards to low cost, the ability to function in a difficult electrical environment, a high degree of real time capability, excellent error detection and fault confinement capabilities and, almost contradictive to the previously mentioned features, ease of use.

Nowadays there is no special niche for CAN; its use is universal from any industrial application, space and aviation, maritime, medical, down to household appliances such as washers, dryers and even coffee machines.

The ease of use is especially evident for the software engineer who is responsible for the development of a CAN based application. As a matter of fact, the actual CAN protocol, i.e. the entire data communication management including bus arbitration, error detection and fault confinement, etc., etc., is implemented into silicon. CAN controllers know per default what to do and how to do it.

The software engineer is ‘demoted’ to serve only the basic functions such as initialization, reading data, writing data, checking status and, as a result, to concentrate merely on the actual application software.


This title is also available as a PDF Download.A Comprehensible Guide to Controller Area Network (CAN Bus) by Wilfried Voss - PDF Download


Table of Content

1. Overview

1.1       What is CAN?
1.2       A Brief History of CAN
1.3       CAN Applications
1.4       CAN-in-Automation (CiA)
1.5       International Standard ISO 11898

2. Main Characteristics

2.1       Frames
2.2       Multi-Master Bus Access
2.3       Message Broadcasting
2.4       Message Priority
2.5       Short Messages
2.6       Data Rate and Message Frequency
2.7       Bus Arbitration
2.8       Error Detection & Fault Confinement

3. Benefits of using CAN

3.1       CAN Controller Firmware
3.2       Low Cost Implementation
3.3       Speed, Reliability, Error-Resistance
3.4       Worldwide Acceptance
3.5       Higher Layer Protocols

4. Message Frame Architecture

4.1       Dominant and Recessive Bus Level
4.2       Data and Remote Frames
4.3       Data Frame
4.4       Remote Frame
4.4.1   Remote Frame on Recall
4.5       Message Frame Format
4.6       Extended CAN Protocol
4.7       Error Frame
4.7.1     Error Flag
4.7.2   Error Delimiter
4.8       Overload Frame
4.8.1   Overload Flag
4.8.2   Overload Delimiter
4.9       Interframe Space
4.10     Frame Length and Transmission Times
4.11 Baud Rate Considerations
4.12 Bandwidth

Message Broadcasting

5.1       Message Broadcasting with Data Frames
5.2       Message Request with Remote Frames

Bus Arbitration

6.1       Principle of Bus Arbitration
6.2       Main Rules of Bus Arbitration
6.3       Bus Arbitration Example

Data Transfer Synchronization

7.1       Bit Coding
7.2       Bit Stuffing
7.3       Bit Timing and Synchronization
7.3.1   Bit Sample Point
7.3.2   Bit Time
7.3.3   Bit Time Programming
7.3.4   Synchronization
7.3.5   Phase Error and Resynchronization
7.3.6   Oscillator Frequency Tolerance Range

Error Detection and Fault Confinement

8.1       Error Detection
8.1.1   Bit Monitoring
8.1.2   Checksum Check
8.1.3   Bit Stuffing Error
8.1.4   Frame Check Error
8.1.5   Acknowledgement Error
8.2       Error Signaling
8.3       Fault Confinement
8.3.1   Error Counting

Physical Layer

9.1       Bus Topology
9.2       Bus Medium
9.4       Bus Signal Level
9.5       Bus Connection
9.6       Maximum Bus Length
9.7       Wiring and Connectors

Summary


Published by

Copperhill Technologies Corporation
158 Log Plain Road
Greenfield, MA 01301

Copyright © 2005 – 2017 by Copperhill Technologies Corporation, Greenfield, Massachusetts

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher.

Limit of Liability/Disclaimer of Warranty

While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties or merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. Neither the publisher nor author shall be liable for any loss or profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages.


About this book

The main reason to write this book was the lack of good printed English literature on CAN basics, which is somewhat disconcerting considering that the technology was first officially introduced in 1986.

There are three official documents describing the CAN standard, the Bosch CAN Specification Version 2.0, the CiA CAN Specification and ISO 11898. The CiA (CAN-in-Automation) specification is a mere copy of the Bosch document, while ISO 11898-1 is an expanded copy with a more scientific approach. All these documents, more often than not, leave ample room for interpretation of the explained topics by omitting elaborating comments, examples or pictures.

It was surprising to find that some special topics, for instance, the CAN Overload Flag, the Bit Stuffing procedure, Bit Resynchronization, and more, are still insufficiently documented. Other documents did provide interesting details, but were somewhat vague on other topics or, in some rare cases, plain wrong.

Some additional works, originally written in German (due to the origination of the technology) are hurt by poor translation, which in turn has a damaging effect on the readability. There are also a vast amount of web sites that contain information on CAN, but they mostly provide only bits and pieces and, after all, they all have commercial aspects in mind.

This book intends to provide adequate information on Controller Area Network (CAN) paired with readability.

The first three chapters provide an overview of Controller Area Network that will allow the reader to understand the basics of CAN without being overwhelmed by technical details:

  1. Overview

Introduces CAN, refers to the history of CAN, CAN applications.

  1. Main Characteristics

Explains in an overview the CAN message frames, bus access, message broadcasting, message priorities, data length and baud rate, bus arbitration and error handling.

  1. Benefits of using CAN

Describes the various benefits such as low cost implementation, speed, reliability, error-resistance and worldwide acceptance.

The heart of this book is represented, however, by chapters 4 through 9, which provide more detailed technical insights:

  1. Message Frames

Explains the detailed architecture of message frames.

  1. Message Broadcasting

Explains the message broadcasting mechanism in a CAN network.

  1. Bus Arbitration

Explains the bus arbitration principle in a CAN network.

  1. Data Transfer Synchronization

Explains the data transfer synchronization mechanisms between nodes in a CAN network.

  1. Error Detection and Fault Confinement

Explains how errors in a CAN network are detected, the determination of sporadic and permanent failures, the fault confinement and error recovery.

  1. Physical Layer

Explains the CAN bus medium, bus topology, bus level, bus connections and bus length considerations.

Various technical information in this book is based on the International Standard ISO 11898-1 – Road vehicles – Controller area network CAN) – Part 1: Data link layer and physical signaling and Part 2: High-speed medium access unit

This book does not cover part 3 (Low-speed, fault-tolerant, medium dependent interface) or part 4 (Time-triggered communication) of the ISO 11898 CAN specification, since applications covered by this subject may only apply to automobiles. This book, besides automobile technologies, tries to include industrial automation aspects.

Higher layer protocols based on CAN, such as CANopen, DeviceNet, and SAE J1939 are mentioned briefly, but a more detailed description is not in the scope of this book.

There is already a standard work on CANopen: Embedded Networking with CAN and CANopen by Olaf Pfeiffer, Andrew Ayre, and Christian Keydel.

The DeviceNet Specification, consisting of two volumes: Volume One – Common Industrial Protocol (CIP) and Volume Three- DeviceNet Adaptation of CIP, is available only for ODVA (Open DeviceNet Vendor Association) members. For further information, refer to http://www.odva.org.

The Society of Automotive Engineers (SAE) Truck and Bus Control and Communications Subcommittee has developed a family of standards concerning the design and use of devices that transmit electronic signals and control information among vehicle components. The SAE J1939 Standards Collection can be found exclusively on the Web at http://www.sae.org.

For more literature on SAE J1939 see also A Comprehensible Guide to J1939 by Wilfried Voss.