Nexys4™ PDM Filter Project: Revised February 3, 2014 This Manual Applies To The Nexys4 Rev. B
Nexys4™ PDM Filter Project: Revised February 3, 2014 This Manual Applies To The Nexys4 Rev. B
Pullman, WA 99163
509.334.6306
www.digilentinc.com
Introduction
This document aims to briefly explain the pulse-density modulation (PDM) [Ref. 2] interfacing design used to
acquire data from the Nexys4’s on-board ADMP421 MEMS microphone [Ref. 1]. This design is a hardware Xilinx
Artix-7 FPGA implementation of the cascaded integrator-comb (CIC) decimation filter [Ref. 9] and finite impulse
response (FIR) filter [Ref. 20], outputting the 16-bit filtered data at a 96 kHz rate.
This project was compiled with Xilinx ISE 14.6 and written in VHDL.
MEMS fs = fs = fs = fs =
Mic. 3.072 MHz 192 kHz 96 kHz 96 kHz
CLK
DATA CIC 22 HB 22 16 16
LP HP
↓16 ↓2
L/R
The clock source to drive the PDM is generated by a mixed-mode clock manager proceeded by a regional primitive
buffer that further divides the 6.144 MHz clock, making it a 3.072 MHz clock. The L/R select input of the
microphone is tied to the ground, choosing the data to be sampled at the rising edge of Clk.
The CIC stage samples the input data at 3.072 MHz, with a resulting decimation rate of 16. The output sampling
rate is 192 kHz.
1
15-bit wide coefficients were chosen to spread across the full 80 dBs of magnitude band.
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners. Page 2 of 12
Nexys4™ PDM Filter Project
specifications in Xilinx’s “LogiCORE IP FIR Compiler v6.3” [Ref. 21]. The filter settings for MATLAB are displayed in
Table 2, along with a visual representation of the filter’s magnitude response (Figure 2):
-20 Fpass =
21.8 kHz
Magnitude (dB)
Astop =
-40
80 dB
-60
-80
0 10 20 30 40 50 60 70 80 90
Frequency (kHz)
Having the coefficients calculated, the following settings were put in place for the FIR Compiler (Table 3):
Parameter Value
FIR Order 161
Fs (Sampling frequency) 96 kHz
Fpass (end of pass-band) 13 kHz
Fstop (beginning of stop-band) 15 kHz
Wpass (weight in pass-band) 1 dB
Wstop (weight in stop-band) 100 dB
2
Coefficient width 20
Table 4. Low-pass filter settings.
-10
Wpass = Fstop =
-20 1 dB 15 kHz
-30
Magnitude (dB)
-40 Wstop =
Fpass = 100 dB
-50 13 kHz
-60
-70
-80
-90
-100
0 5 10 15 20 25 30 35 40 45
Frequency (kHz)
In order to properly configure the FIR Compiler, a description of its settings are shown in Table 5:
2
20-bit wide coefficients were chosen to spread across the full 100 dBs of magnitude band.
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners. Page 4 of 12
Nexys4™ PDM Filter Project
After sign extending the input data (16-bit to 17-bit), it is subtracted from the most significant result (17-bit) of the
-12 -
1-tap integrator (the integral part of the integration [Ref. 24]). Using a multiplier value of 2 and one delay cell (z
1
) results in a cut-off frequency of 18.6 Hz with a 10 dB/decade slope.
[28:12]
17 29
- +
x[n] 16 17 17 29
z-1
+ +
sign 2-12
extend 16 y[n]
50
Magnitude [dB]
-50
-100
-150
1 2 3 4 5
10 10 10 10 10
Frequency [Hz]
2000
0
Angle [deg]
-2000
-4000
-6000
1 2 3 4 5
10 10 10 10 10
Frequency [Hz]
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 100 200 300 400 500
Samples
Figure 6. Impulse response of the PDM filter.
3
In order to convert the acquired frequency response data to discrete-time filter numerator and denominator z
polynomials (its transfer function), a Gauss-Newton iterative search of linear equations was used (function invfreqz in
MATLAB) with an approximation error on the result as follows: magnitude response – 1%, phase response – 1.7%.
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners. Page 6 of 12
Nexys4™ PDM Filter Project
The output of the PDM filter is fed into four parallel comb filters, each with a different loop time to enhance the
acoustic resonance. After this, the samples are fed into two consecutive all-pass filters to further enlarge the
spectrum.
In all structures (comb and all-pass), the g multiplier constant and N number of delay stages are computed
automatically in the VHDL module by using the following equations [Ref. 27]:
ିଷఛ
τ = loop time
݃ = 10 ்లబ
T60 = reverb time
ܰ = ݂߬௦ fs = sampling frequency
References
[1] Analog Devices: “Omnidirectional Microphone with Bottom Port and Digital Output”, ADMP421 Data Sheet,
rev. D.
[4] J. D. Reiss: “Understanding Sigma-Delta Modulation: The Solved and Unsolved Issues”, J. Audio Eng. Soc., Vol.
56, No. 1/2, January/February 2008.
[6] N. Hegde: “Seamlessly Interfacing MEMS Microphones with Blackfin Processors”, EE-350 Engineer-to-
Engineer Note, rev. 1, August 2010.
[7] Altera, Inc.: “Understanding CIC Compensation Filters”, Application Note 455, ver. 1.0, April 2007.
[9] M. P. Donadio: “CIC Filter Introduction”, Free Publication by Iowegian, July 2000.
[10] S. Pandu: “Design and VLSI Implementation of a Decimation filter for Hearing Aid Applications”, Master of
Technology thesis, 2007.
[11] Xilinx, Inc.: “LogiCORE CIC Compiler v3.0”, DS845 Product Specification, ver. 1.0, June 2011.
[12] Xilinx, Inc.: “Cascaded Integrator-Comb (CIC) Filter v3.0”, Product Specification, March 2002.
[13] Xilinx, Inc.: “LogiCORE CIC Compiler v4.0”, PG140 Product Guide for Vivado Design Suite, ver. 1.0, March
2013.
[14] G. J. Dolecek, J. D. Carmona: “On Design of CIC Decimators”, Applications of MATLAB in Science and
Engineering, ISBN: 978-953-307-708-6, pp. 225-246, 2011.
[15] A. C. Cherik, E. Farshidi: “A new Configurable Decimation Filter using Pascal’s Triangle Theorem”, World
Academy of Science, Engineering and Technology 54, pp. 75-78, 2011.
[16] H. G. Göckler: “Most Efficient Digital Filter Structures: The Potential of Halfband Filters in Digital Signal
Processing”, Applications of Digital Signal Processing, ISBN: 978-953-307-406-1, pp. 237-278, 2011.
[17] T. Saramaki, T. Karema, T. Ritoniemi, H. Tenhunen: “Multiplier-free Decimator Algorithms for Superresolution
Oversampled Converters”, in Proc. 1990 IEEE International Symposium on Circuits and Systems (New
Orleans, Louisiana), pp. 3275-3278, May 1990.
[18] P. Zahradnik, B. Simak, M. Kopp, M. Vlcek: “Design of Half-Band FIR Filters for Signal Compression”,
International Journal on Advances in Telecommunications, vol. 4, no. 3 & 4, 2011.
[19] P. P. Vaidyanathan, T. Q. Nguyen: “A «TRICK» for the Design of FIR Half-Band Filters”, IEEE Transactions on
Circuits and Systems, vol. CAS-32, no. 3, March 1987.
[20] R. Thakur, K. Khare: “High Speed FPGA Implementation of FIR Filter for DSP Applications”, International
Journal of Modeling and Optimization, Vol. 3, No. 1, February 2013.
[21] Xilinx, Inc.: “LogiCORE IP FIR Compiler v6.3”, DS795 Product Specification, ver. 1.3, October 2011.
[22] Xilinx, Inc.: “LogiCORE IP FIR Compiler v7.0”, PG149 Product Guide for Vivado Design Suite, ver. 1.0, March
2013.
[23] R. Yates, R. Lyons: “DC Blocker Algorithms”, IEEE Signal Processing Magazine, pp. 132-134, March 2008.
[24] K. Chapman: “Digitally Removing a DC Offset: DSP Without Mathematics”, WP279 Xilinx White Paper, ver.
1.0, July 2008.
[28] J. Sun: “Schroeder’s Reverberator: The Earliest Digital Solution of Sound Reverberation”, EECS 195 Final
Project, March 2005.
radix = 10;
radix = 16;
coefficient_width = 20;
coefdata = 00041, 00111, 002c8, 0056d, 0086d, 00a86, 00a33, 0067c, fffc5,
ff81b, ff282, ff179, ff573, ffc43, 0020f, 00380, fffdd, ff9ae,
ff54a, ff600, ffbb8, 002c4, 0063b, 0036e, ffc13, ff567, ff49a,
ffaeb, 00457, 00a1b, 0078f, ffde6, ff3dd, ff12c, ff8b1, 005c2,
00ef5, 00ce1, 00003, ff133, febb2, ff4be, 006e7, 01520, 0140d,
002f3, fed69, fe3ad, fee8d, 007ce, 01d64, 01e2d, 0074f, fe801,
fd7b5, fe4d3, 00880, 02984, 02dc2, 00e6b, fdfa3, fc42b, fd42d,
00902, 03e33, 049ba, 01bf8, fcff2, f9d13, fb0cb, 00958, 06e10,
08fee, 0416c, fa175, f18e6, f24d3, 00982, 19cd6, 34c97, 46294,
46294, 34c97, 19cd6, 00982, f24d3, f18e6, fa175, 0416c, 08fee,
06e10, 00958, fb0cb, f9d13, fcff2, 01bf8, 049ba, 03e33, 00902,
fd42d, fc42b, fdfa3, 00e6b, 02dc2, 02984, 00880, fe4d3, fd7b5,
fe801, 0074f, 01e2d, 01d64, 007ce, fee8d, fe3ad, fed69, 002f3,
0140d, 01520, 006e7, ff4be, febb2, ff133, 00003, 00ce1, 00ef5,
005c2, ff8b1, ff12c, ff3dd, ffde6, 0078f, 00a1b, 00457, ffaeb,
ff49a, ff567, ffc13, 0036e, 0063b, 002c4, ffbb8, ff600, ff54a,
ff9ae, fffdd, 00380, 0020f, ffc43, ff573, ff179, ff282, ff81b,
fffc5, 0067c, 00a33, 00a86, 0086d, 0056d, 002c8, 00111, 00041;