Вы находитесь на странице: 1из 3

ECE 5655/4655 Laboratory Problems Assignment #4

Due April 29, 2016


Make Note of the Following:
• If possible write your lab report in Jupyter notebook
• If you choose to use the spectrum/network analyzer to obtain tiff graphics, just
import these graphics files into Jupyter notebook as well.
Problems: Real-Time FIR Digital Filters
1. Linear phase lowpass filter design from amplitude response specifications.
a.) Design a test filter using a 48 kHz sampling rate. The design is to be an equal
ripple lowpass that satisfies the amplitude response specifications shown
below:
passband ripple = 0.2 dB
0.1
– 0.1 fs
---
H  f  dB stopband loss = 50 dB 2

– 50

f Hz
0 3.0k 4.0k 24.0k

One design approach is to use MATLAB’s fdatool. I recommend you use


the approach outlined in the Chapter 6 Jupyter notbook that uses remez()
from scipy.signal along with remezord() from the supplied opt-
fir.py module found in the ZIP package alongside the Chapter 6 notebook
file. For example:
import optfir
d_pass = 0.2 # peak-to-peak ripple in dB
d_stop = 60.0 # stopband attenuation in dB
fs = 48000
f_pass = 3500
f_stop = 5000
# optfir.remezord gets you close
n, ff, aa, wts=optfir.remezord([f_pass,f_stop], [1,0],
[1-10**(-d_pass/20),10**(-d_stop/20)],
fsamp=fs)
# Bump up the order by 5 to bring down the actual d_pass & d_stop
n_bump = n + 5
# Final filter b array coefficients
b = signal.remez(n_bump, ff, aa[0::2], wts,Hz=2)
The details of this are explained in an Jupyter notebook posted as
5655_Chapter_6_IPYNB.zip. The zip file contains module optfir.py. Save the
coefficients from the design in a header fille as explained in the Jupyter notebook. Run the
filter in real-time on the FM4 board using the routine:
FIR_filt_float32(&FIR1,&x,&y,1).
b.) Now quantize the coefficients the coefficients in the Jupyter notebook and save out a
quantized coefficient header file, similar to

Run the filter on the FM4 using:


FIR_filt_int16(&FIR2,&left_in_sample,&left_out_sample,1,15);
Compare measured results with theory results similar what is shown below for a 78 tap
design. In particular provide magnitude and phase response plots before and after quanti-
zation. Your plots should use a digital frequency axis scaled to the actual sampling fre-
quency, e.g., from the Jupyter notebook.

ECE 5655/4655 Page 2 Assignment #4


c.) Finally compare the execution performance under -o3 optimization of the float_32 and
int_16 design, and compare the floating/fixed-point filter performance with one of the
CMSIS-DSP FIR filter functions fixed-point functions: (i) arm_fir_f32() which has
the identical interface to FIR_filt_f32() or (ii) arm_fir_fast_q15()/arm_-
fir_q15(). Note the interface to these functions is identical to the function FIR_-
filt_int16(). Measuring timing using GPIO signals is recommended.

To be clear, in the end you will have three timing results: (1) FIR_filt_f32(), (2)
FIR_filt_int16(), and (3) arm_fir_xxx().

Note: The update to allow you to try out the arm_fir_f32() over the equivalent fixed-
point functions is motivated by problems I have been having getting the ARM fixed-point
functions to work. These functions worked well last year and were very fast. I am having
problems with code stalling in the current release of the CMSIS library. You are welcome
to try to resolve this on your own, but time is ticking.

ECE 5655/4655 Page 3 Assignment #4

Вам также может понравиться