已回答假定已回答

ADI-21375 FIR出错,求答

Sunnyhgh 在 2015-10-19 詢問的問題
最後回覆由hpkamen於2015-10-20提供

用ADI21375做FIR滤波。

软件实现方式:

用链表DMA方式读取和发送数据BUFF-  >   每一个链表完成后进入中断  ->   ADC L/R数据分离   ->  L/R数据除以2的31次方,变换成浮点数->FIR  -> L/R 数据存入DAC发送BUFF.

问题来了:

 

  DSP21375用VISUAL DSP++5.1.1 FIR库进行滤波,出现如图的情况,FIR输出前40个数据都是"0",不知问题出在哪里?

QQ截图20151019200519.bmpQQ截图20151019200629.bmp

 

 

 

FIR 滤波器通频带是10KHZ ,阻带20K ,二倍频程衰减80DB ,滤波器80阶。

源代码:

 

 

#include <filter.h>

#define N NUM_SAMPLES/2

#define TAPS  80

 

//滤波器系数

float pm adcoeffs[TAPS+1]={

                  -0.00142993104524,-0.003289811986829,-0.005282332460651,  -0.0075069448623,

                  -0.00833784587848,-0.007776107140672,-0.005016122768101,-0.001099967770155,

                  0.003213643962488, 0.006016725367764, 0.006414789515753, 0.003780666676801,

                 -0.0007747690201561,-0.005593084934047,-0.008292796716591,-0.007474471569354,

                 -0.002894142730604,  0.00370558678562, 0.009576439183326,  0.01170483457889,

                  0.008546757383277, 0.000697116076388,-0.008783990634843, -0.01564147328494,

                  -0.01604979055559,-0.008671667639916, 0.004414367121836,  0.01793968257963,

                   0.02542079739782,   0.0218443329146, 0.006360386319139, -0.01649993681243,

                  -0.03756126656446, -0.04588317097792, -0.03271438997146, 0.004775757393522,

                   0.06159175162126,   0.1256310834033,    0.181053268937,   0.2131620859593,

                    0.2131620859593,    0.181053268937,   0.1256310834033,  0.06159175162126,

                  0.004775757393522, -0.03271438997146, -0.04588317097792, -0.03756126656446,

                  -0.01649993681243, 0.006360386319139,   0.0218443329146,  0.02542079739782,

                   0.01793968257963, 0.004414367121836,-0.008671667639916, -0.01604979055559,

                  -0.01564147328494,-0.008783990634843, 0.000697116076388, 0.008546757383277,

                   0.01170483457889, 0.009576439183326,  0.00370558678562,-0.002894142730604,

                 -0.007474471569354,-0.008292796716591,-0.005593084934047,-0.0007747690201561,

                  0.003780666676801, 0.006414789515753, 0.006016725367764, 0.003213643962488,

                 -0.001099967770155,-0.005016122768101,-0.007776107140672, -0.00833784587848,

                   -0.0075069448623,-0.005282332460651,-0.003289811986829, -0.00142993104524

};

float adinputL[N];//左声道分离后的数据输入

float adoutputL[N];//右边声道分离后的数据输入

float adinputR[N];//左声道FIR输出的数据

float adoutputR[N];//右声道的输出数据

float adstate[TAPS+1];//阶数

//*******************

下面是中断中的FIR滤波:

     for (i = 0; i < TAPS+1; i++)*(adstate+i) = 0; 

   

    //分离ADC输入左右声道的数据

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

    {

    //temp_out=(int)((*(output+i/2))*65535);

      *(adinputL+i/2)=(float)((*(block_ptr+i))/2147483648.0);

      *(adinputR+i/2)=(float)((*(block_ptr+i+1))/2147483648.0);

    }

//左右声道的数据进行FIR

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

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

//恢复FIR后的数据到DMA BUFFER

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

    {

    //temp_out=(int)((*(output+i/2))*65535);

      *(block_ptr+i )=(int)((*(adoutputL+i/2))*2147483648.0);

      *(block_ptr+i+1)=(int)((*(adoutputR+i/2))*2147483648.0);

    }

    ***************//

結果