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
____________________________________________________________________________