Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

baudrate

How to setting baudrate equal 150K? and other baudrate should be set?
 
 
0 Kudos
Message 1 of 9
(7,088 Views)

set it in MAX, other programming languages are possible.

DirkW

0 Kudos
Message 2 of 9
(7,085 Views)
?? I use c++ program language . how to set baudrate equal 150K?
0 Kudos
Message 3 of 9
(7,082 Views)
From the NI-CAN Manual:
 
"For NI CAN hardware the common baud rates supported include 5000, 6150, 7813, 8000, 10000, 12500, 15625, 16000, 20000, 25000, 31250, 33333, 40000, 50000, 62500, 80000, 83333, 100000, 125000, 160000, 200000, 250000, 400000, 500000, 800000, and 1000000.
If you are familiar with the Bit Timing registers used in CAN controllers, you can use a special hexadecimal baud rate of 0x8000zzyy, where yy is the desired
value for register 0 (BTR0), and zz is the desired value for register 1 (BTR1) of the CAN controller."
 
For your case 150K is not possible. The nearest is 148.1 and translates to 0x80002405
 
DirkW
0 Kudos
Message 4 of 9
(7,069 Views)

Hello,

 

What is the computation formula between decimal and hexadecimal (BTR0 & BTR1) values for baudrate ?

I am unable to compute the values for BTR0 and BTR1 to have a baudrate near to 307.690 bauds.

You think that these non-standard baudrates are accepted by the card ? Because if in NI-MAX I set non-standard values for BTR0 and BTR1 (advanced settings), they are rounded to the nearest standard values.

 

Cheers,

 

Ben

0 Kudos
Message 5 of 9
(6,104 Views)

In Advanced mode, you can click on the "Baudrate.." button which opens a new dialog to calculate all combinations of registers for a given baudrate. Set the desired baudrate value (307.692 kBaud is supported), then click on Create List.

0 Kudos
Message 6 of 9
(6,100 Views)

Follow-up to my last response:

You can select one of the baudrates of the list and click use, then this will be the default setting for the port.

If you wan to set the baudrate in your application, this is the information from the NI-CAN online help: "Within the application, you can use the hexadecimal baud rate of 0x8000zzyy, where yy is the desired value for Bit Timing Register 0 (BTR0), and zz is the desired value for Bit Timing Register 1 (BTR1) of the CAN controller. For assistance with creating BTR values, use the advanced dialog referenced for MAX."

0 Kudos
Message 7 of 9
(6,096 Views)

Thank you a lot for the information.

Indeed "Baud Rate..." button in Port Properties helps me, but what are the different values computed for 307.692 kBaud ? I have to choose the one with the biggest Sample Point rate ?
And with ncSetAttr.vi I have to set only BTR0 and BTR1 ? What about BRP, TSEG1 and TSEG2 ?

Thanks again

0 Kudos
Message 8 of 9
(6,090 Views)

BTR0 and BTR1 are two 8 bit registers and they contain BRP, TSEG1 and TSEG2.

So you only need to pick the desired value from the list and use BTR0 and BTR1.

For your case I think the last one (0x19, 0x01) with sampling point at 84.6% should be fine. All predefined baud rates use also sampling point at about 80 to 90%. The baud rate setting for SetProperty is 0x80001901.

 

 

0 Kudos
Message 9 of 9
(6,085 Views)