Controller Area Network (CAN)

The controller area network (CAN) is a deterministic protocol optimized for short messages. It was first introduced by Bosch in 1985 for replacing point- to-point interconnections in automotive control applications. The automotive industry quickly adopted CAN and, in 1993, it became the international

FIGURE 3.8

UDP/IP frame embedded in an Ethernet frame.

FIGURE 3.9

(See color insert.) Features of CAN.

standard known as ISO 11898. Since 1994, several higher-level protocols have been standardized on CAN, including CANopen [5] and DeviceNet [6].

Each device on the network has a CAN controller chip and all devices on the network see all transmitted messages. Each device can decide if a message is relevant or if it should be filtered. This structure makes a CAN flexible; additional nontransmitting nodes can be added without modification to the network.

Each message on the CAN has a priority. The message priority is specified in the arbitration field. Higher priority messages always gain access to the medium during arbitration. Therefore, the transmission delay for higher priority messages can be guaranteed. Figure 3.9 shows the relevant features of CAN.

The different fields of the CAN frame are explained as follows:

SOF (start-of-frame) bit

Indicates the beginning of a message with a dominant (logic 0) bit. It is usually a transition from a logic 1 to logic 0.

Arbitration ID

Identifies the message and indicates the priority of the message. Frames may be in two formats—standard, with 11-bit arbitration ID, and extended, with a 29-bit arbitration ID. Figure 3.9 shows a standard frame.

RTR (remote transmission request) bit

Serves to differentiate a remote frame from a data frame. A Lo RTR bit indicates a data frame and a Hi RTR bit indicates a remote frame. A remote transmission request is a message without any data, sent by one node, to request other node(s) to transmit the message of the same ID but with data.

DLC (data length code)

Indicates the number of bytes the data field contains.

Communication Protocols

Data Field

Contains 0-8 bytes of data.

CRC (cyclic redundancy check)

Contains 15-bit cyclic redundancy check code and a recessive delimiter bit. The CRC field is used for error detection.

ACK (ACKnowledgment) slot

Any CAN controller that correctly receives the message sends an ACK bit (Hi) at the end of the message. The transmitting node checks for the presence of the ACK bit on the bus and reattempts transmission if no acknowledgment is detected.

EOF

The end of frame is communicated by a 7-bit interval, consisting of a sequence of 1s. Since CAN uses bit stuffing, where a complementary bit is inserted after every six consecutive 1s or 0s in the message, this sequence does not occur in the rest of the message. The EOF, an interframe space (Hi) is also observed; the exact length of this varies depending on the length of time specified for bus idle for a given CAN controller.

59

Typical transmission speed is 1 Mbps up to a length of 40 m. The media access in CAN is an example of CSMA/CA and is implemented using a binary countdown mechanism. The identifier field indicates the priority of a message, which is transmitted in the binary form. As soon as a node transmits a 0, the bus is in the dominant state. The bus is in the recessive state if all the nodes transmit a 1. A node stops transmitting as soon as it tries to transmit a recessive bit when the bus is in the dominant state. The binary countdown ensures that messages with higher priority are transmitted first. This is explained with an illustrative example as follows:

Example 3.1

Two nodes start competing for the network at the same instant and try to send messages with IDs 4 and 5 (decimal) at the same instant. This is what happens:

  • 1. Node with message ID 4 transmits a 1 (Hi) and the node with message ID 5 transmits a 1 (Hi). The bus is now in a recessive state and both nodes transmit a 1.
  • 2. Node with message ID 4 transmits a 0 (Lo) and the node with message ID 5 transmits a 0 (Lo). The bus is now in a dominant state and none of the nodes transmit 1.
  • 3. Node with message ID 4 transmits a 0 (Lo) and the node with message ID 5 transmits a 1 (Hi). The bus is now in the dominant state and therefore the node with message ID 5 is stopped.

The major disadvantage of CAN compared with the other networks is the slow data rate (typically 1 Mbs). The NRZ code also restricts the frame size. Thus CAN is suitable for small data sizes. Individual manufacturers have specific implementations of CAN and readers are referred to Watterson [7].

The transmission time of a CAN message containing D bytes of data can be approximated as [8]

The value of G equals 34 for a 11 bit identifier and tbit is the transmission time for a single bit across the CAN. For a CAN, the worst-case response time for a message is defined as the largest time interval between the instant at which the initiating event for the message occurs and the instant at which it is received by the nodes that require it. As reported in Davis et al. [8] the response time R can be approximated as

where Tj represents the queuing jitter defined as the largest value of the time interval between the initiating event and the instant at which the message is queued, Tw is the queuing delay representing the maximum time a message has to wait in a queue before transmission, and TD represents the transmission time defined by Equation 3.5. The value of Tw varies because a message may be blocked because of the following reasons:

  • • Lower priority messages that may be in the process of being transmitted when message is queued.
  • • Higher priority messages that may win arbitration and be transmitted.

Defining Tblock as the maximum blocking time, the maximum value of the blocking time for a message can be estimated as the maximum transmission time associated with any message in the worst case, if the message is blocked by lower priority messages only. A detailed analysis leading to an estimate of the maximum queuing delay Tw is presented in Davis et al. [8].

 
Source
< Prev   CONTENTS   Source   Next >