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.

multiple fir 16 module usage on f28027 Piccolo

Hi everyone. I'm using fir16 module on sprc082 library downloaded from this site. I don't understand if I have to create, in order to filter with the same coefficients two differents variables, two different memory sectors for these variables. More specifically, could  I create a memory section for any of FIR16 type variables and so for relative delay buffers? The only well-working solution I've found is the following:

 

FIR16 lpf=FIR16_DEFAULTS;   
FIR16 lpf1=FIR16_DEFAULTS;
#pragma DATA_SECTION(fir,"firfilt");
FIR16 fir=FIR16_DEFAULTS;
#pragma DATA_SECTION(dbuffer,"firldb");
long dbuffer[(FIR_ORDER+2)/2];
#pragma DATA_SECTION(dbuffer1,"firldb1");
long dbuffer1[(FIR_ORDER+2)/2];
const long coeff[(FIR_ORDER+2)/2]=FIR16_LPF50_CUSTOM;

void filterInit()
{

   lpf.dbuffer_ptr=dbuffer;
   lpf.coeff_ptr=(long*)coeff;  //same coefficients for both variables
   lpf.order=FIR_ORDER;
   lpf.init(&lpf);

   lpf1.dbuffer_ptr=dbuffer1;
   lpf1.coeff_ptr=(long*)coeff; //same coefficients for both variables
   lpf1.order=FIR_ORDER;
   lpf1.init(&lpf1);

}

If this solution is correct, what is the role of the variable fir? Thank you!

 

  • Giovanni,

    your code example defines 3 variables (lpf, lpf1 and fir) of type FIR16, but the code does not use at all variable fir. So just cancel it.

    And, yes, to filter two input signals independently, you will need two instances (lpf, lpf1) and two independent data buffers (dbuffer, dbuffer1). If the filter characteristics are different from each other, you should also use two different coefficient arrays. All these memory sections must be handled by your linker command file.

    Regards.

     

     

  • Thank you, Frank. Your suggest is very precious.