LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fft on FPGA

Hi,

I am curretly calculating the FFT on the FPGA using the FFT Express VI . After computing the FFT I want to determine the frequency of the signal using the Magnitude spectrum plot, all the processing has to be done on the FPGA without sending the data to the PC . Any ideas how to go about implementing this. I checked several example codes for FFT but all of them seem to be using the DMA FIFO for analyzing data on the PC . However, for my application the entire processing needs to be carried out on the FPGA. Any help on this would be really appreciated .

 

Thank you.

 

Regards

0 Kudos
Message 1 of 8
(4,155 Views)

You say you want to compute "the frequency of the signal" after you do the FFT.  Do you understand Frequency-Domain analysis?  Do you know that the magnitude of the FFT signal is the amplitude of that frequency component of the signal?  So unless you are dealing with a pure sinusoid that has been sampled at an appropriate (higher) sampling frequency, there won't be a single "frequency" in the FFT.  However, surely the FPGA could find the magnitudes of the frequency components and compute, say, the frequency at which the maximum appears (or some other computation you'd like to make) ...

 

Bob Schor

0 Kudos
Message 2 of 8
(4,119 Views)

Hi,

 

Yes I want to find the frequency at which the maximum occurs , by observing the magnitude spectra plot on the FPGA(not on the cRIO/PC). Is there any reference VI for the same?

 

Thank you.

 

 

0 Kudos
Message 3 of 8
(4,113 Views)

Am I not correct that cRIOs do not have a display?  I'm even more certain that the FPGA subset does not have an associated display ...  However, you should be able to "do math" on an FPGA and, say, "find the maximum" ...

 

Bob Schor

0 Kudos
Message 4 of 8
(4,099 Views)

@Bob_Schor wrote:

Am I not correct that cRIOs do not have a display?  I'm even more certain that the FPGA subset does not have an associated display ...  However, you should be able to "do math" on an FPGA and, say, "find the maximum" ...


Newer cRIOs running the embedded Linux RT do have a display.  But an FPGA does not have a display, it is essentially a programmable IC, it has no operating system and no display.  You could potentially drive one through several communications but you probably don't want that.  If you have a cRIO with a display then this should be pretty easy.  If you have an embedded target without a display it will not be easy to drive a display.  What hardware do you have?  What method of displaying it do you intend on using?

0 Kudos
Message 5 of 8
(4,093 Views)

Depending on your configuration a spectrum will contain a fixed number of samples which are streamed out. For arguments sake lets say it is 128.

 

So to pick out the maximum value you can have some sort of pt by pt maximum detection that resets every 128 samples. At the end of each 128 it can put the maximum index somewhere depending on what needs it.

To convert the index to frequency you then need to know the sampling rate and size but if it is being used on the FPGA directly you may be able to avoid this step anyway.

 

The FFT block is not straightforward to use and uses a lot of space. So beware, there is a reason there aren't a lot of examples, it often complicates things a lot more than doing it on the host. It should provide you with valid flags to know when to reset the maximum tracker (don't have LV in front of me at the minute).

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 6 of 8
(4,084 Views)

Hi,

 

Thanks a lot for the prompt responses. I apologize for the delay in response as was working on something else. Will definitely check and get back on this.

 

Thanks

 

Regards

0 Kudos
Message 7 of 8
(3,985 Views)

You have to be aware that the index of the maximum magnitude will not give you a very accurate value for your frequency measurement. If your measurement time is T0, the frequency result uncertainty will be +/- 0.5/T0. This may or may not be good enough for your application.

 

Also if your signal is relatively clean (looks 'more or less' like a sine tone) you can probably achieve the same accuracy by simply counting the number of zero-crossing during the T0 measurement time. This is a lot 'cheaper' than an using an FFT. Another advantage is that it is easy (and free) to increase the measurement time (T0), something that is very demanding (if at all possible) when you use and FFT.

 

Alternatively if your signal is clean you can also improve the result resolution by performing interpolation around the zero crossing, However your signal has to be 'clean' in the sense that no other tones or noise significantly affect the location of the zero crossing. You can improve your signal quality with for example appropriate pre-filtering.

 

The best method to choose therefore depends on the type of signal you are dealing with. Questions to consider include:

-  Do you know the frequency of interest with a specific uncertainty (like 12345.678  Hz +/- 1000 Hz)?

- What result accuracy do you need?

- Can you freely choose the measurement time T0?

- Does your signal have unwanted zero crossing caused by other tones or noise? If so can this issue be removed (or at least reduced) using appropriate filtering?

 

Then there are other method you can use to improve your measurement accuracy like frequency domain interpolation, but let's hear what your requirements are before moving in that direction.

0 Kudos
Message 8 of 8
(3,975 Views)