AnsweredAssumed Answered

Aboat 21375 EZ-KIET run"  block based talkthru "with "FIR " make a noise!

Question asked by Sunnyhgh on Oct 27, 2015
Latest reply on Nov 23, 2015 by Mitesh

Hi:

When I use ADSP-21375 EZ-KIET Lite board and run the"  block based talkthru" code example,it runs well.

Then

I add the fir filter (use visual dsp++ 5.1.2 ) codes  into the "void processBlock( int *block_ptr)" ,it operating a  error that  DAC make a noise.

 

ADSP-21375 EZ-KIET Lite:

Input:1KHZ 0dBv sine wave.

Output:ERROR,the sine wave distortion appears.QQ截图20151027144402.bmp

If dsp   generate a sine wave by itself, or by_pass fir filter, DAC will output normally.

 

 

 

 

Here the codes:

 

// SPORT0 ADC ISR

void TalkThroughISR(int sig_int) /* No argument is passed in this ISR */

{

  //Increment the block pointer

if(isProcessing)ProcessingTooLong();

    int_cntr++;

    int_cntr %= 3;

    blockReady = 1;

}

/ DMA TX/RX BUFFER

#define NUM_SAMPLES 384

 

#define TAPS  83

// The FIR ouput array ,No.0 to the " DL "elements are incorrect.

#define DL  ((TAPS-1)/2)

#define N (NUM_SAMPLES/2+DL )

//FIR input L channel data:No.0 to 191 elements ,the No.192 to 233 are "0".

float adinputL[N];

//FIR  output L channel data:No.0 to the " DL "elements are incorrect,the No.DL to 233 are  usefull.

float adoutputL[N];

//FIR input R channel data:No.0 to 191 elements ,the No.192 to 233 are "0".

float adinputR[N];

//FIR  output R channel data:No.0 to the " DL "elements are incorrect,the No.DL to 233 are  usefull.

float adoutputR[N];

// FIR  states

float adstateL[TAPS+1];

float adstateR[TAPS+1];

// FIR  coeffs

float pm adcoeffs[TAPS]={

  -0.000403038195722,7.129271485026e-19,0.0004522593913585, 0.000761363609974,

  0.0007434622863051,0.0003094515963677,-0.0004442989071892,-0.001205202031486,

  -0.001534621077612,-0.001081448704452,0.0001678836573597, 0.001753810988894,

  0.002855118076214, 0.002664598363695,0.0008806529073619, -0.00195388951795,

  -0.004519403955275,-0.005269625469738,-0.003268848605737, 0.001101928378573,

  0.006016016776022, 0.008867545545789, 0.007545053831489, 0.001734700999099,

  -0.00647021389647, -0.01314835726836, -0.01426439863309,-0.007835843180117,

  0.004512188464698,  0.01755834878578,  0.02438698214213,  0.01959828726337,

  0.002481210944641, -0.02141101045025, -0.04132638701527, -0.04497487457391,

  -0.02353071250617,  0.02404398954612,  0.08930034378228,  0.1562204820565,

    0.2062782787256,  0.2248164317383,  0.2062782787256,  0.1562204820565,

    0.08930034378228,  0.02404398954612, -0.02353071250617, -0.04497487457391,

  -0.04132638701527, -0.02141101045025, 0.002481210944641,  0.01959828726337,

    0.02438698214213,  0.01755834878578, 0.004512188464698,-0.007835843180117,

  -0.01426439863309, -0.01314835726836, -0.00647021389647, 0.001734700999099,

  0.007545053831489, 0.008867545545789, 0.006016016776022, 0.001101928378573,

  -0.003268848605737,-0.005269625469738,-0.004519403955275, -0.00195388951795,

  0.0008806529073619, 0.002664598363695, 0.002855118076214, 0.001753810988894,

  0.0001678836573597,-0.001081448704452,-0.001534621077612,-0.001205202031486,

  -0.0004442989071892,0.0003094515963677,0.0007434622863051, 0.000761363609974,

  0.0004522593913585,7.129271485026e-19,-0.000403038195722

};

/* Place the audio processing algorithM here. The input and output are given

  as unsigned integer pointers.*/

void processBlock( int *block_ptr)

{

  volatile int i,j;

    int temp_out;

    isProcessing = 1;

    /*Clear the Block Ready Semaphore*/

    blockReady = 0;

  //Audio datas from "block_ptr" (ADC datas),and copy to FIR input arrays.

    j=0;

    for(i=0;i<NUM_SAMPLES;i+=2)

    {

      *(adinputL+j)= __builtin_conv_RtoF((*(block_ptr+i)));

    *(adinputR+j)= __builtin_conv_RtoF((*(block_ptr+i+1)));

    j++;

    }

  // FIR process .

// By_Pass the FIR , DAC will output normally.

    fir (adinputL,adoutputL,adcoeffs,adstateL,N,TAPS);

    fir (adinputR,adoutputR,adcoeffs,adstateR,N,TAPS);

 

  //Copy datas to DAC DMA TX buffer

    j=0;

    for(i=0;i<NUM_SAMPLES;i+=2)

    {

      (*(block_ptr+i ))=__builtin_conv_FtoR(*(adoutputL+DL+j));

      (*(block_ptr+i+1))=__builtin_conv_FtoR(*(adoutputR+DL+j));

      j++;

    }

    /*Set the Processing Active Semaphore before starting processing*/

    isProcessing=0;

}

 

// Dsp generate a sine wave by itself.

    for(i=0;i<NUM_SAMPLES;i+=2)

    {

       *(adinput+i) =__builtin_conv_FtoR(0.8*sinf(2*pi*1000*i/fs));

       *(adinput+i+1) =__builtin_conv_FtoR(0.8*sinf(2*pi*1000*i/fs);

    }

//Audio datas from "block_ptr" (ADC datas),and copy to FIR input arrays.

    for(i=0;i<NUM_SAMPLES;i+=2)

    {

      *(adinputL+j)=__builtin_conv_RtoF(*(adinput+i));

      *(adinputR+j)=__builtin_conv_RtoF(*(adinput+i+1));

      j++;

    }

 

I just no way to check the errors!.

 

 

Thanks!

Outcomes