CAN Bit Rate Calculator

Find the CAN controller prescaler for a target bit rate and its actual error.

Formula

BRP = round(Fclk / (bitrate × TQ)) → actual bitrate = Fclk / (BRP × TQ)

Inputs

Notes and assumptions

What it does

A CAN controller divides its clock by a prescaler (BRP) and splits each bit into time quanta (TQ). This finds the prescaler for your bit rate and the resulting error.

Where it's used

Configuring CAN on automotive ECUs, STM32 / ESP32 (TWAI) and industrial CANopen nodes.

How to use it

  1. Enter the CAN controller clock.
  2. Enter the bit rate (125k, 250k, 500k or 1M are common).
  3. Enter the time quanta per bit.
  4. Aim for 0 % error; try another TQ count if it is not exact.

The formula explained

BRP
round(F_clk / (bit rate × TQ)) — prescaler
TQ
time quanta in one bit (sync + prop + phase 1 + phase 2)
Actual rate
F_clk / (BRP × TQ)

Worked example

250 kbit/s from a 16 MHz clock.

Inputs:

The calculator gives:

Tips and common mistakes

Questions people ask

What is the formula?

Bit rate = clock / (BRP × time quanta per bit). 16 MHz / (4 × 16) = 250 kbit/s exactly.

How do I set the sample point to 87.5 %?

Divide the bit into sync (always 1 TQ), TSEG1 and TSEG2. With 16 TQ, TSEG1 = 13 and TSEG2 = 2 put the sample point after (1 + 13) / 16 = 87.5 % of the bit.

How long can a CAN bus be?

Roughly 40 m at 1 Mbit/s, 100 m at 500 kbit/s, 250 m at 250 kbit/s and 500 m at 125 kbit/s. The limit comes from the signal round-trip time within one bit.

Related Embedded & Comms calculators

Enter your values to get the result with the formula, substituted values and an explanation of each step.

All engineering calculators