NI VeriStand ships with default I/O personalities for a variety of FPGAs. In order to create a custom I/O personality, it’s necessary to start with one of the templates that have the framework already laid out. This document contains an installation for additional NI VeriStand FPGA Support. It installs the NI VeriStand FPGA Clock Support library discussed within the Timing Engine section in Creating FPGA-Based I/O Personalities for NI VeriStand above as well as an NI VeriStand RIO Library and NI VeriStand Custom FPGA Project Wizard discussed below. Before continuing, please install the NI VeriStand FPGA Support installer.
To begin creating a custom I/O personality, first run the NI VeriStand Custom FPGA Project Wizard. The Project Wizard is accessible from LabVIEW 2012+'s create project dialog under templates (Figure 1). In LabVIEW 2011 and earlier find it in, LabVIEW’s Getting Started window (Figure 2) under Targets. You can always find it by selecting File>>New… and choosing NI VeriStand Custom FPGA Project (Figure 3).
Figure 1. LabVIEW 2012+ Project Template
Figure 2. Getting Started Window in LabVIEW 2011 and earlier
Figure 3. New File Selection in LabVIEW
The NI VeriStand Custom FPGA Project Wizard guides one through the process of selecting the FPGA and any C-Series modules that may be contained within a cRIO or C-Series Exapansion Chassis. It operates similar to the wizard for starting a new LabVIEW FPGA Project except that it adds the necessary components to the project for a custom FPGA to be used with NI VeriStand. The project wizard adds a framework template, DMA FIFOs, and corresponding XML file to begin development. It also saves the project and files to a location specified by the user. A typical project created from the NI VeriStand Custom FPGA Project Wizard is shown in Figure 4.
Figure 4. Project created by NI VeriStand Custom FPGA Project Wizard
The project wizard creates an FPGA VI in the project which is generated from a template. There are different templates for PCI, PXI, and cRIO. Both the PCI and PXI templates define the following FPGA I/O items: analog I/O on connector 0, digital lines on connector 1 acting as digital input, digital lines on connector 2 acting as digital output, and digital lines on connector 0 acting as PWM I/O. Note that if a 781xR FPGA is used, it will not have any analog I/O and will have extra digital I/O. If an R-Series Expansion Chassis is used on either connector 0 or connector 1, the digital I/O for the corresponding connector will need to be removed. The cRIO template defines I/O for NI 9215, NI 9263, NI 9411, and NI 9474 modules. The project wizard does not modify the templates according to the I/O discovered. It is the responsibility of the developer to modify the FPGA VI to match any changes in I/O from those listed above.
Figure 5. FPGA VI PXI Template
The templates are only meant to be modified by adding or removing I/O in the main frame of the communication loop and by adding or removing asynchronous loops outside of the main sequence structure. The templates have been designed so that a user should not edit anything that has a gray background or remove any of the subVIs that have a red background in the title.
The FPGA template can be customized by adding basic I/O to the communication loop. When adding inputs, convert the data to U64 packets, expand the build array, and connect the U64 packets to the build array.
Figure 6. Adding Inputs to Communication Loop
When adding outputs, first increment the “Num Packets” constant wired to the count terminal of the For loop to account for the additional packets needed by the additional outputs. Next, expand the index array function to give access to the additional packets returned by the For loop. Then connect these packets to the added outputs. If the outputs require more than one packet, build an array from the packets required and connect the array of packets to the outputs.
Figure 7. Adding Outputs to Communication Loop
When adding asynchronous loops to perform any type of processing asynchronous to VeriStand’s communication loop, create the asynchronous loop, convert any data sent to or from the loop to U64 packets, and then connect the packets between the asynchronous and communication loops via local variables. Connect the local variables in the communication loop to the DMA FIFOs by following the steps for inputs or outputs above.
Figure 8. Connecting Asynchronous Data to Communication Loop
Adding basic I/O to the communication loop and IP based I/O in asynchronous loops is made easier with the NI VeriStand RIO Library contained in the installation attached to this document.
After installing the NI VeriStand FPGA Support, NI VeriStand RIO Library will appear on the FPGA function’s palette.
Figure 9. NI VeriStand RIO Library Palette
The NI VeriStand RIO Library was created so that creating a custom FPGA bitfile for NI VeriStand will be less cumbersome and not require LabVIEW FPGA expertise. Each C-Series module with the exception of communication modules (CAN, Profibus, etc.), motion modules, removable storage modules, and third-party modules has been included in the NI VeriStand RIO Library. The modules are separated between Basic I/O and Special Case I/O.
Basic I/O consists of any C-Series module whose I/O can be placed directly in the communication loop. Customizing the FPGA VI with basic I/O only requires dropping the corresponding subVI in the communication loop, creating a constant that defines the I/O being used by the subVI, and connecting the packet input or output of the subVI to the corresponding packet receive or packet send For loop.
Figure 10. RIO Library's Basic I/O
Special Case I/O consists of C-Series modules that either use a Delta-Sigma ADC and are independently timed (such as the 9233) or consist of high resolution ADCs that execute too slow to place in the communication loop (such as the 9211). The special case I/O subVIs are meant to be placed on the block diagram as asynchronous loops. When placing the special case I/O subVI on the block diagram, its contents will be placed instead of a subVI. The contents will consist of the asynchronous loop and packet indicator. Finish by creating a local variable for the packet and placing it into the communication loop to connect to the DMA FIFO.
Figure 11. RIO Library's Special I/O
Some loops require additional processing instead of simple I/O connectivity. One example is PWM and frequency measurements. The NI VeriStand RIO Library also contains IP (Intellectual Property) Based I/O that will allow the user to quickly take advantage of the power of the FPGA with an asynchronous loop already programmed to perform a specific function. The IP Based I/O will be implemented as asynchronous loops in the same manner that Special Case I/O is implemented.
Figure 12. RIO Library's IP Based I/O
The IP Based I/O palette consists of PWM or Pulse Generation/Measurement, Encoder Input, and Quad Encoder Input. Additional IP Based I/O may be added in the future and can also be created by any user. If you create any additional IP Based I/O and wish to include it in a future release of the NI VeriStand RIO Library please comment below.
The final step to creating a custom FPGA personality for NI VeriStand is defining in XML the data sent to and from the FPGA in the 64-bit packets. Please refer to the NI VeriStand Help for the topic on Creating a Custom FPGA Configuration File.
The NI VeriStand RIO Library includes an XML snippet in each subVI that defines the data in the packets received/generated by the subVI. This snippet can be copied and pasted into the corresponding section of the *.fpgaconfig file that defines the interface from FPGA to NI VeriStand host.
If you are using multiple RIO targets (that do not have PXI timing and synchronization features like R-Series), you must take synchronization into consideration. For example, if you are using two MXIe RIO targets with a Real-Time PXI... the system performance will greatly suffer unless you synchronize the two MXIe RIO targets.
The framework provided by this add-on has built in synchronization support to accomplish this. It uses a 9401 or 9402 module to share a distributed clock between the RIO targets. This is disabled by default and must be enabled by the user. To enable this functionality:
This software is not yet officially supported by National Instruments. If you encounter a problem with these tools, or if you have suggestions for a future revision, please post to the forum for this tool: NI VeriStand FPGA-Based I/O Interface Tools Discussion. You must use this feedback forum for support. Do not call National Instruments for support for this add-on.