CAN bus bit timing calculator

CAN bitrate = clock ÷ (prescaler × time quanta per bit), and sample point = (1 + PropSeg + PhaseSeg1) ÷ time quanta per bit. Enter your controller's clock and segment settings to check bitrate, sample point and oscillator tolerance.

Hz

The clock feeding the prescaler (the CAN kernel or peripheral clock).

Some register fields store prescaler − 1; Microchip MCP2515 divides by 2 × (BRP + 1). Enter the real divide ratio.

Controllers with a single TSEG1 field: enter TSEG1 here and 0 below; tolerance then assumes PhaseSeg1 = TSEG1.

Result

Bitrate (kbit/s)500.00
Sample point87.5 %
Time quanta per bit16
Time quantum (ns)125.0
Bit time (µs)2.000
Max oscillator tolerance0.313 %each node's clock must stay within this

Planning estimate from the formula below, not a measurement.

How it works

The formula, the method step by step, then a worked example.

t_q = prescaler ÷ f_clk;  N = 1 + PropSeg + PS1 + PS2;  bitrate = f_clk ÷ (prescaler × N);  sample point = (1 + PropSeg + PS1) ÷ N;  Δf ≤ min( min(PS1, PS2) ÷ (2 (13N − PS2)),  SJW ÷ (20N) )
  1. The controller divides its clock by the prescaler to get one time quantum (tq).
  2. A bit is the sync segment (always 1 tq) plus the propagation segment and the two phase segments.
  3. The bit is sampled at the end of phase segment 1, so the sample point is the share of the bit before it.
  4. Oscillator tolerance is the worst clock mismatch between nodes that resynchronization can absorb: the smaller of the two conditions from the CAN specification.

Worked example

Inputs

CAN controller clock
16000000 Hz
Prescaler (divide ratio actually applied)
2
Propagation segment (tq)
7
Phase segment 1 (tq)
6
Phase segment 2 (tq)
2
Synchronization jump width (tq)
1

Result

Bitrate (kbit/s)500.00
Sample point87.5%
Time quanta per bit16
Time quantum (ns)125.0
Bit time (µs)2.000
Max oscillator tolerance0.313%

Assumptions and limits

  • Classical CAN arbitration phase. CAN FD data-phase timing needs its own settings and transmitter delay compensation.
  • Bus length and transceiver delay must fit inside the propagation segment; this calculator does not check that.
  • Register encodings differ by controller (many store value − 1); enter the real lengths in tq.

Related terms

Frequently asked

How do you calculate CAN bus bitrate?

Bitrate = clock ÷ (prescaler × time quanta per bit). Time quanta per bit is 1 (sync) + propagation + phase segment 1 + phase segment 2. A 16 MHz clock, prescaler 2 and 16 tq per bit gives 500 kbit/s.

What sample point should I use for CAN?

About 87.5% is the common choice for automotive and CANopen networks at most bitrates. What matters most is that every node on the bus uses a similar sample point, because large differences reduce the margin for bus delay and clock error.

What is SJW in CAN bit timing?

Synchronization jump width is the most time quanta a node may lengthen or shorten a bit by to stay in step with the transmitter. A larger SJW tolerates more clock error between nodes, but it may not exceed either phase segment.

How accurate does a CAN clock need to be?

It follows from the bit timing. With 16 tq per bit, phase segment 2 of 2 and SJW of 1, each node's clock must stay within about 0.31%. Crystal oscillators meet this easily; internal RC oscillators often do not.

Answers draw on the sources below.

Sources

  1. ISO 11898-1:2015 Road vehicles - Controller area network (CAN) - Part 1: Data link layer and physical signalling · International Organization for Standardization
  2. CAN Specification Version 2.0 (bit timing and oscillator tolerance) · Robert Bosch GmbH, 1991
  3. AN754: Understanding Microchip's CAN Module Bit Timing · Microchip Technology
  4. Configure Controller Area Network (CAN) Bit Timing to Optimize Performance · Analog Devices, Analog Dialogue
  5. CAN knowledge: CAN physical layer and bit timing · CAN in Automation (CiA)

Spot an error? Tell us.