Product Design & Development

CAN Primer

By Robert Boys
Monday, November 16, 2009
 Share
[-] Text [+]  
Loading...

CAN Primer

Creating your own network that will fit and simplify your own needs.

Introduction

CAN is extensively used in automobiles and trucks but has found applications everywhere. There are many “application” layers available for CAN such as ISO 15765 (cars), J1939 (trucks) and CANopen (factory automation) but it is very easy to develop your own protocol that will fit and simplify your needs.

Modern CAN transceivers provide a stable and reliable CAN physical environment without the need for expensive coaxial cables. Most of the mystery of CAN has dissipated over the years. There is plenty of example CAN software available to help you quickly develop your own network.

ADVERTISEMENT

A CAN controller is a sophisticated device. Nearly all the features of the CAN protocol described below are automatically handled by the controller with almost no intervention by the host processor. All you need to do is configure the controller by writing to its registers, write data to the controller and the controller then does all the housekeeping work to get your message on the bus.

The controller will also read any frames it sees on the bus and hold them in a small FIFO memory. It will notify the host processor that this data is available which you then read from the controller. The controller also contains a hardware filter mechanism that can be programmed to ignore those CAN frames you do not want passed to the processor.

Main Features Of CAN

For the purposes of this article; we will assume a CAN network consists of the physical layer (the voltages and the wires) and a frame consisting of an ID and a varying number of data bytes. CAN has the following general attributes:

  1. 11 or 29 bit ID and from zero to 8 data bytes. TIP: These can be dynamically changed “on the fly.”
  2. Peer to Peer network. Every node can see all messages from all other nodes. A node can’t read its own messages.
  3. Nodes are really easy to add. Just attach one to the network with two wires plus a ground.
  4. Higher priority messages are sent first depending on the value of the ID. A lower ID has the higher priority.
  5. Automatic retransmission of defective frames. A node will “buss-off” if it causes too many errors.
  6. Speeds from approximately 10 Kbps to 1 Mbps. TIP: All nodes must operate at the same frequency.
  7. The twisted differential pair provides excellent noise immunity and some decent bus fault protection.
  8. The CAN system will work with the ground connection at different DC levels. TIP: Or no ground at all.

The CAN System Layout

A CAN network consists of at least two nodes connected together with a twisted pair of wires as shown below. A ground wire can be included with the twisted pair or separately as part of the chassis. One twist per inch (or more) will suffice and the integrity of the ground is not important for normal operation. As in any differential systems; the important signal is the voltage levels between the wire pair and not their values to ground. CAN is completely described in ISO 11898.

The maximum length of the network is dependent on the frequency, number of nodes and propagation speed of the wire. It is relatively easy to have a 20 node (or more), 500 Kbps system running 30 or 40 feet (or more). TIP: The drops should be less than 3 feet and randomly spaced to reduce standing waves. These issues all become more important at higher bus speeds.

Since the twisted pair is a transmission line, 120 ohm termination resistors are needed at both ends of the backbone. Do not put any resistors at the nodes. TIP: Your total resistance value as measured between the two twisted wires will be 60 ohms. CAN is a broadcast system. Any node can “broadcast” a message using a CAN frame on a bus that is in idle mode.

Every node will see this message. A “message” can be considered the same as a CAN frame until you need to use more than one frame to send a long message. TIP: It is up to the individual node if it must react to a CAN frame or just ignore it.

CAN_backbone

Click here to read

JOIN THE DISCUSSION
Rate Article:  Average 0 out of 5
register or log in to comment on this article!

0 Comments

Add Comment

Text Only 2000 character limit

Page 1 of 1

At Issue

Beta Products & The Human Guinea Pig
Mike Willshaw, Radius Creative
My Garbage Blanket
Anna Wells, Editor, IMPO
A Quick Fix
Meaghan Ziemba, Associate Editor, PD&D

Quick Links

Site Sponsors


Most Viewed

Videos & Webcasts

Cannon vs. Skull 3/17/2010
Schmit Prototypes builds a canon powerful enough to blow your brains out.   Continue
Dynamic Structures Digital Prototyping 3/17/2010
When designing their structures, Dynamic Structures uses Audtodesk Inventor to go beyond 3D design.   Continue
Augmenting Reality 3/17/2010
The new technology makes driving more safe and convenient by enhancing the driver’s site.   Continue