I use the 'Butterworth Filter Express' VI in my LabVIEW FPGA code. This VI is both configured via some dialog box options, and by cabling some scaling coefficients to its inputs. I calculate the filtering coefficients in the RT side using the 'Butterworth Coefficients' VI, I pass these coeffs to the FPGA and wire them to the 'Butterworth Filter Express' VI.
Among the dialog box options, there are two options that deal directly with the cutoff frequency:
- Cutoff frequency
- Expected sample rate
However, I already specify these properties when I calculate the filtering coeffs in the RT. So, my question is simple:
Since the sample rate and cutoff frequency are specified when calculating the filtering coeffs, are the cutoff frequency and expected sample rate in the FPGA side (dialog box) ignored when you wire some values to the filtering coeffs inputs?
To my understanding the parameters in the dialog box of the FPGA side are taken into account when we dont wire any value to the scaling coeffs input, thus giving a constant cutoff frequency. However, if the cutoff frequency is calculated in the RT as scaling parameters (thus we can vary the cutoff freq), both Cutoff frequency and Expected sample rate of the dialog box are ignored.
Am I right?
Solved! Go to Solution.
You can pass filter coefficients as long as you have the same filter type and order, which I suppose is your case here. The "Butterworth Filter Express" VI on the FPGA doesn't have "Cutoff frequency" and "Expected sample rate" inputs on the block diagram. You can only access those parameters on the dialog box.
So, if the specified frequency and sample rate on the RT are different from the ones on the FPGA, LabView will process the data filtering on the FPGA side using the values for frequency and sample rate specified in the dialog box even if scaling coefficients are wired in the input.
It is better to keep the same configuration ("Cutoff frequency" and "Expected Sample rate") for both "Butterworth coefficients" VI on the RT and "Butterworth Filter Express" VI on the FPGA.
Thanks for answering.
So I understand that "Cutoff frequency" and "Expected sample rate" parameters have an influence in the processing of the scaling coefficients. In that case, is there a "best" value I should specify in the cutoff frequency (dialog boxes), knowing that I will vary my cutoff frequency (via inputs) from 0Hz to 5kHz (for a 10kHz signal)?
I can't say for sure which value of the frequency would be ideal for your application. I would suggest you take a look at the provided LabView project on Butterworth Filters already available in your LabView install directory. You can access the project by following this adress in the explorer: labview\examples\CompactRIO\FPGA Fundamentals\FPGA Math and Analysis\Butterworth Filter\Butterworth Filter.lvproj
This would help you set up your filter correcty. The only difference is that in the example, the coefficients are calculated from the host computer and not from the RT.
That example does not say much about how to configure the dialog box. Furthermore, it seems the cutoff frequency is left to its default (1kHz). I'll need to give it a try like this.
The lack of information on this subject by NI is simply shameful. There is nothing explained, neither in the web nor in the examples.
Anyway, thank you @keloueldrhiri for your help. I'll accept your first answer cause it was helpful.