Data Frame
The data frame is in two formats: standard (having an 11-bit ID) and extended (having a 29-bit ID). The data frame is used by the transmitting device to send data to the receiving device, and the data frame is the most important frame handled by the user.
Figure 9.7 shows the data frame’s structure. A standard data frame starts with the start of frame (SOF) bit, which is followed by an 11-bit identifier and the remote
transmission request (RTR) bit. The identifier and the RTR form the 12-bit arbitration field. The control field is 6 bits wide and indicates how many bytes of data are in
the data field. The data field can be 0 to 8 bytes. The data field is followed by the
CRC field, which checks whether or not the received bit sequence is corrupted.
The ACK field is 2 bits and is used by the transmitter to receive acknowledgment of a valid frame from any receiver. The end of the message is indicated by a 7-bit end of frame (EOF) field. In an extended data frame, the arbitration field is 32 bits wide (29-bit identifier þ1-bit IDE to define the message as an extended data frame þ1-bit SRR which is unused þ1-bit RTR) (see Figure 9.8).
Start of Frame (SOF)
The start of frame field indicates the beginning of a data frame and is common to both standard and extended formats.
Arbitration Field
Arbitration is used to resolve bus conflicts that occur when several devices at once start sending messages on the bus. The arbitration field indicates the priority
of a frame, and it is different in the standard and extended formats. In the standard format there are 11 bits, and up to 2032 IDs can be set. The extended format
ID consists of 11 base IDs plus 18 extended IDs. Up to 2032 x 218 discrete IDs can be set.
During the arbitration phase, each transmitting device transmits its identifier and compares it with the level on the bus. If the levels are equal, the device continues to transmit. If the device detects a dominant level on the bus while it is trying to transmit a recessive level, it quits transmitting and becomes a receiving device.
After arbitration only one transmitter is left on the bus, and this transmitter continues to send its control field, data field, and other data.
The process of arbitration is illustrated in Figure 9.9 by an example consisting of three nodes having identifiers:
Assuming the recessive level corresponds to 1 and the dominant level to 0, the arbitration is performed as follows:
• All the nodes start transmitting simultaneously, first sending SOF bits.
• Then they send their identifier bits. The 8th bit of Node 2 is in the recessive state, while the corresponding bits of Nodes 1 and 3 are in the dominant state. Therefore Node 2 stops transmitting and returns to receive mode. The receiving phase is indicated by a gray field.
• The 10th bit of Node 1 is in the recessive state, while the same bit of Node 3 is in dominant state. Thus Node 1 stops transmitting and returns to receive mode.
• The bus is now left to Node 3, which can send its control and data fields freely. Notably, the devices on the bus have no addresses. Instead, all the devices pick up all
the data on the bus, and every node must filter out the messages it does not want.
Control Field
The control field is 6 bits wide, consisting of 2 reserved bits and 4 data length code (DLC) bits, and indicates the number of data bytes in the message being transmitted. This field is coded as shown in Table 9.1, where up to 8 transmit bytes can be coded with 6 bits.
Data Field
The data field carries the actual content of the message. The data size can vary from 0 to 8 bytes. The data is transmitted with the MSB first.
CRC Field
The CRC field, consisting of a 15-bit CRC sequence and a 1-bit CRC delimiter, is used to check the frame for a transmission error. The CRC calculation includes the start of frame, arbitration field, control field, and data field. The calculated CRC and the received CRC sequence are compared, and if they do not match, an error
is assumed.
ACK Field
The ACK field indicates that the frame has been received normally. This field consists of 2 bits, one for ACK slot and one for ACK delimiter.