AnsweredAssumed Answered

overflow with arm_biquad_cascade_df2T_f32 function

Question asked by seb on Jun 25, 2013
Latest reply on Jun 27, 2013 by knik
Hi,

I try to implement a IIR filter with the "arm_biquad_cascade_df2T_f32" function from the CMIS dsp libraries and I encountered a problem: my output datas and my pstate table are overflowed after few iterations. I generated my coefficients with fdatool from matlab. They are stored in the followed order:
  {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...}

float32_t iir_coeff[30] = {
1,  -0.0249943904456238,    0.999999999999993,  -1.77729633861929,  0.845140679514385,
1,  -1.42288228590609,  0.999999999999998,  -1.72245970919624,  0.896574493119215,
1,  -1.99973299802181,  1,                  -1.91581723732986,  0.929183550605981,
1,  -1.5986745646875,   1,                  -1.72677706239042,  0.969582040573283,
1,  -1.99845599796938,  0.999999999999999,  -1.97568100711438,  0.981035519941801,
1,  -1.99766610993993,  1,                  -1.99201600960503,  0.995968747765197
};
I don't know how to incorporate the "Scale factors". I try to add it to my coeff table as follow but it dosn't work. 
float32_t iir_coeff[35] = {
0.001843832549177, 0,           0,                      0,                      0,
1,  -0.0249943904456238,    0.999999999999993,  -1.77729633861929,  0.845140679514385,
1,  -1.42288228590609,  0.999999999999998,  -1.72245970919624,  0.896574493119215,
1,  -1.99973299802181,  1,                  -1.91581723732986,  0.929183550605981,
1,  -1.5986745646875,   1,                  -1.72677706239042,  0.969582040573283,
1,  -1.99845599796938,  0.999999999999999,  -1.97568100711438,  0.981035519941801,
1,  -1.99766610993993,  1,                  -1.99201600960503,  0.995968747765197
};

Here a part of my code:

#define NUM_STAGE                  7 // if I don't incorporate the "Scale factors" NUM_STAGE = 6
 
static float32_t iirStateF32X[2*NUM_STAGE];
 
arm_biquad_cascade_df2T_instance_f32 SX;
 
int main(void)
{
     arm_biquad_cascade_df2T_init_f32(&SX, NUM_STAGE, (float32_t *)&iir_coeff[0], &iirStateF32X[0]);
...
 
// in the interruption:
float32_t  *inputF32X, *outputF32X
inputF32X = &temp_buffer[0];
outputF32X = &AccBufferX_filter[0];  
arm_biquad_cascade_df2T_f32(&SX, inputF32X, outputF32X, FILTER_BUFFER_SIZE);

This code works with the fir functions.

Does someone know where the problem is ?

Thanks.

Outcomes