AP29000
Connecting C166 and C500 Microcontroller to CAN
The Controller Area Network (CAN)
Application Note
9
V 1.0, 2004-02
3
The Controller Area Network (CAN)
3.1
CAN Basics
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
(logic level mostly "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
"CAN_H" and "CAN_L" and may be connected directly to the nodes or via a connector.
There's no standard defined by CAN regarding the connector to be used. The twisted
wire pair is terminated by terminating resistors at each end of the bus line. The
maximum bus speed is 1 MBaud, which can be achieved with a bus length of up to 40
m. For bus lengths longer than 40 m the bus speed must be reduced (a 1000 m bus
can be realised with a 40 KBaud bus speed). For a bus length above 1000 m special
drivers should be used. At least 30 nodes may be connected without additional
equipment. Due to the differential nature of transmission CAN is insensitive to EMI,
because both bus lines are affected in the same way which leaves the differential
signal unaffected. The bus lines can also be shielded to reduce the electromagnetic
emission of the bus itself, especially at high baudrates.
The binary data is coded corresponding to the NRZ code (Non-Return-to-Zero; low
level = dominant state; high level = recessive state). To ensure exact 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).