LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting special baudrates in NI-CAN

Solved!
Go to solution

Hello,

I am trying to set baudrate of 307.690 bauds in NI-CAN.

I read it should be possible to set non-standard baudrates:
http://digital.ni.com/public.nsf/allkb/CBA1FC627FFA0F8F862564DC0071B3A7

But I am unable to figure out the computation formula between decimal and hexadecimal (BTR0 & BTR1) values for non-standards baudrate ?
I am unable to compute the values for BTR0 and BTR1 to have a baudrate near to 307.690 bauds.

You think that baudrates no included in the table in the link above, are accepted by the card ? Because if in NI-MAX I set some extrapolated values for BTR0 and BTR1 (advanced settings), they are rounded to the nearest standard values.
If not, they are accepted by ncSetAttr.vi but I am not sure the chipset will use effectively this baudrate (I am in a pre-study phase).


Cheers,

Ben

0 Kudos
Message 1 of 7
(3,141 Views)
Solution
Accepted by Seube

Have you used the baud rate calculator in MAX?  That sems like the easiest thing to do.  Find your device in the tree, then go to Properties, click the Advanced >> button, then the Baud Rate button.  On my system, with a NI USB-8473, the closest achievable baud rate is 307.692 with BTR0 0x01 and BTR1 0x28, although I can't currently test that (I don't have a second CAN device set at that baud rate).

 

You might also find Kvaser's Bit Timing Calculator helpful.

0 Kudos
Message 2 of 7
(3,128 Views)

Why would you want to use non-standard baudrate ?

0 Kudos
Message 3 of 7
(3,126 Views)

project requirements 🙂

 

0 Kudos
Message 4 of 7
(3,117 Views)

nathand: Thanks a lot.

For my part, I get BTR0=0x01 and BTR1=0x19 for a sampling rate of 84.6%, while your values get 76.9%

I suppose I have to retain the values with the biggest sample point.

Our differences can be explained by hardware differences : I have a PCI NI-CAN card.

0 Kudos
Message 5 of 7
(3,116 Views)

@Seube wrote:

nathand: Thanks a lot.

For my part, I get BTR0=0x01 and BTR1=0x19 for a sampling rate of 84.6%, while your values get 76.9%

I suppose I have to retain the values with the biggest sample point.

Our differences can be explained by hardware differences : I have a PCI NI-CAN card.


Actually, if you look at the link you provided, it says the BTR values are the same regardless of which CAN card you are using.  Either set of those values is likely to work (yours, or the ones I posted); a sampling point around 80% is reasonable.  The % value is not the sampling RATE, it is the sampling POINT.  It is the point during the transmission of a bit at which the value on the wire is actually sampled to determine if it's a 1 or a 0.  You don't necessarily want the maximum value (a sample point at 95% would not be ideal) because if you're too close to the end of the time period and the oscillators are not perfectly synchronized, you may read the wrong value.

0 Kudos
Message 6 of 7
(3,100 Views)

All right, thanks for the info !

0 Kudos
Message 7 of 7
(3,085 Views)