Skip to main content
satishgn77
Associate
February 23, 2010
Question

Trouble in using IIR Biquad filter from STM32 DSP library

  • February 23, 2010
  • 2 replies
  • 909 views
Posted on February 23, 2010 at 16:50

Trouble in using IIR Biquad filter from STM32 DSP library

    This topic has been closed for replies.

    2 replies

    satishgn77
    Associate
    May 17, 2011
    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_it
    Associate
    August 22, 2018

    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?