LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA DMA FIFO streaming timed loop or normal loop?

Hello,

 

I am writing a program whereby I simultaneously need to stream data to and from the FPGA target. I would imagine this is a rather common producer/consumer scenario.

 

The host continuously streams output data to the target via a Host to Target DMA FIFO and the target subsequently outputs this data. At the same time, the target makes some measurements and streams this data to a Target to Host DMA FIFO for the host to download and save. This seems roughly to work, except for some FIFO buffer underruns/overfills that I am trying to debug at the moment.

 

I would like this process to run as fast as the hardware can. My question is what kind of loops should I use to achieve maximum throughput/speed. Should I use normal loops and sleep on the DMA FIFO read/writes (by wiring -1 to the timeouts)? Or else, should I use timed loops wiring 0 to the timeouts and make my timeouts by hand, e.g. by counting a maximum number of ticks that happened to timeout before declaring a buffer underrun/overfill?

 

I guess another way of asking this question is how can I achieve maximum throughput/speed with DMA FIFOs? Is this achieved by using timed loops? Else, if using a normal loop, is this code going to be compiled such that a large chunk of data is going to be transferred fast between the Host and Target?

 

Thank you.

Jacob

0 Kudos
Message 1 of 3
(2,367 Views)

Hello Jacob,

 

Thanks for using the National Instruments forums. I recommend following the CompactRIO Developers Guide and the Example Projects that ship with LabVIEW.

 

In page 90 (97 of the PDF) of the CompactRIO Developers Guide, you will find more information about DMA FIFOs and to read/write them in both the FPGA and RT. Moreover, I suggest you take a look into the LabVIEW Waveform Acquisition and Logging on CompactRIO Sample Project (located under File > Create Project) to see how this communication is achieved.

 

All the best,

Message 2 of 3
(2,308 Views)

Hello Jacob,

 

The cRIO Development guide is a great source for general development on a cRIO and give tons of information.

So I would certainly recommend having a read on it if you use one (you didn't mention which RIO you are using).

 

For high throughput application I would recommend reading the The NI LabVIEW High-Performance FPGA Developer's Guide.

Starting page 83 there are a lot of tips how to optimize DMA performance.

 

Andreas

 

Andreas
CLA, CTA
0 Kudos
Message 3 of 3
(2,296 Views)