10 May

Now that we know how signals are put on the CAN bus, let’s examine how data packets are sent on the bus. The data packets are called “frames” on a CAN network. A frame is the message that is transmitted between nodes. It contains a message identification, necessary protocol information, data, a header and footer. The CAN specification allows for several types of frames for different purposes.

• Data Frame – Data sent from the transmitting device to one or more receiving devices.
• Remote Frame – A request for a specific type of data.
• Error Frame – Sent when any unit detects an error on the CAN bus.
• Overload Frame – Used by a device to delay further frames so it can have additional time to process the data it has received.
• Interframe space – Used to separate data or remote frames.

In addition to these types of frames, two formats are possible depending on the CAN version being used: Standard CAN format following the Bosch 2.0A specification and Extended CAN format following the Bosch 2.0B specification. We will examine the data frame in detail. If you need more information on the other frame types you should consult the Bosch CAN specification. The following diagram shows the various fields and bits in a CAN 2.0A standard data frame.

Figure 12-7: Standard data frame

Before a CAN node can start transmission of a data frame, it watches the bus for completion of any existing CAN frames. Once the bus is idle any node can begin transmission. The fields of a standard data frame are:

• Start Of Frame – The start of a frame is indicated when any node pulls the bus (low) dominant  (logic “0”) for 1 bit time (the duration of a bit time is explained later).

•Arbitration Field – The arbitration field is a 12-bit field consisting of an 11-bit Identifier and a single Remote Transmission Request bit (RTR bit).

o Identifier – Is the message identifier, transmitted most significant bit first. The 7 most significant bits cannot be all recessive (logic 1).

o RTR bit – Is dominant in a data frame and recessive in a remote frame.

• Control Field – The control field is six bits.

o Reserved bits – The first two bits are reserved for future expansion. Set to the dominant state.

o Data Length Code – The last four bits form a binary number (MSB is transmitted first) that indicates the number of bytes in the data field. Can have the value of 0 through 8.

• Data Field – These are the bytes of data to be transmitted. There can be 0 through 8 bytes, each transmitted most significant bit first.

• CRC Field – The Cyclic Redundancy Check field includes the CRC sequence and the CRC delimiter bit.

o CRC Sequence – The CRC sequence is a 15-bit CRC code. The CRC polynomial used is X15 + X14 + X10 + X8 + X7 + X4 + X3 + 1 The CRC sequence includes all bits including the Start of Frame bit, the arbitration field, the control field and through the end of the data field.

o CRC delimiter – The CRC delimiter is a recessive (logic 1) bit.

• ACK field – The Acknowledge (ACK) field is two bits that include an ac-knowledge slot and an acknowledge delimiter. During these two bits the transmitter sends two recessive bits. Any receiving device that has correctly received the frame will overwrite this bit with a dominant bit.

o ACK slot – The ACK slot is the time slot for other devices to acknowledge the receipt of the frame by writing a dominant bit.

o ACK delimiter – The ACK delimiter is a recessive bit. Note that by having the CRC delimiter and the AC delimiter be recessive, the ACK slot will always be surrounded by recessive bits.
• End Of Frame – The end of the frame is marked with seven recessive bits.

A CAN node transmits a data frame to any and all interested receivers whenever necessary by simply transmitting a message on the bus. This can be either some prearranged event, like the closure of a switch contact, or periodically based on some internal timer. Alternately, a receiving node can specifically request a data frame of a particular type be sent out on the bus by issuing a Remote Frame with the message identifier that matches the data frame that it is interested in.

A remote frame is formatted like a data frame but with three differences:

• The RTR bit is recessive to indicate this is a remote frame, not a data frame.
• There is NO data field.
• The data length code in the control field is ignored (it may not be set to 0, it may be the length of the data frame that is being requested).

Extended CAN Version 2.0B adds an 18-bit extension on the message identifier while maintaining 100% backward compatibility with standard CAN (CAN 2.0A and previous versions). Recall that there are two types of CAN 2.0A controllers:

• Ones that can transmit and receive only version 2.0A messages (11-bit mes-sage ID) and will issue an error on receiving a 2.0B message format.

• Ones that can transmit and receive 2.0A messages (11-bit message ID)  and will acknowledge 20.B messages (29-bit message ID) and ignore them.

So, it is possible for CAN 20.B controllers to work on a 2.0A CAN bus but there is a possibility that the reverse will not work depending on the capability of the 2.0A devices.

The differences between the standard format and the extended format are entirely in the arbitration field of a data frame (and remote frame). The following diagram shows the various fields and bits in a CAN 2.0B extended data frame.

Figure 12-8: Extended data frame
With the extended CAN frame message ID, essentially 20 bits are inserted after the 11-bit message ID in the arbitration field. Notice that the first two bits of the control field in standard CAN format were reserved and set to the dominant state. Extended CAN uses these reserved bits to indicate that this message is using an extended ID frame format. The new bits introduced for the extended format are:

• SRR bit – Substitute Remote Request bit. This bit is set to recessive (logic 1).
• IDE bit – Extended Identification bit. This bit is set to recessive.
• 18-bit extended identification – These are the additional 18 bits that make up the 29-bit message identifier in the extended format.

What this means is that if a receiving CAN node notices what it thinks are the two reserved bits to be recessive, then it knows that this frame is really an extended frame (so those bits then become the SRR and IDE bits). Also note that with the SRR (R0) and IDE (R1) bits set to recessive, standard format frames are given priority over extended format frames. We will discuss message priority in the next section. CAN devices can also transmit error frames when errors are detected, overload frames when a receiver requires additional time, or an interspace frame to separate sequential data or remote frames. Details of these frames can be found in the Bosch CAN specification.

Random Posts

Comments are closed.