From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to get raw data from FPGA?

Solved!
Go to solution

If my FPGA is sampling at a rate of 20µS and my real time VI loop that is reading from the FPGA is running at say 10mS, any FIFO that I use is going to fill up incredibly fast and overflow/start overwriting data because my real time VI can't process it fast enough.

 

How does one overcome this problem? Am I not supposed to send each sample over to the real time VI and just process everything in the FPGA?

0 Kudos
Message 1 of 4
(1,230 Views)
Solution
Accepted by topic author David99999

Hi David,

 


@David99999 wrote:

How does one overcome this problem?


By improving your VI.

As you forgot to attach any VIs you need to do that on your own!

 


@David99999 wrote:

If my FPGA is sampling at a rate of 20µS and my real time VI loop that is reading from the FPGA is running at say 10mS,

Am I not supposed to send each sample over to the real time VI and just process everything in the FPGA?


You are NOT supposed to read those samples one after the other!

In 10ms your FPGA will collect 500 samples at 50kHz (=1/20µs), so all you need to do is to read 500 samples from your FIFO. (Well, you should read how many samples are already waiting in the FIFO and then read them all - as is shown in the example VIs coming with LabVIEW+RT+FPGA!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,217 Views)

I didn't attach a VI because I'm speaking in broad terms and haven't written any VI's yet.



You are NOT supposed to read those samples one after the other!

In 10ms your FPGA will collect 500 samples at 50kHz (=1/20µs), so all you need to do is to read 500 samples from your FIFO. (Well, you should read how many samples are already waiting in the FIFO and then read them all - as is shown in the example VIs coming with LabVIEW+RT+FPGA!)


Ah, that didn't occur to me but it makes total sense. Thanks

0 Kudos
Message 3 of 4
(1,213 Views)
Solution
Accepted by topic author David99999

@David99999 wrote:

 

Ah, that didn't occur to me but it makes total sense. Thanks

Reading a FIFO consists of a number of things.

 

- locating the FIFO in memory

- determining how much data is in the FIFO available

- preparing memory to write the data into

- transfering the data from the FIFO buffer into the user memory buffer

- cleaning up and updating the bookkeeping

 

Typically the first 3 steps take a considerable and always equal amount of time, pretty much independent if you read one sample, 100 or several millions. The time for the actual transfer of even several 1000 samples from the FIFO into the user buffer is pretty much insignificant in comparison. So reading a single sample from the FIFO costs almost exactly the same time than reading 10000 in one go.

 

Rolf Kalbermatter
My Blog
Message 4 of 4
(1,170 Views)