CAN bit timing calculator
Find the prescaler and time segments for a CAN bit rate and sample point, within your controller's register limits.
Values
Results
- Prescaler
- Sample point
- Bit rate
All settings that fit
Sorted by bit rate error, then sample point. Pick a row to see its details.
| Selected | Prescaler | Quanta | TSEG1 | TSEG2 | Sample point | Error |
|---|
How it's calculated
A CAN bit is divided into time quanta. It starts with one quantum of sync segment, then time segment 1 (propagation plus phase segment 1), then phase segment 2. The controller samples the bus between the two time segments.
tq = prescaler / fq
bit rate = fq / (prescaler × (1 + TSEG1 + TSEG2))
sample point = (1 + TSEG1) / (1 + TSEG1 + TSEG2)
Here fq is the clock the prescaler divides. The SJA1000 and MCP2515 halve their oscillator first, so a 16 MHz crystal gives an 8 MHz fq.
The search tries every bit length and prescaler your controller allows, keeps those within the bit rate error you chose, and splits each bit for the sample point nearest your target, preferring the earlier one on a tie. It follows the ISO 11898-1 rules that a bit is at least 8 quanta and phase segment 2 is at least 2. The default sample point is the CAN in Automation recommendation: 87.5% up to 500 kbit/s, 80% up to 800 kbit/s, and 75% above.
Register values assume single sampling. For the MCP2515, time segment 1 is split evenly into propagation and phase segment 1, as the Linux driver does. Results were checked against the Linux kernel's bit timing calculation, PEAK's built-in PCAN register values, and Kvaser's CANlib algorithm.