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
- CAN controller clock (Hz)
- Desired bit rate (bps)
- Time quanta per bit
Notes and assumptions
- This sizes the prescaler for the requested bit time; splitting TQ into Prop/Phase1/Phase2 segments for a specific sample point is a further step defined by your CAN controller's datasheet.
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
- Enter the CAN controller clock.
- Enter the bit rate (125k, 250k, 500k or 1M are common).
- Enter the time quanta per bit.
- 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:
- CAN controller clock: 16M Hz
- Desired bit rate: 250k bps
- Time quanta per bit: 16
The calculator gives:
- Result: 250000 bps (actual)
- Prescaler (BRP): 4
- Time quantum: 250 ns
Tips and common mistakes
- All nodes must match closely — CAN tolerates far less error than a UART.
- A sample point near 87.5 % is a common recommendation; set it with the phase segments.
- Higher bit rates allow shorter buses (about 40 m at 1 Mbit/s).
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.