This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Filter Sound on EVM5517, so DSP 5517

Hello all,

I'm trying to compute a filter on the sound data received on my i2s bus of my dsp c5517 on a EVM5517 board. I don't know which mistake have I done, but I done hear nothing at all. I implement a RLS filter.

______________________Reading and Writing on I2s bus of dsp, working when I don't use pure_rls_working() ________________________

while(1){

/// Omplim el buffer de data

/* Read Digital audio input 1 */
data3 = I2S0_W0_MSW_R;
data1 = I2S0_W0_LSW_R;
data4 = I2S0_W1_MSW_R;
data2 = I2S0_W1_LSW_R;
while((Rcv & I2S0_IR) == 0); // Wait for interrupt

///___________________________________________________
/// Filtering Data according our Algorithm
///aux=rls_algorithm (data1,data3_prima);
///____________________________________________________

if(count<32){
fill_buffer_rls(data4, data3,count);
count++;
}
else{
data3=pure_rls_working(data4, data3);
}




I2S0_W0_MSW_W = data3;
I2S0_W0_LSW_W = data1;
I2S0_W1_MSW_W = data4;
I2S0_W1_LSW_W = data2;

while((Xmit & I2S0_IR) == 0); // Wait for interrupt

}

and on the other hand my function pure_rls():

float pure_rls_working(Int16 noise, Int16 signal){

	printf("__________________\n" );
	printf("Acquired Noise  : %i \n",noise);
	printf("Acquired Signal : %i \n",signal);


	///function [e,w] = RLSFilterIt(n,x,fs)
	float buff_wy=0;
	 ///tic
	float buff_yPi=0;
	float buff_ky=0;
	 ///%--------------------------------------------------------------------------
	 ///% Filtering
	 ///%--------------------------------------------------------------------------


	 	 ///for m = p:length(x)
	 	 ///   % Acquire chunk of data
		aux=30;
		for (aux = 30; aux > -1; aux--){
								n[aux+1]= n[aux]; /// Update Memory of Data
								x[aux+1]= x[aux];
								Pi[aux+1] = 0; /// Matrix Pi Init
							}
		n[0]= noise;
		x[0]= signal;
		Pi[0]= 0;
		for (i_index = 0; i_index < 32; i_index++){
						y[i_index] = n[i_index]; /// Data acquisition
		}
	    ///  % Error signal equation
	    ///e = x-w'*y;

	    for (i_index = 0; i_index < 32; i_index++){	buff_wy= buff_wy + w[i_index]*y[i_index]; }

	    e = signal-buff_wy; /// Error Calculation
	    printf("Error Calculation: %f \n",e);

	    ///   % Parameters for efficiency
	    ///Pi = P*y;
	    for (i_index = 0; i_index < 32; i_index++)
	    {
	    	for (j_index = 0; j_index < 32; j_index++){
	    								Pi[i_index] = Pi[i_index] + ((P[i_index][j_index])*y[j_index]);
	    								///printf("Print Pi[%d]: %f \n",i_index,Pi[i_index]);
	    							}

	    }
	    ///  % Filter gain vector update
	    ///k = (Pi)/(lambda+y'*Pi);

	    for (i_index = 0; i_index < 32; i_index++)
	    	    {
	    			buff_yPi= buff_yPi + y[i_index]*Pi[i_index];
	    	    }

	    printf("buff_yPi : %g\n",buff_yPi);

	    buff_yPi= buff_yPi + lambda;
	    printf("buff_yPi + lambda : %g\n",buff_yPi);

	    for (i_index = 0; i_index < 32; i_index++)
	    	    	    {
	    	    			k[i_index]= (Pi[i_index]/buff_yPi);
	    	    			printf("K coefficients : k[%i]: %g\n",i_index,k[i_index]);
	    	    			buff_ky = buff_ky + k[i_index]*y[i_index];
	    	    	    }
	    /// % Inverse correlation matrix update
	    ///P = (P - k*y'*P)*laminv;

	    for (i_index = 0; i_index < 32; i_index++)
	    	    {
	    	    	for (j_index = 0; j_index < 31; j_index++){
	    	    													P[i_index][j_index]= (P[i_index][j_index]-P[i_index][j_index]*buff_ky)*laminv;
	    	    												}
	    	    }

	    ///% Filter coefficients adaption
	    for (i_index = 0; i_index < 32; i_index++)
	    	    	    {
	    					w[i_index] = w[i_index] + k[i_index]*e;
	    					printf("W coefficients :w[%i]: %g\n",i_index,w[i_index]);
	    	    	    }

	    printf("Signal error : %f\n",e);
	    printf("__________________\n" );

return e;

When bus is without filter, I hear my perfect music. But When i use this function it doesn't. I have checked the values of the weights on the filters, and there are far from good. Could you please orientate me? It is a failure because using this type of data or variables? Something with fixed point related?

I hope one day I could filter good sound :)

Thank you in advance

ip

____________________________________________________________________________

  • Int16 p ;
    Int16 lambda;
    Int16 laminv;
    Int16 delta;
    Int16 y[32];
    Int16 i_index;
    Int16 w[32];
    Int16 k[32];
    Int16 Pi[32];
    Int16 P[32][32];
    Int16 n[32];
    Int16 e;
    Int16 j_index;
    Int16 buff_yPi;
    Int16 ind;
    Int16 x[32];
    Int16 aux;



    void init_rls(){

    ///% Filter Parameters
    p = 32; /// % filter order
    lambda = 1; /// % forgetting factor
    laminv = 1/lambda;
    delta = 1.0; /// % initialization parameter

    ///% Filter Initialization
    ///for (i = 0; i < 31; ++i){
    e = 0; /// % error signal

    ///}
    for (i_index = 0; i_index < 32; i_index++){

    for (ind = 0; ind < 31; ind++){ P[i_index][ind] = 0; };
    P[i_index][i_index] = delta; /// % inverse correlation matrix P = delta*eye(p);
    w[i_index] = 0 ;
    y[i_index] = 0 ;
    } /// % filter coefficients} ///w = zeros(p,1);


    }

    void fill_buffer_rls(Int16 noise, Int16 reference, int index){

    x[index]= reference ;
    n[index]= noise;

    }
  • I would be happy, if I could implement de lms example on the library of the c55xx example. But with my board, I have a problem with memory and libraries after compiling. I guess, I cannot use those examples on my actual evm5517.
  • Ignasi,

    As mentioned in your above post, could you please provide some details on what problems you are having with the LMS example?
    Path to the project you are trying and any other information that would assist in understanding the memory and library problems that you are having.

    Regards,
    Lali