askvity

What is CAN Frame Format?

Published in CAN Frame Format 4 mins read

The CAN (Controller Area Network) frame format defines the structure of messages transmitted over a CAN bus. It dictates how data and control information are organized into distinct fields to ensure reliable communication between nodes in a network. As a message-based protocol, CAN utilizes a Message ID to identify each frame and determine its priority, enabling arbitration on the bus.

There are two primary CAN frame formats: the Standard Frame (CAN 2.0A) and the Extended Frame (CAN 2.0B). The main difference lies in the length of the Message ID.

Standard CAN Frame Format (CAN 2.0A)

The Standard CAN frame consists of several fields:

  • Start of Frame (SOF): A single dominant bit indicating the start of a frame.
  • Arbitration Field: Contains the Message ID and the Remote Transmission Request (RTR) bit.
    • The Message ID is crucial for identifying the message content and its priority. In a standard frame, the Message ID is 11 bits long.
    • Based on the provided information, CAN is a message-based protocol where each frame is identified by a Message ID. In a standard frame, the Message ID is 11 bits long.
    • It is noted that typically, the 11th and 4th bits of the Message ID are masked for complex reasons, resulting in 9 unique bits being commonly used for identification purposes.
    • The RTR bit indicates whether the frame is a data frame (dominant) or a remote request frame (recessive).
  • Control Field: Includes the Identifier Extension (IDE) bit (dominant for standard format), a reserved bit (r0), and the Data Length Code (DLC).
    • The DLC specifies the number of bytes in the data field (0 to 8 bytes).
  • Data Field: Contains the actual data being transmitted. Its length is determined by the DLC, ranging from 0 to 8 bytes.
  • CRC Field: Contains the Cyclic Redundancy Check sequence and a CRC Delimiter bit, used to detect transmission errors.
  • ACK Field: Consists of an Acknowledge Slot and an Acknowledge Delimiter bit. The receiver uses the Acknowledge Slot to signal successful reception of a valid frame.
  • End of Frame (EOF): A sequence of seven recessive bits marking the end of the frame.
  • Interframe Space (IFS): A minimum sequence of recessive bits separating consecutive frames.

Structure Overview

Here's a simplified view of the Standard CAN Frame structure:

Field Length (bits) Description
SOF 1 Start of Frame
Arbitration 12 Message ID (11 bits) + RTR (1 bit)
Control 6 IDE (1 bit) + r0 (1 bit) + DLC (4 bits)
Data 0-64 Message data (0 to 8 bytes)
CRC 16 CRC Sequence (15 bits) + CRC Delimiter (1 bit)
ACK 2 Acknowledge Slot (1 bit) + ACK Delimiter (1 bit)
EOF 7 End of Frame
Interframe 3+ Interframe Space (minimum 3 bits)

Extended CAN Frame Format (CAN 2.0B)

The Extended CAN frame format is similar to the standard format but includes an extended 29-bit Message ID. This is achieved by adding an 18-bit extension to the 11-bit base ID. The IDE bit in the Control Field is recessive to indicate an extended frame. This allows for a significantly larger number of unique identifiers compared to the standard 11-bit ID.

In summary, the CAN frame format provides a robust structure for message-based communication, with the Message ID playing a central role in identifying frames and managing bus access. The standard format uses an 11-bit ID (often effectively 9 unique bits due to masking), while the extended format uses a 29-bit ID.

Related Articles