EasyManua.ls Logo

Microchip Technology dsPIC30F - CAN Protocol Overview

Microchip Technology dsPIC30F
738 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
dsPIC30F Family Reference Manual
DS70070B-page 23-68 © 2004 Microchip Technology Inc.
23.14 CAN Protocol Overview
The Controller Area Network (CAN) is a serial communications protocol which efficiently
supports distributed real-time control with a very high level of robustness. The CAN Protocol is
fully defined by Robert Bosch GmbH, in the CAN Specification V2.0B from 1991.
Its domain of application ranges from high speed networks to low cost multiplex wiring.
Automotive electronics (i.e., engine control units, sensors, anti-skid-systems, etc.) are connected
using CAN with bit rates up to 1 Mbit/sec. The CAN Network allows a cost effective replacement
of wiring harnesses in the automobile. The robustness of the bus in noisy environments and the
ability to detect and recover from fault conditions makes the bus suitable for industrial control
applications such as DeviceNet, SDS and other fieldbus protocols.
CAN is an asynchronous serial bus system with one logical bus line. It has an open, linear bus
structure with equal bus nodes. A CAN bus consists of two or more nodes. The number of nodes
on the bus may be changed dynamically without disturbing the communication of other nodes.
This allows easy connection and disconnection of bus nodes (e.g., for addition of system
function, error recovery or bus monitoring).
The bus logic corresponds to a “wired-AND” mechanism, “recessive” bits (mostly, but not
necessarily equivalent to the logic level ‘1’) are overwritten by “dominant” bits (mostly logic level
‘0’). As long as no bus node is sending a dominant bit, the bus line is in the recessive state, but
a dominant bit from any bus node generates the dominant bus state. Therefore, for the CAN bus
line, a medium must be chosen that is able to transmit the two possible bit states (dominant and
recessive). One of the most common and cheapest ways is to use a twisted wire pair. The bus
lines are then called “CANH” and “CANL”, and may be connected directly to the nodes, or via a
connector. There's no standard defined by CAN regarding connector requirements. The twisted
wire pair is terminated by terminating resistors at each end of the bus line. The maximum bus
speed is 1 Mbit, which can be achieved with a bus length of up to 40 meters. For bus lengths
longer than 40 meters, the bus speed must be reduced (a 1000 m bus can be realized with a
40 Kbit bus speed). For bus lengths above 1000 meters, special drivers should be used. At least
20 nodes may be connected without additional equipment. Due to the differential nature of
transmission, CAN is not inherently susceptible to radiated electromagnetic energy because both
bus lines are affected in the same way, which leaves the differential signal unaffected. The bus
lines may also be shielded to reduce the radiated electromagnetic emission from the bus itself,
especially at high baud rates.
The binary data is coded corresponding to the NRZ code (Non-Return-to-Zero; low
level = dominant state; high level = recessive state). To ensure clock synchronization of all bus
nodes, bit-stuffing is used. This means that during the transmission of a message, a maximum
of five consecutive bits may have the same polarity. Whenever five consecutive bits of the same
polarity have been transmitted, the transmitter will insert one additional bit of the opposite polarity
into the bit stream before transmitting further bits. The receiver also checks the number of bits
with the same polarity and removes the stuff bits from the bit stream (destuffing).
In the CAN protocol, it is not bus nodes that are addressed. The address information is contained
in the messages that are transmitted. This is done via an identifier (part of each message) which
identifies the message content (e.g., engine speed, oil temperature etc.). This identifier also
indicates the priority of the message. The lower the binary value of the identifier, the higher the
priority of the message.
For bus arbitration, Carrier Sense Multiple Access/Collision Detection (CSMA/CD) with
Non-Destructive Arbitration (NDA) is used. If bus node A wants to transmit a message across the
network, it first checks that the bus is in the Idle state (“Carrier Sense”), (i.e., no node is currently
transmitting). If this is the case (and no other node wishes to start a transmission at the same
moment), node A becomes the bus master and sends its message. All other nodes switch to
Receive mode during the first transmitted bit (Start-Of-Frame bit). After correct reception of the
message (which is Acknowledged by each node), each bus node checks the message identifier
and stores the message, if required. Otherwise, the message is discarded.

Table of Contents

Other manuals for Microchip Technology dsPIC30F