Setting CAN baud rate for demo board

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

Setting CAN baud rate for demo board

Jump to solution
981 Views
charliemiller
Contributor I

Hi all.  Total newb here, sorry.  I have an sk-512-b starter kit and trying to get the CAN set up.  Running the demo program that sends CAN traffic from CAN0 to CAN4, it works.  However, I want it to run at baud 500k so I can have it talk to my existing CAN devices.  I know it has something to do with CANBTR0-1 but not sure how to set it for 500k.  Does anyone know the correct values for this board and this baud?  Thanks!!!

 

Charlie

Labels (1)
Tags (2)
0 Kudos
1 Solution
569 Views
lama
NXP TechSupport
NXP TechSupport

I think the board you are writing about is ZK-S12-B which contains CAN0 and CAN4 connected to the CAN transceivers MC33388.

The necessary parameters for calculation are described in the AN1798 - CAN Bit Timing Requirements.

(http://www.freescale.com/files/microcontrollers/doc/app_note/AN1798.pdf)

In order to provide some data I'll suppose some input parameters. If you use other parameters, transceiver,… do not hesitate to reply.

I'll suppose you use oscillator clock 16 MHz as a source clock for the CAN modules.

The Physical Interface MC33388D has Tx+Rx prop. delay = 1000 ns and it is designed for communication speed up to 125 kbaud.

INPUTS                

fosc =     16           [MHz]

required can speed : fNBT = 125000 [bit/s]

bus propagation delay = 5 [ns/m]

bus length = 0,5    [m]

entire bus propagation delay = 2,5   [ns]

Physical Interface Tx+ Rx propagation delay 1000    [ns]

Overall Propagation Delay = 2005   [ns]

For these inputs and 125kbps bitrate the setup is:

CANBTR0 = 0xC7             

CANBTR1 (3 sample per bit) = 0xD8

required oscillator tolerance [%] = 1.21%

However, I have some suggestion how to use the communication between CAN0 and CAN4 without usage of transceivers just by means of direct connection between MCU's CAN Rx,Tx pins. Plese look at CAN without Transceiver-siemens_AP2921, figure 2 (http://www.mikrocontroller.net/attachment/28831/siemens_AP2921.pdf)

For such a connection you can use following setup:

INPUTS                

fosc =     16           [MHz]

required can speed : fNBT = 500000 [bit/s]

bus propagation delay =    5 [ns/m]

bus length = 0,5 [m]

entire bus propagation delay = 2,5   [ns]

Physical Interface Tx+ Rx propagation delay 150 [ns]

Overall Propagation Delay = 305 [ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xE7

required oscillator tolerance [%] = 1.25%

Moreover, if I am wrong and your board contains some interface which is able o work up to 1Mbit then such interfaces have propagation delay approximately 150~250 ns.

  1. Interface PCA82C250 Tx+Rx prop. delay at 85C = 150 [ns]                                             1 Mbaud              
  2. Interface MC33989 Tx+Rx prop. delay at 85C =    220 [ns]                                                 1 MBaud              
  3. Interface MC33388D Tx+Rx prop. delay =            1000 [ns]                                               125 kbaud           
  4. Interface TJA1054T, PCA82C252T, TJA 1053T Tx+Rx prop. delay = 950 [ns]            125 kbaud           
  5. Interface TJA1041T, PCA82C252T, TJA 1053T Tx+Rx prop. delay = 255 [ns]            1 MBaud              
  6. Interface TJA1040 Tx+Rx prop. delay =                 255 [ns]                                                 1 MBaud              
  7. Interface TLE6250G Tx+Rx prop. delay =             280[ns]                                                  1 MBaud              
  8. Interface TJA1050 Tx+Rx prop. delay =                 250[ns]                                                  1 MBaud              

Some calculations for the same setup and different RxTx delays.

fosc =     16           [MHz]

required can speed : fNBT = 500000 [bit/s]

bus propagation delay =    5 [ns/m]

bus length = 0,5 [m]

entire bus propagation delay = 2,5   [ns]

Overall Propagation Delay = 305 [ns]

1) Physical Interface Tx+ Rx propagation delay 150 [ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xE7

required oscillator tolerance [%] = 1.25%

2) Physical Interface Tx+ Rx propagation delay 220 ~ 255[ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xD8

required oscillator tolerance [%] = 1.219%

3) Physical Interface Tx+ Rx propagation delay 280 [ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xC9

required oscillator tolerance [%] = 1.216%

Best regards,

Ladislav                               

View solution in original post

0 Kudos
2 Replies
570 Views
lama
NXP TechSupport
NXP TechSupport

I think the board you are writing about is ZK-S12-B which contains CAN0 and CAN4 connected to the CAN transceivers MC33388.

The necessary parameters for calculation are described in the AN1798 - CAN Bit Timing Requirements.

(http://www.freescale.com/files/microcontrollers/doc/app_note/AN1798.pdf)

In order to provide some data I'll suppose some input parameters. If you use other parameters, transceiver,… do not hesitate to reply.

I'll suppose you use oscillator clock 16 MHz as a source clock for the CAN modules.

The Physical Interface MC33388D has Tx+Rx prop. delay = 1000 ns and it is designed for communication speed up to 125 kbaud.

INPUTS                

fosc =     16           [MHz]

required can speed : fNBT = 125000 [bit/s]

bus propagation delay = 5 [ns/m]

bus length = 0,5    [m]

entire bus propagation delay = 2,5   [ns]

Physical Interface Tx+ Rx propagation delay 1000    [ns]

Overall Propagation Delay = 2005   [ns]

For these inputs and 125kbps bitrate the setup is:

CANBTR0 = 0xC7             

CANBTR1 (3 sample per bit) = 0xD8

required oscillator tolerance [%] = 1.21%

However, I have some suggestion how to use the communication between CAN0 and CAN4 without usage of transceivers just by means of direct connection between MCU's CAN Rx,Tx pins. Plese look at CAN without Transceiver-siemens_AP2921, figure 2 (http://www.mikrocontroller.net/attachment/28831/siemens_AP2921.pdf)

For such a connection you can use following setup:

INPUTS                

fosc =     16           [MHz]

required can speed : fNBT = 500000 [bit/s]

bus propagation delay =    5 [ns/m]

bus length = 0,5 [m]

entire bus propagation delay = 2,5   [ns]

Physical Interface Tx+ Rx propagation delay 150 [ns]

Overall Propagation Delay = 305 [ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xE7

required oscillator tolerance [%] = 1.25%

Moreover, if I am wrong and your board contains some interface which is able o work up to 1Mbit then such interfaces have propagation delay approximately 150~250 ns.

  1. Interface PCA82C250 Tx+Rx prop. delay at 85C = 150 [ns]                                             1 Mbaud              
  2. Interface MC33989 Tx+Rx prop. delay at 85C =    220 [ns]                                                 1 MBaud              
  3. Interface MC33388D Tx+Rx prop. delay =            1000 [ns]                                               125 kbaud           
  4. Interface TJA1054T, PCA82C252T, TJA 1053T Tx+Rx prop. delay = 950 [ns]            125 kbaud           
  5. Interface TJA1041T, PCA82C252T, TJA 1053T Tx+Rx prop. delay = 255 [ns]            1 MBaud              
  6. Interface TJA1040 Tx+Rx prop. delay =                 255 [ns]                                                 1 MBaud              
  7. Interface TLE6250G Tx+Rx prop. delay =             280[ns]                                                  1 MBaud              
  8. Interface TJA1050 Tx+Rx prop. delay =                 250[ns]                                                  1 MBaud              

Some calculations for the same setup and different RxTx delays.

fosc =     16           [MHz]

required can speed : fNBT = 500000 [bit/s]

bus propagation delay =    5 [ns/m]

bus length = 0,5 [m]

entire bus propagation delay = 2,5   [ns]

Overall Propagation Delay = 305 [ns]

1) Physical Interface Tx+ Rx propagation delay 150 [ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xE7

required oscillator tolerance [%] = 1.25%

2) Physical Interface Tx+ Rx propagation delay 220 ~ 255[ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xD8

required oscillator tolerance [%] = 1.219%

3) Physical Interface Tx+ Rx propagation delay 280 [ns]

CANBTR0 = 0xC1             

CANBTR1 (3 sample per bit) = 0xC9

required oscillator tolerance [%] = 1.216%

Best regards,

Ladislav                               

0 Kudos
569 Views
charliemiller
Contributor I

Thanks, I'll give it a try!

Charlie

0 Kudos