CAN physical layer

The CAN physical layer is divided into three parts: The physical coding (PCS) implemented in the CAN controller chips, the physical media attachment (PMA) specifying the transceiver characteristics, and the physical media-dependent sub-layers (PMS). The PMS is application-specific and is not generally standardized.

The AUI (attachment unit interface) is the interface between CAN controller and CAN transceiver chip; the MDI (medium-dependent interface) is the interface to physical bus-lines

The PCS comprises the bit-encoding and decoding, the (re-)synchronization as well as the bit timing. This sub-layer provides the attachment unit interface (AUI), which is the interface to the transceiver chips. The AUI are realized by means of the TxD and RxD pins. There are two implementations: the 5-V version and the 3,3-V version.

The physical coding sub-layer

CAN uses non-return-to-zero (NRZ) coding. In contrast to the Manchester coding, not every bit contains a falling or a rising edge. During one bit, the voltage (0 V or +5 V resp. 3,3 V) is constant. The signal level can remain constant over a longer period of time if the transmitted bits have the same logical value. Therefore, measures must be taken to ensure that the maximum permissible interval between two signal edges is not exceeded. This is important for synchronization purposes. Hence, the CAN protocol uses so-called stuff-bits: After five bits of the same value, the transmitting CAN controller automatically includes a bit of the opposite value. The receiving CAN nodes de-stuff the bit sequence, meaning after five bits of the same value they automatically delete the following one. This way it is guaranteed that the original bit sequence is the same as the sequence forwarded to the host controller. Of course, these stuff-bits are visible on the bus-lines.

If the bus is idle (recessive state for at least three bit-times), the first falling edge (recessive-to-dominant) is used to globally synchronize (hard synchronization) all CAN controllers. Every following recessive-to-dominant edge is used to locally synchronize (soft synchronization) the nodes. The re-synchronization is limited by the bit-timing settings.

On the bit-level – the OSI physical layer – Classical CAN uses synchronous bit transmission. This enhances the transmitting capacity but also means that a sophisticated method of bit synchronization is required. While in a character-oriented transmission (asynchronous) bit synchronization is performed upon the reception of the start bit available with each character, in a synchronous transmission protocol only one start bit is available at the beginning of a frame. To enable the receiver to correctly read the messages, continuous re-synchronization is required. Phase buffer segments are therefore inserted before and after the nominal sample point within a bit interval.

Bit-timing setting for Classical CAN

The CAN bit comprises – depending on the configured “atomic” time unit called time quantum (tq) – multiple of these time quanta; the time quanta length derives from the bit-rate prescaler and the used oscillator frequency

The CAN bit comprises – depending on the configured “atomic” time unit called time quantum (tq) – multiple of these time quanta. The time quanta length derives from the bit-rate prescaler and the used oscillator frequency.

The CAN bit is logically divided into four segments. The synchronization segment has always a length of 1 tq. The following propagation segment and phase-segment 1 are not distinguishable for the user. It is configured as one value. The forth part is the phase-segment 2. Between the two phase-segments, the sample-point is located. If the bit-timing settings move the sample-point to the end of the bit, the propagation segment is enlarged, so that you can realize longer networks. If the sample-point is configured in the other direction, the re-synchronization capability is increased.

The sample point should be the same in all connected CAN nodes. However, in practice it is sufficient if the sample points don't vary too much. The automotive industry has specified some recommendations for the bit timing settings in the SAE J2284 series. For CANopen networks, the recommendations given in CiA 301 should be used. The sample points should be at 87,5 percent of the bit time. For most of the specified bit-rates a range of 85 percent to 90 percent is allowed. Of course, the larger the tolerance range, the shorter the maximum possible length of the network.

Bit timing setting for CAN FD

For each node, the distance (time) between the detected and the expected position of a falling or raising edge is called the phase error of that edge

CAN FD uses two bit-rates. The bit timing setting for the arbitration phase follows the same rules as in Classical CAN. In addition, the time quantum should be as short as possible, in order to reduce the quantization error in the data phase. This means a bit should be made of as many time quanta as possible. Some chipmakers provide a maximum of 385 tq for the arbitration phase.

The data phase bit timing is independent of the arbitration phase bit timing. In the CAN FD data phase, the same parameters are to be set as in the arbitration phase (bitrate pre-scaler, length of propagation + phase-segment 1, phase-segment 2, and the synchronization jump width). Additionally, you need to configure the transmitter delay compensation (TDC) and its offset (up to two bits). This is necessary especially for higher bit-rates. The CiA 601-1 document gives hints and guidelines to calculate appropriate values. There are bit-rate depended effects to be considered as well as effects not dependent on the bit-rate.

Because in the data phase the nodes are not synchronized, the time quanta in all nodes should be the same or multiple of the others. This is why only oscillator frequencies of 20 MHz, 40 MHz, or 80 MHz are allowed. The sample point should be at the same point in all nodes.

The physical media attachment sub-layer

The PMA sub-layer is normally implemented in the transceiver chip. The inputs are the TxD and RxD signals from the CAN controller. The outputs drive the bus-lines. There are different solutions available:

  • Most important is the CAN high-speed transmission as specified in ISO 11898-2.
  • Increasingly in use are high-speed transceivers with low-power functionality also specified in ISO 11898-2 (formerly in ISO 11898-5).
  • In some automotive applications, high-speed transceivers with an additional selective wake-up capability as specified in ISO 11898-2 (formerly in ISO 11898-6) are used.
  • The low-speed (up to 125 kbit/s), fault-tolerant, and low-power transceivers standardized in ISO 11898-3 will be increasingly substituted by high-speed transceivers with low-power functionality.
  • The low-speed (up to 125 kbit/s) transceivers providing a higher voltage level as the others are required in Europe for truck-trailer point-to-point CAN communication (ISO 11992-1).
  • Transceivers for single-wire communication (SWC) as specified in SAE J2411 provide a low-speed transmission and are rarely used.

The high-speed transceivers are qualified for different bit-rates (e.g. 1 Mbit/s, 2 Mbit/s, 5 Mbit/s, and 8 Mbit/s). Components for Classical CAN transmissions up to 1 Mbit/s don’t need to fulfill asymmetry requirements. Transceivers for bit-rates above 1 Mbit/s do. Of course, you can use chips qualified for a higher bit-rate than actually used in the network.

The medium-dependent sub-layer

There are only a few general requirements for this sub-layer. It is highly application-specific. Of course, if you use a high-speed transmission, a line topology is recommended (daisy chained or with very short stubs). Star (single or double) topologies with terminations in the center are often used for Classical CAN. For CAN FD networks they can’t be recommended though. The same is true for hybrid topologies, made of a star and a line.

As early as 1992, CiA recommended a pinning for 9-pin D-sub connectors (DIN 41652)

In case of high-speed transmissions, both ends are terminated nominally with 120 Ohm matching the impedance of all physical layer components (cable, connector, optional galvanic isolation circuitry). In order to achieve a maximum network length, the physical layer components should not cause delays. For the high-speed transmission cable, a delay of 5 ns/m is suitable.

Also, the standardization for pin-assignment for different connectors belongs to the medium-dependent sub-layer. CiA has recommendations for the pinning of many connector types. The very first one for 9-pin D-sub connectors was already specified in 1992. Most companies use this pinning. Only CAN shields with a 9-pin D-sub connector for Raspberry have a different one.

For CANopen networks, the CiA 303-1 document provides more recommendations for the cabling and the other electro-mechanical components.