Pay careful attention to the sign of the feedback coefficients. Some design tools use the difference equation
y[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] - a1 * y[n-1] - a2 * y[n-2]
In this case the feedback coefficients a1 and a2 must be negated when used with the CMSIS DSP Library.
Scaling of coefficients: Filter coefficients are represented as fractional values and coefficients are restricted to lie in the range [-1 +1). The fixed-point functions have an additional scaling parameter postShift which allow the filter coefficients to exceed the range [+1 -1). At the output of the filter’s accumulator is a shift register which shifts the result by postShift bits.
The coefficients are stored in the array pCoeffs in the following order:
{b10, 0, b11, b12, a11, a12, b20, 0, b21, b22, a21, a22, …}
where b1x and a1x are the coefficients for the first stage, b2x and a2x are the coefficients for the second stage, and so on. The pCoeffs array contains a total of 6*numStages values.
Pay careful attention to the sign of the feedback coefficients. Some design tools use the difference equation
y[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] - a1 * y[n-1] - a2 * y[n-2]
In this case the feedback coefficients a1 and a2 must be negated when used with the CMSIS DSP Library.
Scaling of coefficients: Filter coefficients are represented as fractional values and coefficients are restricted to lie in the range [-1 +1). The fixed-point functions have an additional scaling parameter postShift which allow the filter coefficients to exceed the range [+1 -1). At the output of the filter’s accumulator is a shift register which shifts the result by postShift bits.
The coefficients are stored in the array pCoeffs in the following order:
{b10, 0, b11, b12, a11, a12, b20, 0, b21, b22, a21, a22, …}
where b1x and a1x are the coefficients for the first stage, b2x and a2x are the coefficients for the second stage, and so on. The pCoeffs array contains a total of 6*numStages values.