In addition to the implementability of very low-cost system solutions, CAN-based networks have a series of special features compared with other system solutions. The main performance features of the CAN protocol are presented in brief in the following:
Controller Area Network message transfer according
to the producer-consumer principle
Contrary to "node-oriented" transmission, where a message transfer occurs between two certain nodes, the transmission of messages with CAN is based on the so-called "producer-consumer principle". A message transmitted by a producer node can be received by all other consumer nodes. For this, messages are not marked by a destination address but instead by an unambiguous "message identifier". The transmission of messages to all nodes of a network is also referred to as "broadcasting". In the CAN protocol, messages usually have an 11-bit long identifier (standard format). This means that 2048 different messages per system can be defined. This number is more than sufficient in most applications. However, for special applications (e.g. heavy duty vehicles, SAE J1939) the use of 29-bit long identifiers (extended format) and thus the definition of up to 512 million different messages is also possible. A node must filter the messages which are relevant for it from the message stream on the bus.
For this purpose, the CAN protocol controller chips provide mechanisms implemented by hardware in the form of so-called acceptance filtering.
Multimaster-capable, event-oriented message transmission of CAN
Each node of a CAN network can initiate the transmission of a message as soon as the bus is free. As it may happen that more than one network node begins with the transmission of a message at the same time, an arbitration process is necessary, which ensures only one node actually continues with the transmission of its message.
As every node can initiate a message transfer, a direct message transfer between all nodes of the network is possible. Thus it is also possible to only transmit messages when this is required, i.e. a corresponding event has occurred. Compared to a cyclic message transfer, a considerably lower bus load or a reduction in the required data transmission rate results.
Lossless, bit-wise bus arbitration
As in a CAN network every node can begin with the transmission of a message as soon as the bus is free, it is possible several nodes begin with a transmission process at the same time. To prevent the nodes from destroying each others transmitted data, the message with the highest priority of all simultaneously arbitrating messages is determined in an arbitration phase. Only the network node that transmits the actual highest priority message may continue with the transmission of its message. The message with the lowest value of the message identifier has the highest priority. Fig. 1 shows the principle used for the bus arbitration. Each node monitors the signal level on the bus during the arbitration phase. The arbitration phase consists of the transmission of the message identifier and of the so-called RTR bit. If a network node detects a dominant bus level (dominant bit), although it has switched a recessive level (recessive bit) itself, it aborts the transmission process immediately, as in this case a message with higher priority is obviously being transmitted at the same time, and goes into the receive state. As a message is transmitted with every bus arbitration, the process ensures "lossless" bus access.
Fig. 1: Principle of lossless, bit-wise bus arbitration - Node 1, 2 and 3 start arbitration simultaneously. At point 2, node 2 detects that instead of its recessive driven bus level, the bus shows a dominant level and therefore stops arbitration. The same occurs with node 1 at point 3. At the end of the arbitration phase only node 3 continues to transmit its message.
Priority-oriented message transmission
The arbitration process described above guarantees that the message with the highest priority in each case is always transmitted as soon as the bus is free. The priority of the message is determined by the value of the message identifier. The smaller this value is, the higher the priority of the message. The principle of priority-oriented messages enables a very efficient use of the bandwidth available for data transmission. Therefore it is possible that low-priority messages occupy the bus 100% without substantially delaying the transmission of messages with higher priority messages. For the message with the highest priority, a maximum latency time of approx. 130 µs results at a transmission rate of 1 Mbit/s. On the other hand, when designing a CAN system it must be ensured that high-priority messages do not constantly occupy the bus. This is possible, for example, by introducing a transmission inhibit time (CANopen: "Inhibit Time").
Bitrate and bus length of CAN systems
The principle of bit-wise arbitration used with CAN requires a comparison of the local bit levels of all network nodes distributed over the bus within a bit-time interval. As the signal propagation time required for the signal distribution over the bus is proportional to the length of the bus, the necessary duration of a bit interval is prolonged accordingly with increasing bus length.
The maximum bus length (network extension) and maximum bit rate are thus inversely proportional. For bus lengths of more than 100 m, the following rule of thumb can be used for calculation:
Baudrate (in Mbit/s) x bus length (in m) = 60.
Message length and maximum message rate
A maximum of 8 bytes of data can be transmitted with one CAN message. The available data transmission capacity is sufficient for most applications in the field of automation systems or in motor vehicles. Larger data blocks, e.g. for device configuration, can be transmitted by a series of consecutive CAN messages. The main advantages of short messages are the shorter latency times for high-priority messages and the ability to transmit even in environments with high fault-intensity. For short messages (transmission time), the probability that these can be transmitted undisturbed between two faults is considerably higher than for the transmission of longer messages.
With a bit rate of 1 Mbit/s, approx. 10,000 messages per second can be transmitted with an average data length of 4 bytes and up to approx. 7,200 messages per second with 8 bytes data length (standard format).
Efficient error detection and confinement
One of the most remarkable features of the CAN protocol is its particularly distinct ability to detect transmission errors. This therefore meets the very high requirements e.g. for the networking of control devices in motor vehicles. The high error detection capability is achieved by a combination of different measures of error detection. One of the most effective measures in this respect consists in the monitoring of the bus level by the transmitter of a message which detects all globally effective errors. In addition, every message receiver checks each received message based on the defined format elements and the CRC segment. In this way errors are detected which are only locally effective. In addition to the detection of transmission errors, the CAN protocol also contains a mechanism for detecting and shutting down defective network nodes. This ensures that defective network nodes cannot continually disturb the message transfer.
Error signaling instead of message acknowledgement
In contrast to communication concepts with node-oriented transmission, CAN as a message-oriented protocol uses the principle of error signaling. Each network node checks every message transmitted on the bus with respect to errors. As soon as a transmitting or receiving network node detects an error, it signals this to all other nodes by transmitting an error message (error frame). This contains a bit combination of six bits with the same polarity (which is due to bit stuffing not permitted), normally as a dominant bit sequence. All network nodes detect the error signal and cancel the segments of a message already received. Consistent data is thus ensured for all nodes of the network.
As soon as a transmitting node has transmitted an error frame or received one, it immediately attempts to transmit the previously transmitted message again with another bus arbitration process.
The error signaling mechanism ensures that the message transfer with all nodes of a network is error-free and consistent. As error signaling takes place immediately after an error is detected, very short error recovery times are possible.
The fact that the bus is only additionally occupied when an error has been detected also has the advantage of a considerably lower additional bus load.
The format of a CAN message
Fig. 2 shows the format of a standard CAN message. The beginning of a message is signaled by a leading dominant bit, followed by the 11 bit long message identifier and a further bit which distinguishes between a data frame and a data request frame (remote frame).
With a remote frame, a network node can request the transmission of a certain message by another node in the system. The control field specifies the transmission format (standard/extended) of a message and the number of subsequent data bytes.
The data field of a CAN message can contain between zero and eight data bytes. The data field is followed by the 15 bit CRC segment. This field is used by the receiver to check the received message. In the acknowledge field the transmitter of a message expects the acknowledgement signalling the error-free reception of the transmitted message from at least one receiving network node. This acknowledgement is given by the transmission of a dominant bit in the acknowledge slot by all nodes in the network which received the message free of errors. This acknowledgement is used exclusively for the confinement of defective sending nodes on the transmission side. Finally, the end-of-frame field indicates the complete error-free transmission of a CAN message.
Fig 2: Format of a standard CAN message (data frame). The format of a request message (remote frame) only differs in the value of the RTR bit and an empty data field.
Availability of standardized higher protocols and profiles for CAN
The CAN protocol standardized in ISO 11898 as described above corresponds to a layer 1/2 protocol in the sense of the OSI data communication model. However, for the implementation of networks, more extensive functions are necessary. For applications in embedded systems and industrial automation, two standards are available:
CANopen [2] and DeviceNet [2]. CANopen is the dominant standard for applications in embedded networks, DeviceNet is used especially in industrial automation in the environment of Rockwell Automation. For networks in trucks SAE J1939 is also an important standard [3][2].
Literature
[1]
Zeltwanger, H.: State-of-the-Art CAN Applications
and Future Requirements. Proc. 7th International CAN
Conference, 2000
[2]
Etschberger, K.: Controller Area Network (CAN)
Basics, Protocols, Chips and Applications.
ISBN: 3-00-007376-0, 2001
[3]
SAE International: Recommended Practice for a Serial Control & Communications Vehicle Network, SAE J1939, Aug. 2003