Logo
DSPLib GUI Users Guide  v1.00.00.03
Design

Filter Design Overview

Filter design in DSPLib GUI is implemented using the Filter Structure and Design Specifications panels on the left-hand side side of the GUI. There are four primary components of the filter structure design:

  • The Q-Type, specifying the amount of precision that the exported coefficients will retain; the available options consist of Q15 or Q31.
  • The structure, which sets the available options as those of a finite impulse response (FIR) or infinite impulse response(IIR) filter type.
  • The filter type, which sets the target bandwidth structure for FIR filter coefficients or specificies a biquad design for IIR filter types.
  • The method, which allows the selection of several different windowing patterns for FIR filters or selection of Direct Form 1 (DF1) or Direct Form 2 (DF2) filters when IIR is selected.
  • The name of the filter, which will set the generated code variable names as well as the file name of generated .c and .h files if saved.

The bottom design panel has options specific to the type of filter. For FIR functions, four types of filter are supported: bandpass, lowpass, highpass, and stopband. For each of these four types, five different windowing methods exist, each with their own windowing properties attached to a sinc function. For IIR filters, the GUI supports code generation given existing parameters for both Biquad DF1 and Biquad DF2 filter types.

FIR functions Lowpass and highpass FIR filters require only two design parameters: order and the normalized cutoff frequency Wc. The normalized frequency can target (0, 1) uninclusive, where 0 is 0 Hz and 1 is the Nyquist frequency. Bandpass and highpass functions have an additional Wc2 parameter, where 0 < Wc < Wc2 < 1. The filter will then generate Order + 1 coefficients, plus a zero padding coefficient at the end to create an even number of coefficients, Order + 2, for compatibility with LEA alignment on the MSP430 peripheral. It's important to note that the order of the filter must be between 8 and 500, inclusive.

The filter coefficients are generated in two parts: one, by creating a windowed sinc function with the target profile specified by the filter type. Next, the windowed sinc function's weights are elementwise multiplied by the windowing function specified by the method type. The windowed sinc functions exist in the following capacity:


$M = $ Filter Order
$N = $ Current impulse
$f_{t} = W_{c}/2$
$f_{t2} = W_{c2}/2$ if bandpass or stopband

$Window_{LP}[n] = sin(2*pi*f_{t}(n-M/2))/(pi*(n-M/2)), n!= M/2$
$Window_{LP}[n] = 2*f_{t}, n=M/2$

$Window_{HP}[n] = -sin(2*pi*f_{t}(n-M/2))/(pi*(n-M/2)), n!= M/2$
$Window_{HP}[n] = 1-2*f_{t}, n= M/2$

$Window_{BP}[n] = sin(2*pi*f_{t2}(n-M/2))/(pi*(n-M/2)) $
$- sin(2*pi*f_{t1}(n-M/2))/(pi*(n-M/2)), n!= M/2$
$Window_{BP}[n] = 1-2*(f_{t} - f_{t2}), n= M/2$

$Window_{SB}[n] = sin(2*pi*f_{t1}(n-M/2))/(pi*(n-M/2)) $
$- sin(2*pi*f_{t2}(n-M/2))/(pi*(n-M/2)), n!= M/2$
$Window_{SB}[n] = 1-2*(f_{t2} - f_{t1}), n= M/2$

Next, the type of windowing response is chosen by the users, and vary according to the following equations.

$Rectangular[n] = 1$
$Bartlett[n] = 1 - 2|n-M/2|/M$
$Hanning[n] = .5 - .5cos(2*pi*n/M)$
$Hamming[n] = .54 - .46cos(2*pi*n/M)$
$Blackman[n] = .42 - .5cos(2*pi*n/M) + .08cos(4*pi*n/M)$

The final coefficient generation is accomplished by elementwise multiplying the windowing response by the sinc function.

For IIR filters, the single biquad limitation only allows for user input, and the design tool is in place to allow easy generation of parameter structure and initialization; the GUI design tool will replicate the input coefficients into DSPLib code.