AnsweredAssumed Answered

FIR Low Pass Filter, first few values of array incorrect

Question asked by schneider.will on Aug 15, 2013
Latest reply on Aug 20, 2013 by knik
Hi all,

I've been trying to implement a low pass filter, following closely the example found here -
http://www.keil.com/pack/doc/arm/cmsis/cmsis/documentation/dsp/html/arm_fir_example_f32_8c-example.html#a15

Frustratingly its almost working perfectly, except that the first 12 values of my output array are incorrect, they are all near zero. The rest of the values are fine. I'm using an array of size 1024, seperated into blocks of 32, therefore 32 passes are required.

Here is most of my code -
//SET UP VALUES FOR LOW PASS FILTER - TEMP - MOVE SOMEWHERE BETTER
static uint32_t blockSize = BLOCK_SIZE;
//static float32_t firStateF32[(blockSize + 29 - 1)];
static float32_t firStateF32[(BLOCK_SIZE +29 -1)];
 
void LPFilter(void)
{
    arm_fir_instance_f32 V;
    //1024/32 = 32. So 32 blocks of 32 to be processed in the filter...
    uint32_t numBlocks = (BUFFERSIZE/2)/blockSize;
    uint32_t i = 0;
     float32_t *input, *output;
    /* Initialize input and output buffer pointers */
    input = &InDisplay2[0];
    output = &OutDisplay2[0];
    /* Call FIR init function to initialize the instance structure. */
    arm_fir_init_f32(&V, 29, (float32_t *)&firCoeffs32[0], &firStateF32[0], blockSize);
    /* ----------------------------------------------------------------------
    ** Call the FIR process function for every blockSize samples
    ** ------------------------------------------------------------------- */
    for(i=0; i < numBlocks; i++)
    {
    arm_fir_f32(&V, (input + (i * blockSize)), (output + (i * blockSize)), blockSize);
    }
}

Is this a known issue? After a bit of searching I couldnt find any others with the same problem. But my code seems to be following the example perfectly!

Outcomes