cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Filter working real-time with arm_fir_f32 function

felipe
Associate II
Posted on September 25, 2013 at 13:53

Hi,

I am using the DSP Library to make a Fir Filter with STM32F407 and uvision4. The example work fine and the data is right comparing with matlab. Now I am trying to make it work in a real time application. So I use a circular buffer as input for the function and a DC sinal as data. The sequency is: Obtain a sample, move it to circular buffer and execute thearm_fir_f32 function. I wanna know if this steps are right for a real time filter and I dont understand what is my output because the ''outputF32'' is a buffer with 32 numbers half of it is almost zero.

void Circular_Buffer(float p, float buffer[BUFFER_SIZE+1]){
int x = BUFFER_SIZE;
while(x>0){
buffer[x] = buffer[x-1];
x--;
}
buffer[0] = p;
}
==================================================================================
====================================FIR FILTER=======================================
==================================================================================
Circular_Buffer(Analog_Input,Filtro_FIR);
inputF32 = &Filtro_FIR[0]; 
outputF32 = &testOutput[0];
arm_fir_init_f32(&S, NUM_TAPS, (float32_t *)&firCoeffs32[0], &firStateF32[0], blockSize); 
arm_fir_f32(&S, inputF32, outputF32, blockSize);

Here is my output data and my input buffer: 0690X00000603GkQAI.jpg
2 REPLIES 2
felipe
Associate II
Posted on September 25, 2013 at 19:22

Now i realized that  variable ''

blockSize

'' is the size of  the output.

When I put it in value 1 the answer is always arround -0.0028 

:(
felipe
Associate II
Posted on September 26, 2013 at 14:37

I put the output buffer from position 16 to 32 into a DAC and the filter is working fine.

:D

I just dont understand why the first parameters appear almost zero.