</>EmbeddedInterview

How does a CAN frame look?

MediumCommunication Protocols

Short answer: A classic CAN (2.0A) data frame is: SOF (one dominant bit), the arbitration field (11-bit identifier + RTR bit; 29-bit identifier in 2.0B extended frames), the control field (IDE, reserved bit, 4-bit DLC giving 0–8 data bytes), the data field (0–8 bytes), a 15-bit CRC + delimiter, the ACK slot + delimiter, and EOF (7 recessive bits), followed by a 3-bit intermission.

| SOF | ID (11) | RTR | IDE | r0 | DLC (4) | DATA (0-64 bits) | CRC (15) | CRC del | ACK | ACK del | EOF (7) |

Key points

  • Dominant (0) vs recessive (1): a dominant bit from any node overrides recessive bits.
  • ACK slot: the transmitter sends recessive; any node that received the frame correctly drives it dominant. An ACK means "someone received it", not "the intended receiver processed it".
  • Bit stuffing: after five identical consecutive bits, the transmitter inserts one bit of opposite value (from SOF through CRC), giving enough edges for receivers to stay synchronised; receivers remove stuff bits. Six identical bits in a row is an error (used deliberately by error frames).
  • Frame types: data frame, remote frame (RTR = 1, requests data; rarely used and removed in CAN FD), error frame, overload frame.
  • Extended frames (2.0B): 11-bit base ID + SRR + IDE = 1 + 18-bit extension = 29-bit ID.

Efficiency: a frame with 8 data bytes is about 111 bits plus stuff bits (up to ~135), so at 500 kbps a full frame takes ~0.25 ms and the payload efficiency is under 50%.

On Linux: SocketCAN (candump can0, cansend can0 123#DEADBEEF) and struct can_frame.