如何将 cRIO 或 MyRIO 与 Linux 主机电脑通信?

更新 Nov 6, 2023

环境

硬件

  • myRIO Student Embedded Device

软件

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

驱动

  • NI-RIO

操作系统

  • Linux

myRIO 如何通过共享变量或其他通信与主机 Linux 电脑通信?
相信 Linux 是不支持托管 SVE,然而,Linux 电脑是否可以将共享变量库部署到 cRIO 或 myRIO,然后 Linux OS 只是与之通信?

  • 首先,我们需要验证 Linux 发行版是否被受支持。您可以在相关链接部分找到有关此内容的文档。
  • 需要要解决这个问题,我们是必须先考虑到 Linux 系统是不支持于共享变量,您可以参考文档中的图表 1:在相关链接部分中的使用 LabVIEW 共享变量。
  • 查看NI-RIO Driver 17.0 for Linux Readme,我们可以发现:
"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."

对此,将 cRIO 或 MyRIO 与 Linux 电脑通信的选项将使用 cRIO / MyRIO FPGA 与 Linux 上的 C 程序通信。我们可以总结为以下步骤:

  • 使用 LabVIEW 创建您的主 cRIO / MyRIO 程序并将信息传递给 FPGA。您可以在相关链接部分查看相关文档:

    • Communicate Between FPGA, Real-Time Processor, and Distributed Systems

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

  • 使用 LabVIEW 创建一个 FPGA 程序,从主 RT 程序获取数据并将其发送到 Linux 电脑。为此,您可以查看此文档:

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

  • 使用 LabVIEW FPGA 接口 C API 创建一个 C 程序以在 Linux 上使用其来读取 cRIO 或 MyRIO FPGA。为此,您可以查看以下文档:

    • Introduction to the FPGA Interface C API    

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


下图总结了解决方案: