I am trying to implement an a-weighted filter using the CMSIS iir lattice filter functions, the coefficients have been generated using MATLAB / Octave with the below
%Analog A-weighting filter according to IEC/CD 1672.f1 = 20.598997; f2 = 107.65265;f3 = 737.86223;f4 = 12194.217;A1000 = 1.9997;
pi = 3.14159265358979;NUM = [ (2*pi*f4)^2*(10^(A1000/20)) 0 0 0 0 ];DEN = conv([1 +4*pi*f4 (2*pi*f4)^2],[1 +4*pi*f1 (2*pi*f1)^2]); DEN = conv(conv(DEN,[1 2*pi*f3]),[1 2*pi*f2]);
%Bilinear transformation of analog design to get the digital filter. [B , A] = bilinear(NUM,DEN,1/Fs);
with the following coefficients generated,
A = 1 -4.157546313340181, 6.728268713421276, -5.25389952501363, 1.968859847947658, -0.3013592462632808, 0.01567652923853208
B = 0.2243092949609865 -0.448618589921973, -0.2243092949609865, 0.897237179843946, -0.2243092949609865, -0.448618589921973, 0.2243092949609865
The filter structure has been initialised with the coefficients in reverse time order as required, order is 6.
Filter becomes unstable when 1kHz sine wave data is applied normalised to 1.0.
The project is being implemented on a Cortex M4 with hardware floating point and using GCC compiler.
Does anyone have any suggestions or examples of using the iir lattice filter functions.