How Can I Set Custom Baud Rates on NI-XNET Devices?

Updated Nov 25, 2020




I know it is possible to set custom baud rates for NI-CAN devices. Is there a corresponding method to set these values for NI-XNET devices?

It is not possible to directly set the bit timing registers. However, the corresponding parameters for NI-XNET can be changed to define custom baud rates.For more definitions on each of these parameters, please see your LabVIEW Help.
  • Synch. Jump Width (SJW)
  • Time Before Sample (TSEG)
  • Time After Sample (TSEG2) and Bit Time Quantum)
Proceed with the following steps to set valid inputs for these parameters:
  1. Open Measurement & Automation Explorer, right-click the CAN port and select Properties
  2. Select Advanced and click Baud Rate.

  1. Input your desired baud rate, in this example with have used 533.33 kilobaud. 
Note: there are some values that are not possible to achieve.  If you enter an invalid number, you will get a similar message to the one below, where xxx.yyy is the closest valid baud rate to value you entered.

Baud Rate will be changed to the nearest valid value (xxx.yyy kBaud)
  1. ​Click Create List, select one of the Bit Timing Registers that has been generated, and select Use.
  1. Your Port Properties window should look like the image found below. Take note of the SJW, TSEG, TSEG2, and Bit Time Quantum values found in the red square.

Note: The values above are +1 for SJW, TSEG1, and TSEG2, therefore for this example the corresponding values are: SJW = 0, TSEG2 = 6, and TSEG1 = 6.
  1. Place a BaudRate property node on your block diagram by going to the Measurement I/O pallete >XNET> Session Node. Once you have dropped down the node on the block diagram, click the section under XNET Session and a menu will appear. Navigate to Interface > BaudRate.
  1. Format the parameters noted in step 5 into a Hex representation (see Additional information if you are unsure what this means). In this example, the final BaudRate value would be 0x8066007D. 
  2. Wire this value into the property node as follows.

Note: The constant above has been changed to Hex Display by right-clicking the constant and choosing Display Format... then select Hexadecimal.

Additional Information

Note: The 'Sampling Mode' is a parameter of NI CAN hardware. Changing this value will not affect the functionality of a XNET device.

The baud rate format in advanced mode is in Hex with the format 0x8ABCDDDD. Where A, B, C, and DDDD are defined as follows:
  • A is the (Re-)Synchronization Jump Width (SJW).
  • B is the Time Segment 2 (TSEG2), which is the time segment after the sample point
  • C is the Time Segment 1 (TSEG1), which is the time segment before the sample point.
  • DDDD is the bit time quantum. This is used to program the baud rate prescaler.

You can use the NI-XNET Compatibility Library for NI-CAN  to allow your NI-XNET device to appear in Measurement & Automation Explorer as both an NI-XNET and NI-CAN device as shown below: