Improving Streaming Performance When Using PXIe-5172

Updated Jun 11, 2024

Reported In

Hardware

  • PXIe-5172
  • PXIe-5170

Driver

  • LabVIEW Instrument Design Libraries for Reconfigurable Oscilloscopes

Issue Details

I create a project with the Stream To Host (NI 5170) sample project to run with a PXIe-5172 target. When I run the VI and use 4 channels to acquire, it acquires at an appropriate rate. However, when I use 8 channels, the buffer becomes increasingly full of memory and overflow occurs. How can I improve the program to avoid the overflow?

Solution

You can try configuring the controls below that can affect streaming performance mentioned in the Stream To Host (NI 5170) Documentation of the sample project to improve your code.
  • Channel(s) - Increasing the number of channels increases the required data bandwidth. If the required bandwidth exceeds the actual bandwidth, a buffer overflow will occur. Note that the amount of data being streamed is equivalent to the number of channels selected rounded up to the nearest power of two. For example, if five channels are selected, the required bandwidth will be equivalent to the bandwidth required to stream eight channels.
  • Fetch size - If this number is too small, then the fetch and loop overheads begin to dominate processing time, resulting in poor performance.
  • Fetches per display update - Increasing this value decreases the frequency at which status information is read from the device and, optionally, decreases the rate at which data is displayed. Increasing this value increases streaming performance.
  • Display on - This control determines whether data is displayed in the graph. Turning this off can greatly improve streaming performance.
  • Decimation factor - Increasing the decimation factor decreases the effective sampling rate, which in turn decreases the required bandwidth. Because of the maximum bandwidth of the PXI Express bus, this value must be greater than one to continuously stream more than four channels.

Additional Information

A data overflow error will occur whenever there is data to stream generated at a data rate higher than it can be processed. There are two ways in which this can happen
  1. The transfer mechanism (DMA over PCIe bus) does not have the capacity to transfer the data at the desired rate.
  2. The application (e.g. the VI presenting the data) cannot keep up with the transfer. i.e. the application reading the data does not free up the data buffer fast enough for the buffer to be able to receive new data from the bus.
     
To avoid this overrun then knowing below 3 numbers is useful:
  1. The data rate at which the instrument is trying to stream data. This is generally (sample rate x sample size in the stream x number of channels) / decimation factor. Reducing the number of channels or increasing the decimation factor (i.e. reducing the sample rate at which data will be streamed) will reduce this number accordingly, and why it is listed as a recommendation.
  2. The data rate at which the bus in the system can transfer the data. In a simple PXIe system, this is affected by the PXIe chassis and the PXIe controller. In a more complex system, there may be MXI links and external CPUs involved. Other aspects of the system (e.g. other instruments streaming at the same time) can also affect this data rate and cause a bottleneck.
  3. The data rate at which the system can process the data. This can be affected by CPU efficiency, CPU utilization, and in general, the amount of work the CPU has to do every time it needs to process a certain amount of data. This is why "fetches per display" and "display on" are mentioned as able to affect the performance