How can I communicate my cRIO or MyRIO with a Linux Host computer?

Updated Nov 21, 2019

Reported In

Hardware

  • myRIO Student Embedded Device

Software

  • LabVIEW
  • LabVIEW FPGA Module
  • LabVIEW Real-Time Module
  • LabVIEW C Generator Module

Driver

  • NI-RIO

Operating System

  • Linux

Issue Details

How can the myRIO communicate with a host Linux machine via shared variables or other communication?
I think that Linux does not support hosting SVE, however, could the Linux host deploy a shared variable library to the cRIO or myRIO, and the Linux OS just communicates with it?

Solution

 
  • First, we should verify if our Linux distribution is supported. You can find documentation about this in the Related Links section.
  • To solve this we must consider the Shared Variables are not supported on Linux Systems, you can refer to the table 1 on the document: Using the LabVIEW Shared Variable in the Related Links section.
  • Seeing the NI-RIO Driver 17.0 for Linux Readme, we can find:
"In order to use NI-RIO on Linux, you need a Windows system to develop your LabVIEW FPGA application. You must compile a bitfile, generate headers with the FPGA Interface C API Generator or FPGA Interface Python API, and then move the application to your Linux system. Refer to the "Using the NI-RIO Driver and FPGA Interface C API"  and "Using the NI-RIO Driver and FPGA Interface Python API" sections for more information.

------------------------------------------------
Using the NI-RIO Driver and FPGA Interface C API
------------------------------------------------
You must begin development on a computer running Windows. Use LabVIEW FPGA to develop and build an FPGA VI that runs on a RIO device. Use the FPGA Interface C API Generator to create the C source files for your application. Visit ni.com/info and enter the Info Code fpgainterfacecapi to get the latest version of the FPGA Interface C API Generator. Then copy the generated files to the Linux machine to begin development of C/C++ code for your application. For information about using the FPGA Interface C API, visit ni.com/info and enter the Info Code fpgainterfacecapihelp.
To find the RIO device you are using in your application, use the command "lsni -v" to list information on all NI devices in the system."


 

So, the option to communicate your cRIO or MyRIO with the Linux host will be using the cRIO / MyRIO FPGA to communicate with a C program on Linux. We can summarize in these steps:

  • Use LabVIEW to create your Main cRIO / MyRIO Program and pass the information to the FPGA. You can check these documents in the Related Links Section:

    • Communication Between the FPGA, Real-Time Processor, and Distributed Systems

    • Understanding Communication Options Between the Windows HMI, RT Processor, and FPGA

  • Use LabVIEW to create an FPGA program that gets data from the Main RT program and sent it to the Linux Host. To do this you can check this document:

    • Understanding Communication Options Between the Windows HMI, RT Processor, and FPGA

  • Use LabVIEW FPGA Interface C API to create a C program to use it on Linux to read the cRIO or MyRIO FPGA. To do this you can check these documents:

    • Introduction to the FPGA Interface C API    

    • NI myRIO C and C++ Development Support and Examples


The next picture summarize the solution: