cancel
Showing results for 
Search instead for 
Did you mean: 

Filter Coefficient calculation tool for ST's DSP library

satishgn
Associate II
Posted on August 27, 2009 at 13:32

Filter Coefficient calculation tool for ST's DSP library

6 REPLIES 6
satishgn
Associate II
Posted on May 17, 2011 at 13:20

Can anyone help in letting me know about any free tools on internet that can be used for calculating FIR/IIR filter coefficients for usage with the APIs provided in the ST's DSP library. I have searched on ST's website but didn't found any tools for doing this. I know Microchip provide a tool for their DSP libraries. I don't have MATLAB.

guyvo67
Associate II
Posted on May 17, 2011 at 13:20

hi,

I used following applet which works pretty good:

http://www.dsptutor.freeuk.com/FIRFilterDesign/FIRFilterDesign.html

You can also grap the java code and modify the simulated sample frequency that suit your needs. I did it because my sample rate is 40kHz instead of the 8k in the applet. If you have a higher sampling rate you need to do this as this will have an influence on your coefficients too.

I injected the calculated coefficients into the fir_16by16_stm32 function of the DSP library and it works pretty good. My application on this is filtering the CAB signal (1380Hz out of the main 50hz) to obtain a stable zero crossing detection. I used 32 tapes to get it done. Calculation time is 7.9 µs which is a nice value considering that the cortex is not a DSP 😉

[ This message was edited by: guyvo67 on 22-08-2009 10:32 ]

jaroslaw2
Associate II
Posted on May 17, 2011 at 13:20

Check scilab. It is free and is similar to Matlab.

http://www.scilab.org/

asterix
Associate II
Posted on May 17, 2011 at 13:20

Hi guyvo67,

How did you converted the coefficients from float format to short format so you use fir_16by16_stm32 function ?

merci, Asterix

[ This message was edited by: asterix.magigimix on 22-08-2009 23:59 ]

[ This message was edited by: asterix.magigimix on 23-08-2009 00:38 ]

guyvo67
Associate II
Posted on May 17, 2011 at 13:20

You have to convert the calculated coefficients into fixed point (Q15) notation. [-1 , 1 − 2 exp(15)] -> [-32768,32767] Don't forget to shift your output(32 bit) with 15 to the right.

You find quit a lot articles on the fixed point arithmetic if you google around like the wiki :

http://en.wikipedia.org/wiki/Fixed-point_arithmetic

-G

satishgn
Associate II
Posted on May 17, 2011 at 13:20

Thanks guys for the valuable info! Appreciate your quick response.