Low Cost/High Performance Audio Digital Signal Processing
Transcript of Low Cost/High Performance Audio Digital Signal Processing
Copyright © 2016 ARM Limited 4
A Sneak Peak of What’s Ahead
A tunable single biquad tunablenotch filter, using a GUI slidercontrol talking through the FM4virtual serial port
Use GPIO for code timing
Inputs Outputs
Power,Debug,UART
3.5mm to jumper adaptors
Low Cost/High Performance Audio Digital
Signal ProcessingMark Wickert, PhD. and Professor ([email protected])
College of Engineering and Applied Science, University of Colorado Colorado Springs, CO 80933-7150
Introduction• Using a lost-cost development kit explore audio signal processing using an
ARM(R) Cortex(R)-M4 microprocessor
• In this project we use the Cypress FM4 Pioneer Kit ($50) to develop audio signal processing applications, such as filtering, audio special effects, and spectrum analysis, to name a few
• A configurable PC GUI app allows for real-time control of DSP apps run-ning on the FM4
• Hands-on interactive demos allow you to hear and see signals being pro-cessed from audio sources such as a microphone(s) and music players
• Algorithms from simple to very complex can be implemented on the FM4 with its 200 MHz clock and floating point math capabilities
• We use Python’s scipy stack to design filters and analyze captured results from the Digilent Analog Discovery 2 portable instrumentation system
Buy On-Line From Cypress Semiconductor
• Consider the text: Donald S, Reay, Digital Signal Processing Using the ARM(R) Cortex(R)-M4, Wiley 2016, which has Web Site suport for the FM4
• Visit my Web Site: www.eas.uccs.edu/~wickert/ece4680/ and look for Lab 3 and the associated ZIP package plus other documents
◊ The code base for audio loop through and the GUI slider app is included
Copyright © 2016 ARM Limited 8
The Cypress® FM4 S6E2CC Pioneer Kit*
http://www.cypress.com/documentation/development-kitsboards/fm4-176l-s6e2cc-eth-arm-cortex-m4-mcu-starter-kit-ethernet-and
*
FM4 Board and Subsystems• The system out-of-the box is enhanced through the use of the virtual se-
rial port (com port), the GUI slider control, and the Analog Discovery for test and measurement
◊ CPU clock is 200 MHz, with single cycle floating point multiply & add
Copyright © 2016 ARM Limited 11
FM4 + LiB Docs & Software + Enhancements
Top level view of the board andstandard interfaces and tools used
Lab-in-a-Box (LiB):LiB_DSP_FM4_S6E2CCA_EN\DSP_LiB_Index.html
LiB codec library analog I/O systemblock diagramΣ∆
ADC
Cypress FM4 S6E2CC
L
R
Cortex-M4L
R
Σ∆DAC
I2S I2S
f ≤ 96skHz
RS232
IDEKeil MDK
GUI Para-meter Sliders
PC Host
...P0 P1 P5
R/W to M4 inreal-time
Tx RxUSB serial460800 bps
TerminalProgram
GPIO
USB for Timing Debug
Digilent AnalogTM
Discovery
Interface Wires
Capture &analyze in
Python
Code dev., debug, & prog. flash
Debug M4Code
In Out
ADC
ADC
I2S 2:1
Single Sample
ProcessingI2S 1:2
DAC
DAC
L
R R
L
...LRLRLR... ...LRLRLR...
ADC
ADC
I2S 2:1
I2S 1:2
DAC
DAC
L
RDMA
pingOUT
pongOUT
pingIN
pongIN
BUFSIZE BUFSIZE
L
R
(b) Frame-Based Processing
(a) Sample-Based ProcessingProcess one sample per IRQ
Process BUFSIZE (L + R) samples per DMA cycle
Systems Level M4 or M7 Hardware
ECE 5655/4655 Real-Time DSP 1–15
Systems Level M4 or M7 Hardware
• Many hardware/dev kit options available:
– Last year the STM32F407 (M4) (~168 MHz)
– NXP LPC4088 + Baseboard (M4) (~120 MHz)
– TI Tiva TM4C123G (M4) + Audio Booster Pak (~80MHz)
– Cypress FM4 (M4) (200 MHz)
– STM32F746 (M7) (~212 MHz)
– Others? Yes!
ARM CortexM4 or M7
Used for DSPADC DAC
Analog Input(two channel)
Analog Output(two channel)
Cypress FM4Pioneer Kit
Interfaces added in purple
Out of the box
Chapter 5 • Analog Input and Output
5–8 ECE 5655/4655 Real-Time DSP
Wolfson WM8731 Codec on Cypress FM4
• We now provide some details about the internals of theAudio codec found on the Cypress FM4 board, in particularthe ADC and DAC characteristics
• The FM4 specific circuit interfaces give some insight intoadditional filtering in the analog domain
Line InMic In
HeadphoneOut
C390.1uF
C4010uF/6.3V
C35 1uF/10V
C36
220pF
R64
5.6k
C34 1uF/10V
C37
220pF
R65
5.6k
R60 330RC33
1uF/10V
C38
220pF
R66
47k
R57 680R
R5547k
R5647k
C290.1uF
C3010uF/6.3V
I2SAGND
AVCCCodec
C220.1uF
C2310uF/6.3V
AVCCCodec
I2SAGND
C260.1uF
C2810uF/6.3V
C250.1uF
C2710uF/6.3V
VCCCodec
VCCCodec
I2SAGND I2SAGND
I2SAGND I2SAGND I2SAGND
R624.7k
R634.7k
3V3
Pin25
Pin42
Pin43
Pin24
bit clockI2SCK_0
I2SDO_0data out
I2SDI_0data input
I2SAGND
AVCCCodecVCCCodecL1
10uH/100mA
Pin36
Pin37
SOT2_1
SCK2_1
C4122pF
C4222pF
C31 220uF/10V
C32 220uF/10V
R54 33R
R67 100RPin41 I2SMCLK_0
I2SAGND
LIN_R
LIN_L
I2SAGND
Headphone Jack
Line-in Jack
frame clockI2SWS_0 R59
0RR58 33R
Default clock : derived from WM8731L
Address : 0x1ACodec
HP_L
HP_R
R92
5.6kR91
5.6k
R93 33R
R94 33R
132
4
Y312.288000MHz,50ppm
XTI/M
CLK
25
XTO
26
DCVDD27
DGND28
DBVDD1
DACDAT4
DACLRC5
ADCDAT6
BLCK3
MODE21
CSB22
SDIN23
SCLK24
MICBIAS 17
MICIN 18
LHPOUT 9
RHPOUT 10
RLINEIN 19
LLINEIN 20
LOUT 12
ROUT 13
AVDD 14
AGND 15
HPVDD 8
HPGND 11
VMID 16
CLKOUT2
ADCLRC7
U3
WM8731SEDS/VStereo CODEC, 28SSOP
13
2 CN6
PJ-31060-5
13
2
CN11
PJ-31060-5
13
2 CN5
PJ-31060-5
I2SAGND
MICIN
Microphone Jack
R109 NC[100R]
HighpassDC Block
DC Block
High frequency reject
Line In
HeadphoneOut
Mic In
on all inputs
Analog Interface Details and Codec Software• Line and Mic inputs are provided and a headphone output jack that dou-
bles as line out is also provided
• The Codec interface code found in the Reay text provides both sample-by-sam-ple and frame-based processing using di-rect memory access (DMA)
Programming the Board• ANSI C is used for programming with the MISRA + ARM data types (https://
en.wikipedia.org/wiki/MISRA_C)
• Shown below is a basic loop through program under GUI slider control
Copyright © 2016 ARM Limited 31
LAB_3_UART: DDS I/Q Sinusoids
ADC
cosf() sinf()DDS
LPF𝑓𝑓𝑓𝑓 𝑓 𝑓𝑓𝑓𝑓
LPF𝑓𝑓𝑓𝑓 𝑓 𝑓𝑓𝑓𝑓
𝑥𝑥𝑥𝑥[𝑛𝑛𝑛𝑛]𝑥𝑥𝑥𝑥𝐹𝐹𝐹𝐹𝐹𝐹𝐹𝐹(𝑡𝑡𝑡𝑡)
𝑓𝑓𝑓𝑓𝑠𝑠𝑠𝑠 = 48 kHz• Choose carrier
frequencyaround 10 – 15kHz
• Maybe use asecond FM4 asa custom signalsource with aPN code drivinga DDS toproduce binaryFSK
Complex Baseband
Discriminator
𝑧𝑧𝑧𝑧𝐼𝐼𝐼𝐼[𝑛𝑛𝑛𝑛] 𝑧𝑧𝑧𝑧𝑄𝑄𝑄𝑄 𝑛𝑛𝑛𝑛 𝑛 𝑧𝑧𝑧𝑧𝑄𝑄𝑄𝑄 𝑛𝑛𝑛𝑛 𝑛 1 𝑛 𝑧𝑧𝑧𝑧𝑄𝑄𝑄𝑄[𝑛𝑛𝑛𝑛] 𝑧𝑧𝑧𝑧𝐼𝐼𝐼𝐼 𝑛𝑛𝑛𝑛 𝑛 𝑧𝑧𝑧𝑧𝐼𝐼𝐼𝐼 𝑛𝑛𝑛𝑛 𝑛 1
𝑧𝑧𝑧𝑧𝐼𝐼𝐼𝐼2 𝑛𝑛𝑛𝑛 + 𝑧𝑧𝑧𝑧𝑄𝑄𝑄𝑄2[𝑛𝑛𝑛𝑛]
𝑥𝑥𝑥𝑥𝐼𝐼𝐼𝐼[𝑛𝑛𝑛𝑛]
𝑥𝑥𝑥𝑥𝑄𝑄𝑄𝑄[𝑛𝑛𝑛𝑛]
𝑧𝑧𝑧𝑧𝐼𝐼𝐼𝐼[𝑛𝑛𝑛𝑛]
𝑧𝑧𝑧𝑧𝑄𝑄𝑄𝑄[𝑛𝑛𝑛𝑛]𝑧𝑧𝑧𝑧𝑑𝑑𝑑𝑑[𝑛𝑛𝑛𝑛]
Set CarrierFrequency to
Translateto Baseband
DAC 𝑥𝑥𝑥𝑥𝑚𝑚𝑚𝑚(𝑡𝑡𝑡𝑡)
Eliminate denominatoris OK to simplifyMath and scaling
Results in a 25 tap filter, but you need two of them
𝑓𝑓𝑓𝑓𝑠𝑠𝑠𝑠 = 48 kHz
FM Receiver
Other Examples• Frequency modulation receiver (discriminator)
• Spectrum analyzer
• Others to see in the DEMOs
Copyright © 2016 ARM Limited 38
Real-Time Spectrum GUI Slider with PlotCopyright © 2016 ARM Limited 34
LAB_6_UART_FFT: Real-Time Spectrum
FM4 ADCLeft
FM4 ADCRight
InternalNoise
∑
X
𝑃𝑃𝑃𝑃𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑠𝑠𝑠𝑠[0]
X
𝑃𝑃𝑃𝑃𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑠𝑠𝑠𝑠[1]1024 PointFFT
X
𝑃𝑃𝑃𝑃𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑠𝑠𝑠𝑠[2]
X
𝑤𝑤𝑤𝑤hann[𝑛𝑛𝑛𝑛]
2
512
Left and rightanalog inputs
Spectrum Analyzer
GUI Display on PC
Spectrum Averaging
Collect subframes using a 128 point DMA buffer
𝑓𝑓𝑓𝑓𝑠𝑠𝑠𝑠 = 48 kHz
SpectrumAnalyzer
GUI Slider App with plot added