Documentation sections
CAN Bus Bit Timing Calculator
POSThttps://rftools.io/ api/ py/ v1/ calculate
Slug can-bus-timing. Calculate CAN bus bit timing parameters including prescaler, time quanta, sync segment, propagation segment, and phase buffer segments for a given baud rate and sample point
Inputs
Send every one of these in inputs, in the units shown. Most are required: a call without one is refused (400) and costs nothing; one the calculator can do without takes the default shown. An input outside its range is still computed and flagged in the provenance.
| Name | Unit | Range | Default | Description |
|---|---|---|---|---|
| clockFreqnumber | MHz | at least 1 | 48 | Microcontroller peripheral clock frequency feeding the CAN controller |
| baudRatenumber | kbps | at least 1 | 500 | Target CAN bus baud rate |
| samplePointnumber | % | 50 … 95 | 87.5 | Sample point position as percentage of bit time (CiA 601 recommends 75–87.5%) |
| sjwnumber | tq | 1 … 4 | 1 | How far a resynchronisation may move the sample point; a wider jump lets the bus take a looser clock, up to the length of either phase segment |
Outputs
Returned in values, by key. A value that is unbounded or undefined is null.
| Field | Unit | Description |
|---|---|---|
| tq | ns | Time Quantum (TQ) |
| nominalBitTime | tq | Nominal Bit Time |
| syncSeg | tq | Sync Segment |
| propSeg | tq | Propagation Segment |
| phase1 | tq | Phase Buffer 1 (BS1) |
| phase2 | tq | Phase Buffer 2 (BS2) |
| prescalerheadline | none | Prescaler |
| bitRateActual | kbps | The clock over the prescaler and the quanta of the bit as programmed |
| bitRateError_pct | % | Actual over requested, signed; it adds to the oscillator's own tolerance |
| samplePointActual | % | Sync, propagation and phase 1 over the whole bit, in whole quanta |
| oscTolerance_pct | % | The largest deviation from nominal each node's clock may have (ISO 11898-1): the smaller of min(PS1, PS2)/(2·(13·NBT − PS2)) and SJW/(20·NBT) |
Calling it
- Calculate: one call, the request and response in full, and its errors.
- Batch: this calculator with others, or a sweep, in one request.
- Solve for a target: the value of one input that brings an output to a target.