Low Communication Speeds When Using NI-VISA to Communicate with PXI FPGA Board

Updated Nov 23, 2022

Reported In

Driver

  • NI-VISA

Issue Details

I'm trying to use the NI-VISA driver to communicate with an FPGA card housed in my PXI chassis, but am seeing dramatically slower communication speeds than I am expecting since the card's FPGA should allow for faster transfers. Is this expected, and is there anything I can do to improve the speed of this communication?

Solution

The communication speeds you're seeing are likely expected - while the NI-VISA driver is capable of communicating with FPGA devices, these functions are only intended for basic device control. In order to improve your communication speed, you will likely need to use a custom device driver for your FPGA card which utilizes DMA transfers to communicate data. If you have an NI FPGA card, you can make use of the LabVIEW FPGA Module to perform this high-speed communication, whereas you'd need to utilize a third-party or custom-developed driver for a third-party card.

 

Additional Information

If you can confirm your FPGA card is capable of utilizing DMAs and know how to control them for your device, you can use the NI-VISA .NET API and the below high-level procedure as a structure for communicating between your FPGA device and your PXI controller using the NI-VISA driver. Information on the functions referenced in the procedure below can be found in the NI-VISA .NET Help, which is located  at C:\Users\Public\Documents\National Instruments\NI-VISA\Documentation by default on your machine following downloading the NI-VISA driver.
  1. Use VISA's MemoryAllocate mechanism to create a DMA-compatible buffer.
  2. Use VISA's MapAddress command to map the allocated DMA buffer into the process. Be sure to map the allocated buffer, not the PCI memory directly.
  3. Use device-specific mechanisms to start a DMA transfer. This will include sending the address from MemoryAllocate to the device.
  4. Use device-specific mechanisms to determine when the transfer is complete.
  5. Access the data directly in memory through MemoryMap.VirtualAddress, or read offsets using MemoryMap.Peek/Poke commands.
At this point the data is in host memory, and can be accessed as a normal data buffer through MemoryMap.VirtualAddress. Special care is needed to ensure that the data is not consumed while still being modified by the hardware through DMA.