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.

F28335 FIR32 issue

Other Parts Discussed in Thread: CONTROLSUITE

Dear all,

I m using a FIR32 based on the FPU FIR example provided by TI. I can't get it to work properly :

I get my coeff from MATLAB using :

f = [[0 0.48 0.50 0.52 0.54 1]];
a = [0 0 1 1 0 0];
b = firpm(63,f,a);

I use the coeff from b, at the startup :


    coeff[0]= 0.051547096527528f;
    coeff[1]= 0.020357831058088f;
    coeff[2]= -0.031441262081694f;
    coeff[3]= 0.009811624113904f;
    coeff[4]= 0.009698354038584f;
    ...
    ...
    coeff[59]= 0.009698354038584f;
    coeff[60]= 0.009811624113904f;
    coeff[61]= -0.031441262081694f;
    coeff[62]= 0.020357831058088f;
    coeff[63]= 0.051547096527528f;
 
    firFP.order=FIR_ORDER;
    firFP.dbuffer_ptr=dbuffer;
    firFP.coeff_ptr=(float *)coeff;
    firFP.init(&firFP);


then I used the filter on a 8192 SIN signal to be sure it works properly. I use the View/graph tool to
figure out the shape of my signal :

    for (j=0; j<8192; j++)
    {
    //10kHz signal, 600Khz sampling
        firFP.input = (float)sin(2.0 * 3.14159265358979 * (10000.0/600000.0) * j);
        firFP.calc(&firFP);
        g_AdcTraitement[j] = (float)firFP.output;
    }

I do the following stuff as well:


#pragma DATA_SECTION(g_AdcTraitement,"AdcTraitement");
float g_AdcTraitement[8192];

#pragma DATA_SECTION(firFP, "firfilt")
FIR_FP  firFP = FIR_FP_DEFAULTS;
                                           
/* Define the Delay buffer for the 64th order filter and place it in "firldb" section */ 
#pragma DATA_SECTION(dbuffer, "firldb")
float dbuffer[64];

/* Define Constant Co-efficient Array  and place the constant section in RAM memory  */
#pragma DATA_SECTION(coeff, "coefffilt");
float coeff[64];


   firfilt    align(0x200)      > RAML5,         PAGE = 1 
   firldb       align(0x200)      > RAML4,         PAGE = 1
   coefffilt     align(0x200)     > RAML6,         PAGE = 1



On Matlab, it works grand, i.e. the frequency around 150Khz are passed, the others not.
On the F28335 they are all passed and are amplified : the input signal is between -1.0 and +1.0,
the output is between -1.7e+5 and +1.7e5.

Any idea of what I am doing wrong ????.


thanks a lot to anybody's idea, I am stucked !

greg.

  • Hi,

    I didn't find any obvious problems, so I can just to try some things.

    Did you try the controlSuite example code for the FIR functions?
    What's your impulse response? You can calculate it with first input=1, then always 0. You should get your coefficients in your result array.

    Best regards,
    Edwin Krasser

  • Hi,

     

    I was missing 3 coeff : when I do a paste and copy from MATLAB to Code Composer with the 64 coeff, 3 of them are removed !.

     

    When My first input is 1, I get all my coefficients except the coeff[0] . Do you see any reasons ???

     

    best regards,

    greg.

  • Hi,

    Do you miss the first or the last coefficient (both have the same value)? Because the order is just 63 you should have got just 63 coefficients. But your array has got 64. So, one is to much and will not be used in the FIR calculations.
    The delay line must have one element more (64), the coefficients are just 63.

    Best regards and good luck,
    Edwin Krasser

  • I had a similar-sounding problem with the example '2833x_FixedPoint_FIR32'.

    This may not be the answer for your problem, but I traced the error I encountered to a problem with the assembly code FIR32_init function. I haven't finished working through the details yet, but it appears to me that the

         'RPT AL|| MOV *XAR6++,#0'

    instruction is clearing one or two more 16-bit words more than necessary, depending on the odd/even nature of FIR_ORDER.

    In my case, the extra '0' was being written to the 'fir' struct data structure, overwriting the 'coeff_ptr' element. In your configuration, it may be overwriting the coeff[0]... depending on the RAM allocation by the linker.

    Check coeff[0] before and after running the 'firFP.init(&firFP)' to see if it is getting inadvertantly cleared.

    My temporary solution was to make the dbuffer array longer.

    Regards,

    Bob Oelschlaeger