UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 22656

LogiCORE CAN - How do I configure CAN Core for various baud rates?

Description

How do I configure CAN Core for various baud rates?

Solution


The Baud Rate for the OPB CAN system is calculated as:

Baud Rate - CANCLK / (NTQ x BRP) where NTQ = Number of Time Quanta and BRP = Baud Rate Prescaler.

The number of time quanta in Equation 1 is calculated as NTQ = TS1 + TS2 + 1 where TS1 and TS2 are the actual values of Time Segment 1 and Time Segment 2. The values written into the CAN configuration registers are 1 (one) less than these actual values.

BRP is the actual value of the Baud Rate Prescaler. The value written into the BRPR (Baud Rate Prescaler Register) is one less than the actual value.

Example: CAN CLK = 24MHz, NTQ = 16, and BRP = 3, results in a Baud Rate of 500Kbps. Some of the values written into the Baud Rate Prescaler Register and the Bit Timing Register (TS1 and TS2) to achieve this configuration are given in Table 1:

Actual BRP....BRP value.....NTQ...TS1 value in BTR......TS2 value in BTR
value......................in BRPR

3.....................2..........................16..............6(Actual Value = 7).............7(Actual Value= 8)
3.....................2..........................16..............7(Actual Value = 8).............6(Actual Value= 7)
3.....................2..........................16..............8(Actual Value = 9).............5(Actual Value= 6)
3.....................2..........................16..............9(Actual Value = 10)...........4(Actual Value= 5)
Table 1: Configuration Register Values for 500Kbps

Table 2 gives an example of values written into the configuration registers for different Baud Rates with a CAN CLK of 24MHz.

Desired.....Actual BRP....BRP value.....NTQ......TS1 value ......TS2 value
Baud Rate.........value..............in BRPR........................in BTR............in BTR

50.......................30..........................29..................16..............8......................5
100.....................15.........................14...................16..............8......................5
125.....................12.........................11...................16..............8......................5
250.....................6...........................5......................16..............8......................5
500.....................6...........................5.......................8................2.....................3
800.....................3...........................2......................10...............3.....................4
1000..................3............................2.......................8................2.....................3
Table 2: Configuration Register Values for Different Baud Rates
AR# 22656
Date Created 09/04/2007
Last Updated 12/15/2012
Status Active
Type General Article