LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RT - How can I make data transfer to host faster?

Hi 
I have created a program that acquires data on FPGA then transfers them to RT so RT can send them up to the windows host once UI is connected.

The program is based on message type structure as in NI's examples.

 

However, I have one problem the data to windows host is not transferred fast enough.

Pic1 shows the offending bit of code and FPGA.png what's hiding in the subVi.

 

FPGA is meant to acquire to cycles of a sine wave. In this case it approximately 40 ms of data at 25us sampling rate (40kS/s 8 channels). Later the data is sent to the host. As you can see I have a dedicated stream for data only and a different one for message passing.

 

If I disable the code in the case structure this loop executes in 39-40 ms, however when I start sending the data to the host the rate drops to 57-60 ms per iteration and that sooner or later leads to buffer overflow.

I have experimented with passing the acquired data to a different loop using a queue but that wasn't faster. I have also tried pipelining but that did not speed it up either. Would you have any suggestions how I could improve my transfer rates?

 

Thank you.

Bartosz

Download All
0 Kudos
Message 1 of 4
(3,322 Views)

In "Get 1 cycle Of Data.vi" there is a while loop that runs without any time delay, so it will use 100% CPU while it is waiting for the DMA FIFO to fill up.  This might explain why pipelining and parallel loops with queues hasn't worked for you.  If you insert just a 1 ms delay in this loop you may see that a lot of resources are freed up so you can run network related tasks in parallel. Also, the buffer sizes used in your network streams could have an affect on performance, as described in this document.

 

Chris M

0 Kudos
Message 2 of 4
(3,268 Views)

I have tried with 4,5 and 10 ms waits in the loop polling the number of elements in the FIFO. I have added feedback nodes for data to use pipelining in the loop transfering data to the host. 4,5 ms waits made no difference and the 10 ms wait made the loop take longer to execute.

 

Any other suggestions?

0 Kudos
Message 3 of 4
(3,219 Views)

Hi barteklul,

 

There are 2 main methods of achieving fast data transfer between RT and Host PC:

 

1. Using the "Shared Variables", they allow you to transfer data deterministically from
RT to Host PC, usually are used to monitor data.

 

Please have a look at this article:
https://www.ni.com/docs/en-US/bundle/labview-real-time-module/page/sharing-data-using-shared-variabl...

 

This is the example code:

https://forums.ni.com/t5/Archive-TKB/Real-Time-Shared-Variable-Communication-Example/ta-p/3519485

 

The only disadvantage of such method is that if for example RT gets data really fast
your Host PC can miss some samples.

 

2. In order to receive all data from RT

(guaranteed 100% data transfer without missing any samples) "Network Streams" should be used.
It is a little bit more complex to implement, but if you want to store data to the file "Network Streams"
are strongly suggested. In addition "Network Streams" are not deterministic.

 

For more details about network streams please read this article:
https://www.ni.com/en/shop/labview/lossless-communication-with-network-streams--components--archite....

 

At the moment I see that you are using "Network Streams" to transfer data and also I can see that you have some timing on RT

which can slow down the data transfer rate. I suggest you to transfer data to Host PC as soon as it comes into the FIFO.

Also if you transfer data just to monitor it, I suggest you to try Shared Variables method.

 

I hope that you will this information useful!

 

Kind Regards,

0 Kudos
Message 4 of 4
(3,030 Views)