Reference for CAN 2.0 and CAN FD at the frame, bit and error-handling level - frame formats, DLC mapping, arbitration, bit timing, CRC and stuffing, error states, timestamps and direction. Use when designing frame handling, decode, adapters, bit-rate settings or validating CAN data.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Can Protocol Fundamentals?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/afri-bit-can-protocol-fundamentals)
---
name: can-protocol-fundamentals
description: Reference for CAN 2.0 and CAN FD at the frame, bit and error-handling level - frame formats, DLC mapping, arbitration, bit timing, CRC and stuffing, error states, timestamps and direction. Use when designing frame handling, decode, adapters, bit-rate settings or validating CAN data.
---
# CAN and CAN FD fundamentals (ISO 11898-1)
## Frames
| Aspect | Classic CAN | CAN FD |
|--------|-------------|--------|
| ID | 11-bit (base) or 29-bit (extended, IDE=1) | same |
| Payload | DLC 0-8 -> 0-8 bytes | DLC 0-8 -> 0-8; 9..15 -> 12, 16, 20, 24, 32, 48, 64 bytes |
| Remote frame | RTR bit; no data | **not supported** (RRS bit instead) |
| Flags | RTR, IDE | FDF/EDL=1, **BRS** (faster data phase), **ESI** (transmitter error-passive) |
| CRC | CRC-15 | CRC-17 (<=16 data bytes), CRC-21 (>16); stuff-bit counter in CRC field |
| Max bit rate | 1 Mbit/s | arbitration up to 1 Mbit/s; data phase typically up to 5-8 Mbit/s |
Rules: DLC > 8 on classic CAN means 8 bytes. In FD, payload length must be one of the valid sizes; a 9-byte "FD frame" is invalid - pad to 12. Identifier priority: **lower numeric ID wins arbitration** (dominant 0 beats recessive 1); 11-bit base IDs beat extended frames with the same base because of the IDE/SRR ordering. Treat `(id, extended)` as the frame key - 0x123 standard and 0x123 extended are different frames.
## Bit timing
Nominal bit = Sync + Prop + Phase1 + Phase2 time quanta; sample point typically 75-87.5 %; SJW resynchronises. FD has separate **nominal** and **data** bit timing. Mismatched data-phase settings produce error frames, not garbage - treat them as errors.
## Error handling
Error-active -> error-passive (TEC or REC > 127) -> **bus-off** (TEC > 255). Error frames (6 dominant bits + delimiter) and overload frames exist on the wire; most adapters surface them as special events. Surface them; never decode them as data.
## Timestamps and direction
Frame timestamps come from **hardware** (adapter clock, best), **driver** or **host** (worst, jitter in ms). Record the source. Tx echo (loopback confirmation) is distinct from Rx; do not double-count. Multiple channels need a channel id per frame; do not mix clock domains without conversion.
## Implementation checklist
- Validate DLC/length consistency for classic vs FD before decode.
- Keep `fd`, `brs`, `esi`, `extended`, `rtr`, `dir`, `channel` on every frame; never infer FD from length alone.
- Test boundaries: DLC 0, 8, 9->12, 15->64; ID 0x7FF and 0x1FFFFFFF; zero-length FD.
- Bus load estimate: bits per frame (incl. stuffing) x frames/s / bit rate; useful for monitor stats.