cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble in using IIR Biquad filter from STM32 DSP library

satishgn77
Associate
Posted on February 23, 2010 at 16:50

Trouble in using IIR Biquad filter from STM32 DSP library

2 REPLIES 2
satishgn77
Associate
Posted on May 17, 2011 at 13:41

Did anyone tried the IIR API(Both ARMA & Biquad) from STM32 DSP library using Fixed point calculation?

Can someone post an example code using the above apis.

I am looking for an answer for my last post.

sb
Associate

I logged in to ask the same question. Having trouble using arm_biquad_cascade_df2T_f32.

The main issue is that the filter output goes to inf very quickly. The value of the input is very small (between 1E-3 and 10E-3). Here are the steps I took to use the filter.

  • Designed a 4th order bandpass using fdesign.bandstop. Specified the right sampling frequency and Q = 5. Specified filter structure as df2tsos so the coefficients are meant for direct form 2 transposed.
  • Extracted the SOSMatrix of the filter object and rearranged the coefficients to match the CMSIS coefficients [b0, b1, b2, a1, a2....]
  • Multiplied the forward coefficients of the very first stage with all elements of the scalevalues matrix i.e. b0 b1 b2 of the first stage are multiplied by scale(0) *scale(1) *scale(2).
  • Verified that the cascaded response matches 4th order response in fvtool.
  • Setup coefficient array, state array etc and instantiated arm_biquad_cascade_df2T_f32 in the C code startup routine. Added CMSIS library source code in the IDE project so the filter.c files are available. Added arm_math.h header also.
  • Called the filter function arm_biquad_cascade_df2T_f32 in the high frequency interrupt and passed it the right structure and input, output, block size.
  • End result is the output goes to infinity.

What am I missing?