1 Introduction
The Least Mean Squares (LMS) Algorithm can be used in a range of Digital Signal
Processing applications such as echo cancellation and acoustic noise reduction.
This laboratory shows how to design a model of LMS Noise Cancellation using
Simulink and run it on a Texas Instruments C6000 DSP.
1.1 Objectives
Design a model of LMS Noise Reduction for the Texas Instruments C6000
family of DSP devices using MATLAB and Simulink.
1.2 Level
Intermediate - Assumes prior knowledge of MATLAB and Simulink. It also requires
a theoretical understanding of matrices and the LMS algorithm.
MATLAB R2006b with Embedded Target for TI C6000 and the Signal
Processing Toolbox.
Code Composer Studio (CCS) v3.1
Texas Instruments DSK6713 hardware.
Microphone and computer loudspeakers / headphones.
2 Simulation
You will now start with a simple Simulink model and run it to see how it works.
Figure 5 Input and LMS Filter Outputs for Step size (mu) = 0.1
2.9 Summary
From practical experience, you should now know how to use LMS algorithm and
how you can adjust the Step size (mu), the filter delay and the number of weights
to obtain optimum performance.
You will now apply this to building a real-time model.
3 Real-Time Model
You have now run the simulation and understand the operation of the LMS Filter.
You will now implement the Real-Time Acoustic Noise Cancellation Model using
the Texas Instrument C6713.
Start Code Composer Studio for DSK6713 and use Debug -> Connect
3.2.2
3.2.3
3.2.4
For convenience, save the model to the MATLAB Work directory, where most
models are stored.
3.2.5
Delete the Info box. Change the title to LMS Noise Reduction. You may also
wish to move the DSK6713 icon to the left hand side.
3.2.6
The Original Wavelet Noise Reduction
Algorithm
Double-click on the function() box. The Wavelet Noise Reduction Algorithm
model is now displayed.
3.2.7
Delete Blocks
Delete the blocks and connect the input directly to the output. Add a title.
3.2.8
3.2.9
Double-click on the blue box to the left marked DSK6713 ADC. The following
screen will appear.
3.2.10
The DAC settings need to match those of the ADC. Check that it uses the same
sampling rates. Click on OK.
3.2.11
The Simulink block for LMS is to be found in the Signal Processing Toolbox.
Select View -> Library Browser -> Signal Processing Blockset ->Filtering->
Adaptive Filters.
Highlight Adaptive Filters. Drag-and-drop the LMS Filter block onto the model.
3.2.12
The most critical variable in an LMS filter is the Step size (mu).
If mu is too small, the filter has very fine resolution, but reacts too slowly to the
audio signal.
If mu is too great, the filter reacts very quickly, but the error also remains large.
We will start with 0.005.
3.2.13
Adding a Delay
From the Signal Processing Blockset, highlight Signal Operations. Drag-anddrop the Delay1 block onto the model.
Since we are working with frames, the delay from Discrete Components library
will not work!
3.2.14
3.2.15
So we can hear the difference without LMS denoising and with LMS noise
reduction, we will use a DIP switch of the DSK6713.
3.2.16
3.2.17
Adding a Constant, Switch and Relational
Operator
We now need to setup a way to switch between straight through without noise
reduction and with LMS noise reduction.
Select View -> Library Browser -> Simulink. Highlight Commonly Used Blocks.
Drag-and-drop a Constant onto the model.
Drag-and-drop a Switch block onto the model.
Drag-and-drop a Relational Operator block onto the model.
3.2.18
The switch values lie between 0 and 15. We will use switch values 0 and 1.
Double-click on the Constant block. Set the Constant value to 1 and the
Sample time to inf.
3.2.19
Click on the Signal Data Types tab. Set the Output data type mode to int16.
This is compatible with the DAC on the DSK6713.
3.2.20
Double click on the Relational Operator block. Change the Relational operator
to ==. Click on the Signal Data Types tab.
3.2.21
3.2.22
Move the blocks and join them as shown in the Figure below.
3.2.23
From the Toolbar, select the Up Arrow icon. This returns you to the next higher
level.
3.3.2
When built, the single lines are replaced by double lines. This shows frames.
Figure 35 Frames
3.3.3
The Completed Model Running on Code
Composer Studio
From the folders on the left, select the source code for the project.
To check out the microphone and loudspeakers, set the DIP switches on the
DSK6713 as follows:
3.4.2
To run the LMS Noise Reduction subsystem, set the DIP switch to 1.
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.