Using NI-XNET in a Real-Time Startup Executable for CompactRIO or CompactDAQ

Updated Apr 24, 2023

Reported In

Hardware

  • NI-9852
  • NI-9853
  • NI-9861
  • NI-9862
  • NI-9866
  • NI-9860
  • CompactRIO Chassis
  • CompactDAQ Chassis

Driver

  • NI-XNET

Issue Details

I want to use the NI-XNET API in the startup application on my real-time CompactDAQ (cDAQ) or CompactRIO (cRIO), and the code runs without issue from the development environment. However, when I try and deploy the startup executable I get an Interface not found error when trying to create an XNET session.

How do I create an XNET session in a real-time startup executable?

Solution

One option to avoid this issue is using the System Configuration Library to wait for the XNET hardware to become available before creating an XNET session. Download this figure then drag it into VI diagram for an example:
 

 
For cRIO systems, ensure that you have performed a necessary action to cause NI-XNET to load before searching for the hardware. See Getting Started with CompactRIO in the XNET Help for more information on loading NI-XNET.

Additional Information

There is a small delay that occurs between when the cRIO or cDAQ chassis boots and when the XNET hardware is detected, the appropriate drivers load, and the modules are identified. As a result, if you try and create a new XNET session at the beginning of a Real-Time startup executable, the hardware may not yet be entirely loaded. This is what causes the Interface not found an error.

If you are running part of the application on the FPGA, it's important that you add the delay recommended above after the FPGA VI runs. This because the data is passed through the FPGA and this will need to be initialized before the RT can recognize the module.