Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Timing

I am trying to debug a CAN network with the NI-CAN.  However, the setup for the microcontrollers that are on the network is different than the NI-CAN.  I will explain

With the NI-CAN Setup, I can choose to set  the following:

Baud Rate Prescaler

Synch Jump Width (SJW)

Time Before Sample (TSEG1)

Time After Sample(TSEG2)

Sample Mode

 

With the Microcontrollers, the setup was done with the same settings, but also includes a propagation delay (PRD) which per the manfuctures instructions, comes after the SJW, before TSEG1.  The microcontrollers documentation shows that the total bit time is therefore a sum of SJW, PRD, TSEG1, TSEG2).  So the question is.  If the microcontrollers are set to:

BRP = 4

this would make Tq = 5.51us
SJW = 2

PRD = 3

TSEG1 = 3

TSEG2 = 4

this would make K = 2+3+3+4 = 12 Tq

So the baudrate would be:  1/(K*Tq), or in this case 15.124kbps

 

 If i do the same with NI CAN, Setting the Tq to 5.5 using BRP, BRP becomes 44, then set SJW = 2, TSEG1 = 3 (TSEG1+1 = 4), TSEG2 = 4 (TSEG2+1 = 5), the baud rate becomes 18.182. so now i have two choices, ignore the Bit Timing, or ignore the baud rate. I have tried both, but I only get error messages.

 

The network is working.  It just has some bugs that I need to see the messages to fix.  

The term resistors are 120 ohm 

The Bus length is about 20ft

 

Thanks for any help, i hope i have given enough information

0 Kudos
Message 1 of 2
(6,431 Views)

Hi,

 

If I create the Baudrate based on your values I always get 160 Kbaud with 50% sample point. See the following screenshot.

 

DirkW

0 Kudos
Message 2 of 2
(6,419 Views)