CAN Physical Layer

The Controller Area Network (CAN) was developed to prevent the need for large multi-core wiring harnesses in the automotive industry.

The maximum CAN bus speed is 1 MBaud, which can be achieved with a bus length of up to 40 meters when using a twisted wire pair. The bus must be terminated at each end, typically using a resistor of 120 Ohms. For bus lengths longer than 40 meters the bus speed must be reduced. A 1000 meter bus can still be realised with a 50 KBaud bus speed. For a bus length above 1000 meters special drivers should be used.

Simplified diagram showing the CAN busses being used to support low and high speed devices.

The CAN protocol uses Non-Return-to-Zero or NRZ bit coding. This means that the signal is constant for one whole bit time and only one time segment is needed to represent one bit. The two bus conductors are called "CAN_H" and "CAN_L", although the conductors are driven differentially in balanced mode, the levels are shifted, resulting in a waveform that differs to RS-485.

CAN physical interface.

The CAN singalling represents a 1 and 0 in the following way:

To enable arbitration, CAN uses 3 levels, in which one symbol lets both conductors float to zero. The other symbol drives both conductors - one to the opposite polarity of the other. This also has constant power envelope. The higher rate of CAN utilises synchronous transmission.

Sequence for 1 followed by 0

Example waveform showing transmission of the sequence { 0 0 1 1 0 1 }. Vertical axis in volts, horizontal axis in microseconds.

Bit Stuffing

Synchronous transmission is used, with bit stuffing to ensure transparent synchronisation of all bus nodes. When transmitting the sender observes the sequence of bit values being sent. A maximum of five consecutive bits are allowed to have the same polarity, this removes contiguous series of identical values on the bus. 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.

Examples of Bit Stuffiing:
1010101001 sent on cable, received as 1010101001
1010000001 sent on cable, received as 1010000001
1010000111 sent on cable, received as 1010000111
1010111111 sent on cable, received as 1010111111

The receiver also checks the number of bits with the same polarity and removes the stuff bits again from the bit stream. This is called "destuffing". Hence, the sequence 0111111 becomes 01111101 on the wire, but the receiver correctly receives 0111111. The rule dictates also that the 0111110 becomes 01111100 on the wire, but the receiver then receives 0111110, since the receiver will automatically remove any bit after 5 consecutive bits. The removed stuffing bit must be the opposite polarity (or noted as an error). This happens automatically and ensures receivers always see transitions. - It can add up to one bit in five, maximum 20% additional overhead.

Effect of a corrupted stuffing bit

Using "stuffing", a sequence 0111111 becomes 01111101 on the wire, but the receiver correctly receives 0111111 after removing the extra "stuffed" bit. Several problem can arise when such a stuffed stream is corrupted (i.e. a bit is inverted). Consider the following

The advantage of being able to send any binary data, while preserving clock transitions is that any errors can result in insertion or deletion of bits. While this is likely to be uncommon in practice (there are not usually many stuffing bits - so it is unlikely that they will be corrupted), the receiver must use an integrity that provides a strong guarantee of detecting destuffing mistakes. A Cyclic Redundancy Check is usually used.

See also

Prof. Gorry Fairhurst, School of Engineering, University of Aberdeen, Scotland (2016)