Matlab FIlter coefficients to CMSIS api I am trying to implement iir Band Pass filter design in STM32F429i discovery kit.
I konw that it needs coefficients to be generated from matlab and feed them into cmsis api to achivi filtered data.

My SOS Matrix look like shown below:

1,  0,  -1,  1, -1.9974,   0.99743,        
1,  0,  -1,  1, -1.9995,  0.99947,        
1,  0,  -1,  1,  -1.9937,  0.99371,        
1,  0,  -1,  1, -1.9982,  0.99817,       
1,  0,  -1,  1, -1.995,  0.99499,


above matrix i put into my coeff array removing column 4th which contains all 1's since its A0 in coeff.

static float32_t filter_coeffs[] = {
1,  0,  -1,  -1.9974,   0.99743,        
1,  0,  -1,  -1.9995,  0.99947,        
1,  0,  -1,  -1.9937,  0.99371,        
1,  0,  -1,  -1.9982,  0.99817,       
1,  0,  -1,  -1.995,  0.99499,
};


here is the code snippet am using :

#define NUMSTAGES 5
static float32_t firStateF32[2*NUMSTAGES];
arm_biquad_cascade_df1_init_f32(&amp;S, NUMSTAGES, filter_coeffs, firStateF32);


when I am using matlab my signal are filtered perfect, but in microcontroller output is initially oscillating and than "1.#QNAN"
am i missing any step??
please correct me.

Regards,
Lokesh Bhatt
I know this is an old question, but maybe this is useful to someone.
In CMSIS documentation, in Biquad Cascade IIR Filters Using Direct Form I Structure, says that the used equation is:

$$y[n] = b_0 x[n] + b_1 x[n-1] + b_2  x[n-2] - a_1 y[n-1] - a_2 y[n-2]$$

You need to look closely to coefficients $a_1$ and $a_2$. You need to change the sign.

So in your case, if matlab gave you this result (SOS Matrix)

1,  0,  -1,  1, -1.9974,   0.99743,        
1,  0,  -1,  1, -1.9995,  0.99947,        
1,  0,  -1,  1,  -1.9937,  0.99371,        
1,  0,  -1,  1, -1.9982,  0.99817,       
1,  0,  -1,  1, -1.995,  0.99499,


then you should change it to:

static float32_t filter_coeffs[] = {

1,  0,  -1,  1.9974, -0.99743,        
1,  0,  -1,  1.9995, -0.99947,        
1,  0,  -1,  1.9937, -0.99371,        
1,  0,  -1,  1.9982, -0.99817,       
1,  0,  -1,  1.995,  -0.99499,
};