cancel
Showing results for 
Search instead for 
Did you mean: 

Software digital low pass filter (40Hz)?

gmhuang
Associate II
Posted on September 14, 2009 at 02:57

Software digital low pass filter (40Hz)?

6 REPLIES 6
gmhuang
Associate II
Posted on May 17, 2011 at 13:23

I want to use a Software digital low pass filter(3db freq=40Hz) in my STM32F103CB. The filter will be fed the data of ADC output and the filter will output data that is 40Hz filtered.

Does anyone have the software low pass filter sample code that can be added to my project and can be run on STM32F103CB MCU?

Thanks a lot!

st3
Associate II
Posted on May 17, 2011 at 13:23

Have you tried the DSP library available on the STM32 downloads page:

http://www.st.com/mcu/familiesdocs-110.html

gmhuang
Associate II
Posted on May 17, 2011 at 13:23

Can you tell me which file or sample code is about the low pass filter design? Thanks a lot!

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

hi,

If you do a search on DSP on forum main page you find a lot of topics.

Take a look in one of my earlier posts:

http://www.st.com/mcu/forums-cat-8778-23.html

-G

paulsmitton9
Associate III
Posted on May 17, 2011 at 13:23

This is a handy site:

http://www.dsptutor.freeuk.com/index.htm

I used the FIR filter designer to come up with some coefficients for a low pass filter, and had a look at some of the java source to figure out how to apply them.

gmhuang
Associate II
Posted on May 17, 2011 at 13:23

Hi guyvo67, thank you!

Now I knoe how to generate the coefficients I need.

I download the source code of FIR Digital Filter Design Applet from

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

I need 360Hz sample rate.

Should I change the ''rate'' of FIRFilterDesign.java from 8000.0f to 360.0f?

And should I change the ''fN'', ''f1'' and ''f2'' of FIRFilter.java for 360Hz setting? How to change?

On the other hand, I want to use fir_16by16_stm32 function to filter my data from ADC output.

The data from ADC output is a data array that is ''unsigned short x[360]''.

I find that for fir_16by16_stm32 the length of input vector ahould be equal to M+N-1. (output vector of length N, coefficients vector of length M).

I want to input 360 16-bit data to fir_16by16_stm32 and get 360 16-bit filtered data from fir_16by16_stm32.

Can you tell me how to design for fir_16by16_stm32 to fit my need?

Thank you very much!