What is a CAN bit time and how are its segments configured?
Short answer: Each CAN bit is divided into time quanta (tq) derived from the CAN controller clock through a prescaler. The bit consists of the Sync segment (always 1 tq, where edges are expected), the Propagation segment (compensates for signal round-trip delays), Phase segment 1 and Phase segment 2. The sample point is between phase 1 and phase 2, typically at 75–87.5% of the bit. The SJW (synchronisation jump width) limits how much the controller may lengthen phase 1 or shorten phase 2 to resynchronise on edges.
|Sync| Prop | Phase 1 | Phase 2 |
1 tq sample point ↑
Worked example: 500 kbps from a 40 MHz CAN clock
- Choose prescaler 5 → tq = 125 ns (8 MHz).
- Bit time at 500 kbps = 2 µs = 16 tq.
- Sync 1 + Prop + Phase1 = 13 tq, Phase2 = 2 tq → sample point = (1 + 13) / 16 = 87.5%.
- SJW = 2 tq (≤ Phase2).
(Many controllers combine Prop and Phase 1 into one "TSEG1" register field: TSEG1 = 13, TSEG2 = 2.)
Guidelines
- Use the same sample point on all nodes, as recommended by your network specification (CiA recommends ~87.5% for classic CAN at most rates; automotive OEMs specify exact values).
- More tq per bit (e.g. 16–25) gives finer adjustment and better tolerance.
- Oscillator tolerance: classic CAN typically needs ≤ ±0.5% (depends on bit timing; ±1.58% maximum theoretical with ideal settings); use crystals, not RC oscillators.
- CAN FD needs separate nominal and data-phase timings plus transceiver delay compensation.
Tools: bit-timing calculators (e.g. bittiming.can-wiki.info), and on Linux, ip -details link show can0 shows the computed segments.