|Computer Solutions Ltd|
Celebrating 34 years
|Home Products Supported Chips Information Zone Contact Site Map Web Shop|
The CAN bus (Controller Area Networking) was defined in the late 1980 by Bosch, initially for use in automotive applications. It has been found to be very useful in a wide variety distributed industrial systems as it has the following characteristics:
CAN is unusual in that the entities on the network, called nodes, are not given specific addresses. Instead, it is the messages themselves that have an identifier which also determines the messages' priority. Nodes then depending on their function transmit specific messages and look for specific message. For this reason there is no theoretical limit to the number of nodes although in practice it is ~64.
Two specifications are in use:
A third known as CAN-FD has been submitted to ISO (Jan 2013) -- it provides faster data rates of 8Mbits/sec and larger data payloads of 64 bytes. For more details and how it will interwork with 2.0 CAN see CAN FD
Nuts and Bolts
From the systems and design viewpoint the detailed management of sending and receiving CAN messages will normally be done by dedicated hardware, on or off chip, (e.g. SJA1000) but an overview of these functions will be useful in order to design, setup and control a CAN system.
CAN may be implemented over a number of physical media so long as the drivers are open-collector and each node can hear itself and others while transmitting (this is necessary for its message priority and error handling mechanisms). The most common media is a twisted pair 5v differential signal which will allow operations in high noise environments and with the right drivers will work even if one of the wires is open circuit. A number of transceiver chips are available the most popular probably being the Philips 82C251 as well as the TJA1040.
When running Full CAN (ISO 11898-2) at its higher speeds it is necessary to terminate the bus at both ends
with 120 Ohms. The resistors are not only there to prevent reflections
but also to unload the open collector transceiver drivers. We recommend that
you terminate the bus correctly in all circumstances.
The CAN protocol uses a modified version of the Carrier Sense
Multiple Access/Collision Avoidance (CSMA/CA) technique used on Ethernet.
Should two messages determine that they are both trying to send at the same
time then instead of both backing off and re-trying later as is done with
Ethernet, in the CAN scheme, the transmitters detect which message has the
highest priority and only the lower priority message gets delayed. This means
that a high priority message is sure of getting through.
These are the normal message frames used to carry data. They contain the following fields -- this is a simplified description as the controller takes care of the detail which is only of interest to those designing controllers (who should consult the spec)
The way in which message collision is avoided is that each node as it transmits its MID looks on the bus to see what everyone else is seeing. If it is in conflict with a higher priority message identifier (one with a lower number) then the higher priority messages bit will hold the signal down (a zero bit is said to be dominant) and the lower priority node will stop transmitting.
If you are writing diagnostic code and wish to not "exist" on the network as a node, just to spy on what is happening, then you will need to ensure that the interface you use can be set to a mode where it does not automatically set the ACK bit. The Peak interfaces and their Explorer diagnostic package can be set into such a mode.
These are frames that are used to request that a particular message be put on the network - of course a node somewhere on the network has to be set up to recognise the request, get the data and put out a Message frame. This mechanism is used in polled networks. The fields are ....
CAN is a very reliable system with multiple error checks
By defining only the physical and data link levels of the OSI communications model the CAN specification has become the basis for a wide number of industry and manufacture specific variants (and the source of much confusion as all the users will tell you they are using CAN). If you are trying to clarify a CAN systems status the first thing to find out is the transceivers in use - the most common "normal 5v" CAN uses the Philips 82C251 or the TJA1040.
TJA 1054 is a low power, low speed physical layer that is mostly used in automotive applications. It employs the PCA82C252, TJA1053 or TJA1054 transceivers.
AU5790 also known as "Single Wire CAN" is a low power, low speed physical layer that is used in automotive applications and an increasing number of industrial applications. It employs the AU5790 transceiver.
DeviceNet - Developed for use in industrial process control it is based on the standard Full CAN - ISO 11898-2 5v bus. However DeviceNet rigorously defines the physical interconnect, has a more restrictive transceiver specification, 11 bit identifiers only, allows 125, 250 and 500KBaud operation only and regulates the message content in order to more easily support interoperability of different manufacturers units.
CANopen - Also designed with control applications in mind, it is a software standard based on the standard Full CAN - ISO 11898-2 5v bus. It limits the number of nodes to 127 and allocates them IDs. Profiles are specified for each type of device by CiA to simplify using similar units (eg motor drives) from different manufacturers. Some standard network commands are defined that allow modules to be automatically identified and allocated a node ID. The spec also defines a way to handle synchronised data reads and writes as well as providing a standard way in which large blocks of data can be read and written. We can supply CANopen diagnostic and network management software, Embedded drivers and I/O modules.
TTCAN - Time Triggered CAN - The Time-Triggered Protocol has nodes reporting in predefined time windows that have to be planned and synchronised but which then ensure that an overload on the bus is not possible even in a worst case situation.
J1939 - A whole family of industry specific standards (agriculture, marine, truck & bus etc) are built on the basic communication services of the J1939 protocol specification ( itself based on Full CAN - ISO 11898-2) with industry-specific documents defining the particular combination of layers for that industry. PEAK provide a full database of J1939 mnemonics with their J1939 option to PCAN-Explorer
B10011S is the Transceiver used in a very restricted version of CAN (ISO 11992-1) that has only two nodes normally a truck and its trailer - not to be confused with.......
FMS is a message protocol subset of J1939 defined for the Bus and Truck/Trailer market. For a software packages that knows the meaning of all the FMS messages and can test/emulate and display them in a meaningful way see our FMS Toolkit.
MilCAN - is defined for
use in military land vehicles where a deterministic protocol is require. It
sets up some rules for use and a software layer on top of a conventional CAN
network. A Pseudo Hardware Sync is created by one node "the SyncMaster" that
sends Sync CAN Frames with a "sync slot number".
Local Interconnect Network is simpler than CAN and is often used in automotive "body functions" - eg windows, where performance is not critical but cost is. CAN is then often used to integrate the operation of multiple LIN sub networks. LIN is a single master, multiple slave system that uses a 12V single wire physical layer and a UART/SDI with master driven self synchronisation. It is capable of running at data rates of up to 20Kbits per second over a maximum distance of 40 Meters. We can supply a USB to LIN interface and a LIN to CAN gateway which simplify developing LIN and mixed CAN/LIN systems.
Interface between CAN and PCs
We can supply a number of different interfaces to allow a PC to talk to CAN. The most popular is the PCAN-USB interface but we also have the many form factors of PCI including PC/104 and PCMCIA as well as ISA and RS232. See our range. These are then all supported by extensive ......
Embedded CAN chip manufacturers will provide examples of how to drive their chips, usually written in assembler or C. PC software to drive the USB, PCI or other interfaces to CAN will also be supplied by the interface manufacturer. Peak provide both low level drivers for Windows and a free API for their interfaces to allow CAN and LIN to be driven from a range of application languages on the PC. Also available are CAN analyser packages from the free simple but powerful PCAN-view to the sophisticated PCAN-Explorer which provides data plotting with strip charts, user defined message names and data conversions for ease of analysis as well as extensive macro and script support for data collection and control. Add-in packages include J1939 support, a GUI interface that can be used for both display and control and a replay facility for Simulation. A specific software package is available to cover the FMS Bus and Truck standard so that it can be easily used by engineers not familiar with CAN.
A Windows standard API has been developed for communicating between C code on PCs and CAN - its called RP1210 and a driver for it is available for the PCAN range of interfaces so that they can be used with applications supporting that standard.
CAN-Open is necessarily more complex but we can supply both PC based CANopen diagnostic and network management software and embedded drivers.
For a .pdf copy of this tutorial plus information on CAN interfaces and free software Download 4.6 Mbytes
If you have found this
tutorial useful you might also be interested in our tutorials on