Example Code

Streaming GPS Generation on the NI PXIe-5644R

Code and Documents

Attachment

Overview

This sample project contains four host VIs for streaming GPS data and one FPGA VI that runs on the FPGA of the NI PXIe-5644R. Each host VI configures the GPS settings, configures the RF output hardware, and sets up a data stream between the host VI and the NI 5644R.

Description

Streaming GPS I/Q data from the host to RF OUT works in the following way: 

  1. The host VI writes data to the host-to-target DMA FIFO. You can see this FIFO in the Project Explorer window at My Computer»PXIe-5644R»FIFOs»Output Stream»Output Stream FIFO.
  2. The FPGA VI reads from this DMA FIFO, processes the data, and sends it to RF OUT.

Streaming uses DMA channels. One DMA channel streams data from the host to the FPGA; another streams data from the FPGA to the host. Each DMA channel consists of two FIFOs, one on the host and one on the FPGA.

The output stream uses a Start Trigger to begin generating data to RF OUT. After the stream starts, the host streams data to the FPGA until you stop the application. If the host does not write data to the FPGA quickly enough, the DMA FIFO does not have enough data to read, so the FPGA reports a buffer underflow.

The input stream uses a Start Trigger to begin streaming data acquired from RF IN. This stream can operate in the following modes:

  • Continuous mode—The FPGA streams data to the host until you stop the application. If the host cannot consume data quickly enough, the DMA FIFO fills up too quickly, so the FPGA reports a buffer overflow.
  • Burst mode—The FPGA periodically sends a block of samples to the host. The size of each block is determined by the Read Block Size control, which is located on the front panel of the host VI. A block of data sends when the Start Trigger asserts. Enable burst mode by clicking Burst Mode Enabled on the front panel of the host VI.

You can view the following host VIs in the Project Explorer window by expanding My Computer:

  • VST Streaming (Host).vi—Streams I/Q data from RF IN to the host VI and from the host VI to RF OUT.
  • VST Streaming with MIMO (Host).vi—Synchronizes the stream Start Triggers of multiple NI PXIe-5644R devices in the same chassis. This synchronization helps you align data samples across devices, which is often required for RF MIMO applications.

Hardware and Software Requirements

Software

Application Software: LabVIEW Professional Development System 2012

Driver: NI-RIO 4.1

Toolkits and Add-Ons: LabVIEW FPGA Module 2012

Language(s): LabVIEW

Hardware

Hardware Group: RF

Hardware Model: PXIe-5644

 

Steps to Implement or Execute Code

Host VIs

The four host VIs stream GPS data. All four VIs generate GPS data and write it to the DMA FIFO in parallel by using producer-consumer loops with a queue. In the producer loop, the niGPS Create Data VI creates the GPS data in packets of interleaved I/Q data. This data then converts to U32 data and enqueues. In the consumer loop, this data dequeues and writes to the DMA FIFO in the niGPS RF Output Stream Write Stream VI. In all four VIs, the streaming DMA FIFO depth can be set. You can view the number of GPS data blocks generated, the number of blocks currently in the queue, and the number of total writes to the DMA FIFO. The array length indicator shows the number of U32 data elements in each block writing to the DMA FIFO.

  1. GPS Direct Streaming.vi—This VI generates the GPS data and directly streams it to the NI PXIe-5644R. The GPS data generates and pushes onto the DMA FIFO in parallel. Under the GPS settings section, the front panel includes many configuration settings for the GPS data, including the following settings:
    • Number of frames 
    • Waveform scaling factor
    • Center frequency 
    • Reference power level
    • Maximum relative power level 
    • Prefilter gain
    • Maximum number of optimal stallites
    • Initial time of week
    • Optimal satellite update interval 
    • Location format (LLA or ECEF) 
    • Location of the receiver. 
    • Initial velocity of the receiver 
    • Initial acceleration of the receiver
  2. GPS Direct Streaming with WAAS.vi—This VI is the same as the GPS Direct Streaming VI above except that it also includes an option for WAAS. Use the switch on the front panel to enable generation of a GPS signal with WAAS and specify the satellites using WAAS.
  3. GPS Streaming from Binary File.vi—This VI opens a binary file and streams the GPS data from it to the NI PXIe-5644R. The VI reads the header information and sets all the GPS properties. The binary file can be generated with one of the write to file VIs included in the GPS toolkit.
  4. GPS Streaming from Trajectory Script File.vi—This VI streams GPS data from a trajectory script. If the desired path of the receiver follows a path that does not have a constant velocity or acceleration, you will find this useful.

FPGA VI

If you have the LabVIEW FPGA module installed, you can open the FPGA VI by navigating to My Computer»PXIe-5644R»VST Streaming (NI PXIe-5644R) (FPGA).vi. You can modify this FPGA or create one as needed for your application.

Running this Sample Project

  1. Ensure all hardware is set up and visible in NI Measurement & Automation Explorer (MAX). Note the resource names of all NI PXIe-5644R devices; you will need these names later.
  2. If you are not using a MIMO configuration, connect the appropriate equipment to RF IN and RF OUT on the NI PXIe-5644R.
  3. In the Project Explorer window, open one of the four host VIs.
  4. In the RIO Device pull-down menu, specify the resource name of the NI 5644R that you identified in Step 1.
  5. Configure the GPS settings and FIFO depth on the front panel.
  6. Click Run. The front panel displays the number of blocks created and the number of blocks in the queue.
  7. Wait for the GPS data to finish generating or click Stop to stop generating early.
  8. Experiment with different values of the front panel controls and click Run. You must restart the VI for new settings to take effect. You also can open and run the other host VI.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors