Hello, All:

I am designing a butterworth filter for Blackfin DSP bf532. I got coefficients using Matlab filter design tool----FDATool,

SOS =

1.0000 -2.0000 1.0000 1.0000 -1.9579 0.9618

1.0000 -2.0000 1.0000 1.0000 -1.8991 0.9029

1.0000 -1.0000 0 1.0000 -0.9388 0

G =

0.9799

0.9505

0.9694

1.0000

After [b,a]=sos2tf(SOS,prod(G)), I got B-Coefficient (b) and C-Coefficient(c) ,

b = 0.9029 -4.5145 9.0290 -9.0290 4.5145 -0.9029

a = 1.0000 -4.7958 9.2038 -8.8355 4.2427 -0.8152

The problem is that how can I get coeff[] with DSP runtime library function

void coeff_iirdf1_fr16 (const float acoeff[ ],

const float bcoeff[ ],

fract16 coeff[ ], int nstages);

the size of the acoeffs vector is 2*nstages and the size of the bcoeffs vector is (2*nstages) + 1. Why there is one more element of bcoeffs than that of acoeffs?

Is there anyone has the same question or who can help me? Thanks a lot!

Hi,

The way you modified the filter coefficients by setting the last element to zero is correct.

There are two issues with the program you have attached.

1) The values stored in a_coeffs should be the same values as computed by Matlab, there is no need to negate them (this is done by the conversion routine coeff_iirdf1_fr16 automatically).

2) For the given filter, fract16 does not offer sufficient resolution to compute the filtered response. More bits are required to stop the filter from oscillating (due to the feedback nature of the algorithm, a small initial error can qickly increase over time). If you modify your program to use fract32 DSP library functions and long double filter coefficients instead, it should work as expected (you will require VisualDSP++5.0 Update 9 or later for this feature).

Best Regards,

Andreas