Communicating with FPGA Devices from Linux Applications Using the FPGA Interface C API

Publish Date: Dec 08, 2014 | 1 Ratings | 5.00 out of 5 |  PDF

Overview

You can communicate with National Instruments FPGA devices from Linux® using the NI-RIO driver and FPGA Interface C API. This document explains how to program your National Instruments FPGA hardware using the LabVIEW FPGA Module (Windows), how to install needed FPGA Interface C API and NI-RIO driver software, and how to use the FPGA Interface C API to communicate with your FPGA device from C applications on Linux.

Table of Contents

  1. Programming National Instruments FPGA-Based Hardware Devices
  2. Installing the NI-RIO Driver and FPGA Interface C API Software and NI-RIO Driver on Your Windows Development Machine
  3. Installing the NI-RIO Driver on Your Linux System 
  4. Using the FPGA Interface C API to Communicate with NI FPGA-Based Devices from C Applications on Linux

1. Programming National Instruments FPGA-Based Hardware Devices

To program an FPGA bitfile for National Instruments FPGA-based devices (e.g. R-Series modules), you must use the LabVIEW development environment along with the LabVIEW FPGA Module on a Windows system. It is not currently possible to program FPGA bitfiles for NI FPGA-based devices from the LabVIEW development on Linux.

Once you have generated an FPGA bitfile, you can download it to a National Instruments FPGA device installed in a Linux system. You do this from a host application written in C; continue reading for instructions on how to do this.

Back to Top

2. Installing the NI-RIO Driver and FPGA Interface C API Software and NI-RIO Driver on Your Windows Development Machine

After programming a bitfile for your FPGA-based device, you will need to generate a custom C API on your Windows development machine based on the inputs and outputs to your FPGA application. 

To do this, you need two pieces of software on your Windows development machine:

Back to Top

3. Installing the NI-RIO Driver on Your Linux System 

To communicate with your NI FPGA-based device from applications on Linux, you need to install the NI-RIO driver on your Linux system. This driver is currently supported with the following distributions:

  • Red Hat Enterprise Linux 5.x i386
  • Red Hat Enterprise Linux 5.x x86_64
  • Red Hat Enterprise Linux 6.x i386
  • Red Hat Enterprise Linux 6.x x86_64
  • Scientific Linux 5.x i386
  • Scientific Linux 5.x x86_64
  • Scientific Linux 6.x i386
  • Scientific Linux 6.x x86_64

You can download and install the NI-RIO 4.1.0 driver for Linux from ni.com/updates. Installation instructions are provided in the README.txt file noted on the download page.

Back to Top

4. Using the FPGA Interface C API to Communicate with NI FPGA-Based Devices from C Applications on Linux

A tutorial is available to help guide you through the process of generating a C interface to your LabVIEW FPGA application, and then using that interface in your C application on Linux. Essentially, you will take the following steps:

  1. Transfer your compiled LabVIEW FPGA bitfile from your Windows development machine to your Linux system
  2. Generate a custom C API for your LabVIEW FPGA application from the LabVIEW development environment on your Windows machine
  3. Develop a C host application for your Linux system that uses the custom C API that you generated in step 2. Your host application will connect to the NI FPGA-based device, download your bitfile from step 1, and then send and receive data as needed.

To read the detailed tutorial, visit the document: Building a R Series FPGA Interface Host Application in C. Note that the FPGA Interface C API can be used to generate custom C APIs for use on Windows or Linux. Therefore, some Windows examples given in the tutorial may need to be slightly adjusted when developing a Linux host application.

>> Return to the National Instruments Linux Portal

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

 

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit