The CAN Protocol Tour
CAN Messages, page 1 of 3
The CAN bus is a broadcast type of bus. This means that all nodes can “hear” all transmissions. There is no way to send a message to just a specific node; all nodes will invariably pick up all traffic. The CAN hardware, however, provides local filtering so that each node may react only on the interesting messages.
The CAN messages
CAN uses short messages – the maximum utility load is 94 bits. There is no explicit address in the messages; instead, the messages can be said to be contents-addressed, that is, their contents implicitly determines their address.
There are four different message types (or “frames”) on a CAN bus:
- the Data Frame,
- the Remote Frame,
- the Error Frame, and
- the Overload Frame.
The Data Frame
Summary: “Hello everyone, here’s some data labeled X, hope you like it!”
The Data Frame is the most common message type. It comprises the following major parts (a few details are omitted for the sake of brevity):
- the Arbitration Field, which determines the priority of the message when two or more nodes are contending for the bus. The Arbitration Field contains:
- For CAN 2.0A, an 11-bit Identifier and one bit, the RTR bit, which is dominant for data frames.
- For CAN 2.0B, a 29-bit Identifier (which also contains two recessive bits: SRR and IDE) and the RTR bit.
- the Data Field, which contains zero to eight bytes of data.
- the CRC Field, which contains a 15-bit checksum calculated on most parts of the message. This checksum is used for error detection.
- an Acknowledgement Slot; any CAN controller that has been able to correctly receive the message sends an Acknowledgement bit at the end of each message. The transmitter checks for the presence of the Acknowledge bit and retransmits the message if no acknowledge was detected.
Note 1: It is worth noting that the presence of an Acknowledgement Bit on the bus does not mean that any of the intended addressees has received the message. The only thing we know is that one or more nodes on the bus has received it correctly.
Note 2: The Identifier in the Arbitration Field is not, despite of its name, necessarily identifying the contents of the message.A CAN 2.0A (“standard CAN”) Data Frame.
A CAN 2.0B (“extended CAN”) Data Frame.