How to find out CAN Bit Timing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to find out CAN Bit Timing

1,417 Views
subham_dey
Contributor II

How the bit time is calculated , i could not understand. kindly help me to understand . it's urgent for project work.

CAN0->CTRL1 = 0x00DB0006; /* Configure for 500 KHz bit time */
/* Time quanta freq = 16 time quanta x 500 KHz bit time= 8MHz */
/* PRESDIV+1 = Fclksrc/Ftq = 8 MHz/8 MHz = 1 */
/* so PRESDIV = 0 */
/* PSEG2 = Phase_Seg2 - 1 = 4 - 1 = 3 */
/* PSEG1 = PSEG2 = 3 */
/* PROPSEG= Prop_Seg - 1 = 7 - 1 = 6 */
/* RJW: since Phase_Seg2 >=4, RJW+1=4 so RJW=3. */
/* SMP = 1: use 3 bits per CAN sample */
/* CLKSRC=0 (unchanged): Fcanclk= Fosc= 8 MHz */

These common guidelines are used in CAN 2.0 example for a desired bit rate of 500 KHz:
• CAN bit rate period is typically subdivided into 12–20 time quanta
1.
• The sample point is normally chosen around 75%–80% through the bit rate period.
• The remaining 20–25% will be the value for Phase_Seg2.
• The value of Phase_Seg1 will be the same as Phase_Seg2.
• The Sync_Seg is 1 time quantum.
• Resync Jump Width (RJW+1) = Phase_Seg2 (if Phase_Seg2 < 4; otherwise (RJW +1) = 4.
For this example and within the above guidelines, these are the values selected for the CAN module:
• Number of time quanta per bit rate period = 16
• Sample point = 75%, which is 12 time quanta into the 16 time quantum period
Hence,
Phase_Seg2 = (100% – 75%)
× 16 time quanta = 25% × 16 time quanta = 4 time quanta; PSEG2 = 3
Phase_Seg1 = Phase_Seg2 = 4 time quanta; PSEG1 = 3
Prop_Seg = 16 – Phase_Seg1 – Phase_Seg2 – SYNCSEG = 16 – 4 – 4 – 1 = 7; PROPSEG = 6
Resync Jump Width (RJW + 1) = 4
Also for this example, the following applies for an 8 MHz crystal.
f
CANCLK = 8 MHz (EVB oscillator)
Hence,
f
Sclock (time quantum freq.) = (16 time quanta/bit rate period) × (500 K bit rate periods/sec)= 8MHz
Prescaler Value (PRESDIV + 1) = f
CANCLK / fSclock = 8 MHz / 8 MHz = 1
PRESDIV = 1 – 1 = 0

Labels (1)
0 Kudos
Reply
1 Reply

1,357 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Subham Dey,

Please refer the "55.5.9.7 Protocol timing" of S32K1XXRM.


You can also use the Processor Expert to calculate it.

can_pal_s32k146.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply