The following calculation sheet is mostly useful for classic CAN as defined in ISO-11898 before 2015. For the new CAN FD as defined in ISO-11898:2015 work is in Progress. CiA provides the document CiA 601-3 CAN FD bit-timing recommendations.
By providing the input clock frequency feed into the CAN clock Pre-scaler, the desired Sample Point location and selecting the CAN family, this page calculates possible register values to program CAN controllers for typical bit rates.
You can use the table in NXP SJA1000 mode (Like Philips or Intel) for controllers like:
- Philips 82C200, NXP SJA1000
- Intel 82527 (and derived from it Infineon (Siemens) C167CR, C515C, XC161C, XC164C, TwinCAN SAK82C900)
- Fujitsu (reported from Ralf Ebeling) and acknowledged by us for MB9054x
- Dallas 80c390 Dual CAN
- Toshiba TCAN
- Freescale msCAN (HCS12) and Frescale MCAN
- Holt Inc, H3110 stand alone CAN controller (with transceiver)
or select other CAN family types. The BOSCH C_CAN or D_CAN are often used in more modern implementations of different manufacturers( ST SPEAr, TI Sitara, ...) An explanation is given after the table (if calculation was called).
The table results in generic colums listing the values for number of tq, tseg1, tsegs, prescaler etc. and some hardware specifc register which can used to directly program the controller.
Yellow background rows are settings with recommended values, with an bittime consisting of 16 time quanta tq (Number of time quanta). At the time this tool was first developed, this seems to be the best value. in these days where we talk about CAN FD, as much as possible time quanta should be used to construct an bit time.
Copyright © 2013-2020 Heinz-Jürgen OertelAll rights reserved.
Allwinner A20Currently it is difficult to get a good documentation on the Allwinner A20 CAN module. Two different sources show two different results. The A20 manual Revision 1.0 (Feb 2013) chapter 6.16.3 shows a 16 bit Bit Timing Register.
The document "CAN Bus1.pdf" shows the same register picture while in section 1.5.6 the "CAN Bus Timing Register" description shows a 32 bit register which looks like:
This register layout was proved by an implementation of the can4linux device driver.
16 bit Bit CAN_CLK register setting BTR
16 bit Bit CAN_TIMING register setting SJW, SAM, TSEG2 and TSEG1
BlackFin BF70xAnalog Devices implemented the same CAN module as in the BlackFin BF50x series. Therefore the same bit timing register calculation can be used. But all registers are 32bit, with the highest 16 bits unused.
The ADSP-CM40x is a Mixed-Signal Control Processor with ARM Cortex-M4 core. Analog Devices implemented the same CAN module as in the BlackFin. Therefore the same bit timing register calculation can be used.
ATMEL AT91SAM9263Only one 32 bit register is used. Because of the minimum information processing time of 2tq (IPT=2tq) phase2 must be at least 2 tq.
- the AT91SAM7X (SAM7X512/256/128)
- the SAMA5D3 Cortex®-A5 processor series
- the SAM3X, SAM3A, ARM® Cortex®-M3 based
STR750 ARM7TDMI-based microcontroller family implements Bosch C-CAN Select BOSCH C_CAN to generate the bit timing values.
ATMEL CANaryFCAN is the input frequency used as table input.
The CANary module used by ATMEL for the T89C51(AT89C51CC02) and CAN-AVR family, uses three 8-bit registers to set-up the bit timing parameters required by the CAN protocol - CANBT1, CANBT2 und CANBT3. CANBT1 contains BRP, the bit timing prescaler at bits 1-6, value range 0-63. CANBT2 contains the programming time segment PRS = PROP_SEG (Bit 1-3) and CANBT3 contains the values for PHS1 = PHASE_SEG1 (Bit 1-3) and PHS2 = PHASE_SEG2 (Bit 4-6 in CANBT3).
For 125 kbit/s and 16 tq at 16 (8)Mhz
BRP = 3, PRS = 4, PHS1 = 7, PHS2 = 1
The C_CAN CAN Controller from Bosch was implemented in different
Therefor our table show the 8 bit values BTR0 und BTR1.
But often the 16bit value is used:
Bittiming Register BTR = (BTR1 << 8) | BTR0
8 bit Bit Timing Register BTR1 and BTR0
16 bit Bit Timing Register BTR
Besides the standard Bit Rate Prescaler BRP, the C_CAN module has the BRP Extension Register BRPE. By programming BRPE the Baud Rate Prescaler can be extended to values up to 1023. The actual interpretation by the hardware is that one more than the value programmed by BRPE (MSBs) and BRP (LSBs) is used.
The D_CAN CAN Controller from Bosch uses the same bit timing register model as the C_CAN module. The Texas Instruments Sitara AM335x combines it in one 32 bit register DCANBTR.
Bosch M_CANThe Bosch M_CAN CAN controller module ist the first one available supporting CAN FD and therefore needs a second bit rate specified for the fast part of the CAN data frame. Bit Timing is programmed via the Bit Timing & Prescaler Register (BTP). The CAN bit time may be programed in the range of 4 to 81 time quanta. The CAN time quantum may be programmed in the range of 1 to 1024 m_can_cclk periods. TSEG1 is the sum of Prop_Seg and Phase_Seg1. TSEG2 is Phase_Seg2.
Besides the typical values, prefixed with 'F' for 'fast', like FBRP, FTSEG1, FTSEG2
and FSJW, it has values for the Transceiver Delay Compensation Offset TDCO
and a disable/enable bit for Transceiver Delay Compensation TDC.
The Fast Baud Rate Prescaler has valid values from 0 to 31. FTSEG1 from 1 to 15, and FTSEG2 from 0 to 7. For all of them the actual interpretation by the hardware of this values is such that one more than the value programmed here is used. Note: The bit rate configured for the CAN FD data phase via FBTP must be higher or equal to the bit rate configured for the arbitration phase via BTP.
To simplify programming the fast bit rate, the programm allows only the fast bit rate to be multiple of the arbitration bit rate.
Freescale is now (since 2015) NXP
Freescale TouCAN/FlexCANThe TouCAN module uses three 8-bit registers to set-up the bit timing parameters required by the CAN protocol. Control registers 1 and 2 (CANCTRL1, CANCTRL2) contain the PROPSEG = PROP_SEG( Bit 0-3 in CANCTRL1), PSEG1 = PHASE_SEG1 (Bit 3-5), PSEG2 = PHASE_SEG2 (Bit 0-2), und the RJW (Bit 6-7 in CANCTRL2) fields which allow the user to configure the bit timing parameters. The prescaler divide register (PRESDIV) allows the user to select the ratio used to derive the clock from the system clock. According to AN1776 the TouCAN module needs at least 9 time quante per bit.
The more modern FlexCAN implementations are using the 32 bit Control Register (CTRL) to program bit timing, but much more. CTRL contains as well the bit fields PRESDIV (8 bit pre-scaler), PROPSEG ( 3 bit), PSEG1 ( 3 bit) and PSEG2 (3 bit).
For the position of the sample point only the relation (SYNC_SEG + PROP_SEG + PHASE_SEG1) / (PHASE_SEG2) is important. The absolute value of PROPSEG = PROP_SEG is rather of academic interest and is not calculated by the program. The values for PRESDIV, PROPSEG, PSEG1 and PSEG2 are calculated.
Freescale msCAN08, msCAN12 and MCANThe msCAN module uses two 8-bit registers to set-up the bit timing parameters required by the CAN protocol.
8 bit Bit Timing Register CANBTR1 and CANBTR0 can be calculated selecting NXP SJA1000.
DSTni ™Bit rate configuration is done by two 16bit CAN configuration registers Bit Rate Divisor and Configuration.
16 bit Bit Rate Divisor register setting BR
bit rate Div.
16 bit Bit Configuration register setting SJW, SAM, TSEG2 and TSEG1
gridARMBit rate configuration is done by one 32bit CAN configuration register CAN_BR. Prescaler value is 7 bit, 1 to 128.
This is the same register layout as it can be found in older ATMEL controllers, like the SAM7 or SAMA5 series. To calculate these values, select Atmel AT91SAM9263/SAM7/SAMA5 .
Holt Inc.Holt Inc. is a provider of analog and mixed signal IC data bus solutions to the avionics industry. The HI-3110 ARINC 825 and CANaerospace Standards compatible controller has an SPI host interface. The bit timing registers are compatible with the NXP SJA1000 CAN. Select this type for calculation of the register values.
IFI - Ingenieurbüro Für Ic-TechnologieIFI is providing FPGA IP cores. The latest one is able to handle enhanced CAN FD protocol. Two 32bit registers are used for setting the arbitration and data bit rate. Both with the same structure.
With the migration from CAN FD non-ISO to the latest ISO standard, IFI changed the Bit-Timing generation and the related register compilation. The non-ISO registers, now know as Timing slow and fast used 4_12_6_6_bit
|SJW||prescale||time A||time B|
The CAN FD ISO Bit Timing uses the same registers, now known as Timing slow and fast used: 7_9_8_8_bit
|SJW||prescale||time A||time B|
Older 8 and 16 bit and stand alone SAK82C900The bit timing register model used in the older (Siemens) controllers like C167CR, C515C, XC161C, XC164C, TwinCAN SAK82C900 is very close to the SJA1000, Please use the values calculated for it.
MultiCAN and MultiCAN+The latest CAN controller family implemented in Infineon controllers is called MultiCAN (or here). The ARM Cortex-M4 XMC4000, Tricore TC1130, AUDO or XC800 families are examples using this CAN core.
On the XMC4500 the 32bit Node Bit Timing Register NBTRx contains all parameters to set up the bit timing for the CAN transfer
MultiCAN+ with extended view to CAN FD
In newer MultiCAN implementations supporting CAN FD the number of possible tq per bit was increased when CAN FD is used. This results in larger values for TSEG. The NBTR register with extended view (NBTEVR) when used with NCR.FDEN = 1.
The Bit DIV8 when set is used to divide the Prescaler Clock by 8.
The content for the The Fast Node Bit Timing Register, FNBTRx, can be calculated using the "MultiCAN FD FNBTR" selection.
IntelThe old Intel 82527 is not any more manufactured by Intel. But some chips exist to substitute it. The bit timing register is following the NXP SJA1000 model.
Intel has a new chip, Intel® Platform Controller Hub EG20T. It has Bosch D_CAN as CAN module.
IPMS / CAST
IPMS develops and CAST Inc. distributes an CAN IP core called CAN CTRL which is already able to use the CAN FD mode.
Five bit timing registers are used to configure the bit rate for the arbitration phase (S-slow phase) and data phase (F-fast phase).
This core divides the bit timing into only two parts: The first part called Segment 1 includes the synchronization segment, propagation segment and phase_seg1 and the second part called Segment 2 is equal to phase_seg2.
Currently only the Slow (Classical CAN) bit rate is supported by the calculator.
KvaserKvaser developed there own CAN IP core which is capable of maintaining classic CAN as well as CAN FD.
Unfortunately Kvaser did not provide a detailed CAN register or other interface definition for the CAN IP core. One interface board with up to 4 CAN channels manufactured by Kvaser itself is the PCIEFD.
Nominal and Data Phase Bit Timing (KCAN_BTRN/BTRD)
- TSEG2 Time Segment 2 setting. Valid range 0..31, TSEG2 = tseg2-1
- TSEG1 Time Segment 2 setting. Valid range 0..511, TSEG1 = tseg1-1
- SJW Sync Jump Width setting. Valid range for BTRN and BTRD is 0..15, SJW=tsjw – 1
- BRP Bit Rate Prescaler setting. Valid range 0..8191 for BTRN. Valid range 0..8191 for BTRD when transmitter delay compensation is disabled and range 0..1 when TRDCE is enabled. BRP=nbrp-1
Microchip PIC18FMicrochip use in the PIC18F CPU three 8bit registers. BRGCON1 contains the Prescaler, BRGCON2 the Propagation and Phase Segment 1 bits and BRGCON3 the Phase Segment 2 bits. The last one is only active, if SEG2PHTS (BRGCON2, bit7) is set.
This device, as other of the smaller PIC devices, is not very suitable to implement CANopen. Therefore, bit timing calculation is not yet implemented for it. If someone is interested in using the Timing calculator for simple CAN applications, feel free to implement it here (or pay me to do it).
Enhanced Controller Area Network (ECAN™)
The total number of time quanta in a nominal bit time must be programmed between
8 tq and 25 tq.
Note 1: (Propagation Segment + Phase Segment 1) must be greater than or equal to the
length of Phase Segment 2.
Values should be used wth SJW = 1
Example 21-8: CAN Bit Timing Calculation Example (p.58). Step 1: Calculate the time quantum frequency (FCY = 40 MHz). If FBAUD = 1 Mbps, and number of time quanta N = 20, then FTQ = 20 MHz. max prb 64.
CiCFG1 ECAN™ Baud Rate Configuration Register 1
CiCFG2 ECAN™ Baud Rate Configuration Register 2
WAK - is not considered in the calculation, add the bit if needed.
WAKFIL: Select CAN Bus Line Filter for Wake-up bit
1 = Uses CAN bus line filter for wake-up
0 = CAN bus line filter is not used for wake-up
Microchip PIC32The information is valid for the PIC32MX5/6/7 as well as for the latest PI32MZ, Embedded Connectivity (EC) family. The PIC32 family's bit rate prescaler is only programmable between 1 to 64. According to the manual the time quanta is derived by dividing the clock frequency by the factor of two after the bit rate prescaler.
CAN Baud Rate Configuration Register CiCFG is a 32 bit register. It looks like the combination of the two registers used in the dsPIC33.
SEG2PHTS Phase Segment 2 Time Select bit is set to 1, which means Phase Buffer Segment SEG2PH is freely programmable. SAM = SJW = WAKFIL = 0.
FSYS is what you have to enter in the Clock Rate field.
Microchip MCP2510For anybody using MicroChip's MCP2510, Intrepics has a free Tool to get the timing bits. It is unfortunately a Windows™ only program.
- CNF1 controls the bit rate prescaler and the sync jump with.
- CNF2 the propagation segment, phase segmant 1, SAM bit which controls the number of samples taken at the sample point.
- CNF3 with phase segment 2, Start-of-Frame signal bit and Wake-up Filter bit.
TODO: calculation is done using BTLMODE = 1. The length of phase segment 2 is determined by the PHSEG2 bits of CNF3.
SmartFusion2The CAN configuration register CAN_CONFIG is a 32-bit register that is used to configure the functionality of the CAN controller.
NXP is one of the manufacturers still producing a stand alone CAN controller, the famous SJA1000. But also many microcontrollers with integrated CAN and with the LPC11C22 and LPC11C24 parts that include an on-chip, high-speed CAN transceiver.
NXP SJA1000 (NXP, Intel 82527, Infineon TwinCAN .....
The SJA1000 uses only two 8-bit registers to set-up
the bit timing parameters required by the CAN protocol.
One register BTR0 containing the value
of the bit timing prescaler and the other for the values
of PHASE_SEG1 and PHASE_SEG2.
PHASE_SEG1 is used for programming both (PROP_SEG + PHASE_SEG1)
according CAN specification.
The LPC11Cx2/Cx4 are ARM Cortex-M0 based, integrating a BOSCH C_CAN module.
Profichip manufactures the SMC1000 ARM9 based SoC with two CAN controllers and dual Ethernet MAC.
Renesas RX62N/RX621The RX62N/RX621 Group implements one channel of the CAN module. Bit timing is done writing to the CAN0 Bit Configuration Register (CxBCR). CxBCR consists of 24 bits. A 32-bit read/write access should be performed carefully not to rewrite bits b7 to b0.
Renesas (NEC) V850 µPD70F34x
This family of 32 bit controllers is an originally NEC based product.
Besides the bit rate prescaler, the 8 bit CnGMCS - CANn global clock selection register is used to select the CAN module system clock. It provides the CAN module clock by dividing the CAN clock by 1 to 16 (default).
The 8 bit CnBRP - CANn module bit rate prescaler register holds the 8 bit bit rate prescaler.
The 16 bit CnBTR - CANn module bit rate register is used to program the phase segments phase1 and phase2.
Renesas (Mitsubishi) M32C/8716bit CANi Configuration Register (CiCONR Register) (i = 0, 1) contains SAM, 3 bit Propagation time segment PTS, 3 bit Phase buffer segment 1 PBS1, 3 bit Phase buffer segment 2 PBS2, SJW.
8bit CANi Baud Rate Prescaler (CiBRP Register) (i = 0, 1) divides by 1 to 256.
Register value restrictions: PTS 1-8, PBS1 2-8, PBS2 2-8.
Renesas RZ family
This new (2013) ARM Cortex A9 based family implements the RS-CAN called module with 32 bit wide registers. RSCAN0CmCFG - Channel Configuration Register (m = 0 or 1) The register can be read/written in 8-, 16-, and 32-bit units, initial value is 0.
Renesas R-IN family
This new (2013) ARM Cortex M3 based family is promoted as the Renesas Industrial Networking engine.
FCNn is the CAN module name, FCN0 and FCN1. The input of the modules fCAN clock can be selected by the global clock selection register FCNnGMCSPRE to be divided by 1 to 16 before it goes to the module bit rate prescaler register FCNnCMBRPRS (1 to 256). This results in a prescaler divider up to 4096. FCNnCMBRPRS is an 8 bit register.
Bit Timing is set via the 16 bit module bit rate register FCNnCMBTCTL.
Spansion (formerly Fujitsu)
FCR4Cortex-R4 based family with 3 CAN interfaces implemeting the 16 bit BOSCH C_CAN module. Select "Bosch C_CAN / D_CAN" to calculate the bit timing register values BTR.
bxCANThe bXCAN module is used in the very popular Cortex M3 family STM32. All relevant parameters are concentrated in one CAN bit timing register (CAN_BTR).
The bit timing pre-scaler is 10 bit wide and can divide by 1 to 1024.
Use the table calculated value of BTR and add all additional bits according your requirements to get the final value for CAN_BTR.
SPEAr 300The SPEAR 300 family implemnts the bit timing registers the same way as the 16 bit BOSCH C_CAN module. 16 bit Bit Timing Register (offset 0x0C) and 16 bit BRP extension register (offset 0x18). Select BOSCH C_CAN for register calculation.
TMS320The two Texas Instruments families 24xx and 28xx handle the bit timing register slightly different. 240xA is using two 16-bit registers. BCR2 contains the bit pre-scaler in the lowest 8 bits. BCR1 contains valuse of TSEG1 (4-bit) and TSEG2 (3-bit) in the lowest bits 0-6. 281x and 280x are using one 32-bit register BTC for all timing configuration. The BTC value can be combined from BCR1 und BCR2 : (BCR2 << 16) | BCR1
Note that the CPU clock is fed directly to the CAN module (max 150 Mhz for 281x).
There is currently an issue for the high speed controllers in generating low CAN bit rates. For a SYSCLKOUT of 150 MHz, the smallest bit rate possible is 23.4 kbps.
The following is copied fom the manual chapter " 1.1.3 eCAN Compatibility With Other TI CAN Modules"
|The eCAN module is identical to the "High-end CAN Controller (HECC)" used in the TMS470TM series microcontrollers from Texas Instruments with some minor changes. The eCAN module features several enhancements (such as increased number of mailboxes with individual acceptance masks, time stamping, etc.) over the CAN module featured in 240xTM series of DSPs. For this reason, code written for 240x CAN modules cannot be directly ported to eCAN. However, eCAN follows the same register bit-layout structure and bit functionality as that of 240x CAN (for registers that exist in both devices) i.e., many registers and bits perform exactly identical functions across these two platforms. This makes code migration a relatively easy task, more so with code written in C language.|
AM335x SitaraThe latest generation is using the Bosch D_CAN module.
TMS570LS31x/21xThe TMS570LS31x/21x integrates the ARM® Cortex™-R4F Floating Point CPU designed for Safety Applications. Up to three CAN modules are on chip. The latest generation is using the Bosch D_CAN module.
Stellaris LM3STI's first Cortex-M3 based controllers were developed by the company Stellaris, and baught by TI. These Cortex-M3 controllers implemented the Bosch C_CAN.
Tiva™ CThe Tiva is the TI Cortex-M4 based controller family (former Stellaris LM4). The Tiva series still implements the Bosch C_CAN module.
CAN Bit Timing register CANBIT
For the lower 16 bit the value of BTR calculated when BOSCH C_CAN is selected, can be used.
For the Toshiba TCAN module the calculation results for the NXP SJA1000 can be used.