11-29-2021 12:55 PM
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?
Solved! Go to Solution.
11-29-2021 01:46 PM
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!)
11-29-2021 02:03 PM
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
11-30-2021 05:30 AM
@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.