0
votes

We were given a task to implement a filter(digital high pass IIR filter) to reduce frequencies below 500 Hz and allow higher frequencies. Using the sptool, and the ellip funciton we constructed the following

% Sampling Rate (Hz)
Fs = 46875; 

% High-pass filter
N = 4; % Filter Order
Wn = 500/(46875/2);  % Cutoff Frequency in terms of Passband / Nyquist frequency ratio
Rp = 0.5; % Passband ripple specification
Rs = 20; % Stopband attenuation

[Num,Den] = ellip(N,Rp,Rs,Wn,'high');

secondOrderSection = tf2sos(Num,Den)./2

We then calculated the scalefactors using L1 norm: We need to implement this on a 16 bit atmel microcontroller, (AC3U3 Xplained) and must therefore calculate the scalefactors in Q_0.15 form

% FIRST SECTION
firstScaleFactor = 1/(sum(abs(impz(1,secondOrderSection(1,4:6)))))
sf1_2_Q = round(firstScaleFactor*(2^15))

% SECOND SECTION
secondScaleFactor = 1/(sum(abs(impz(1,secondOrderSection(2,4:6)))))
sf2_2_Q = round(secondScaleFactor*(2^15))

The Problem: Our scalefactors seems to be a bit low, First scale factor is 77, second is 14. Is there any errors in our calculations?

1

1 Answers

1
votes

This application note by Texas Instruments contains an overview of techniques for overflow avoidance in fixed-point filter implementation.