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: 

LMS implementation in LabVIEW fpga (High throughput personality)

Hello there !

Have to say surprised with the limitations of labVIEW FPGA in array implementation. I am not experienced enough in labview to make this comment but I found it very difficult to work with arrays !!.

I am working on Active Noise Cancellation project. I need to collect audio data from two microphones @40k Sample rate and 100 samples per frame (at least) and output the audio through loud speaker @40k sample rate. For this purpose, I am using myRIO 1900 in FPGA High throughput personality.

Right now, I am trying to implement LMS algorithm in LabVIEW FPGA platform. I have attached png file of MATLAB code , what I want to implement !

 

Till array intializations are fine but when it comes to temporary vector manipulations. like :

x_temp(1:nr_c-1)=x_temp(2:nr_c);

x_temp(nr_c)=x(i);

 

I am going mad ! How to do this ? LabVIEW doesnt allow us to index the 1D arrays properly ( we can only extract one particular element of array not part of array, I can extract x_temp(1:nr_c) with sub array function  but how to extract  x_temp(2:nr_c) ) 

 

Please help me how to do the manipulation of 'x_temp' vector with the above basic statements.

 

PS: 1.LabVIEW FPGA supports only one dimensional array operations .

       2. Even though Adaptive Filter Toolkit pallettes are available in myRIO FPGA High throughput personality, I cannot install Adaptive Filter Toolkit on myRIO Target.!!!

      3.In MyLMS program : x : input vector(Array) , y: Desired Signal, nr_c : number of filter coefficients ,step: step size. I hope you understood the rest program 🙂 

 

MyLMS.m :

function [y_hat,e,w] = MyLms(step, nr_c, x, y)

 

%intializing all vectors
coeffs=zeros(1,nr_c);
x_temp=zeros(1,nr_c);
y_hat=zeros(length(x),1);
e=zeros(length(x),1);

 

for i=1:length(x)
%temporary vector formation
x_temp(1:nr_c-1)=x_temp(2:nr_c);
x_temp(nr_c)=x(i);
%LMS algorithm iterations
y_hat(i) = x_temp * coeffs';
e(i)= y(i) - y_hat(i);
coeffs = coeffs+step*e(i)*x_temp;
end

 

0 Kudos
Message 1 of 4
(3,260 Views)

As this is a LabVIEW forum, can you show the LabVIEW code you have tried?

 

Yes, array operations in FPGAs are limited because your code is defining an electronic/hardware circuit you're creating rather than programming a general purpose microcontroller. Large arrays use FPGA resources and you are limited to fixed array sizes.

 

There are ways to work with arrays though, but it would help if you were to show us what you have tried so we can make suggestions.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 4
(3,248 Views)

Here is  my half done VI , I have done with the intialization part. 

Now I need to implement my Matlab code in for loop.

 

I cannot manipulate as I said earlier x_temp vector.

 

Please check and make suggestions.

 

Thank You.

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

I think I might have completed total LMS implementation !! Just checking for loop holes and optimizing the algorithm.

 

Thanks for the support 🙂

 

If anyone interested,i am ready to post the VI 

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