Basic experiments with the TMS320C31 Digital Signal Processor

advertisement
1
LABORATORY 5:
Testing and Evaluation of the TMSC320C31 DSP Starter
Kit
EEE 182: DIGITAL SIGNAL PROCESSING LABORATORY
Department of Electrical & Electronic Engineering
College of Engineering & Computer Science
California State University, Sacramento
SPRING 2013
2
EEE 182
LABORATORY 5
Introduction
Digital signal processors, such as the TMS320C31, are just like fast microprocessors with
a specialized instruction set and architecture appropriate for signal processing. These
processors are used in a wide range of applications from communications and controls to
speech and image processing.
The DSK (DSP Starter Kit) consists of an analog-to-digital converter (ADC) to
capture the input signal. The resulting digital representation of the captured signal is then
processed by a digital signal processor such as the TMS320C31 and then output through a
digital-to-analog converter (DAC). Also included within the basic system is a special
input filter for anti-aliasing to eliminate erroneous signals, and an output filter to smooth
or reconstruct the processed output signal. The DSK package includes a User’s Guide
manual, a DB25 parallel printer cable, and a disk that contains the assembler, debugger,
and various utilities. The DSK(board) requires a DC adapter that provides 7.5-12 Volts
DC or an AC adapter that provides 6-9 Volts AC, both supplying a minimum of 400
milliamps.
Setting up the DSP Starter Kit
1. Connect the DB25 cable from the parallel printer port of the DSK board to the IBM
compatible PC.
2. Connect the power input of the DSK board to the 7.5-9 V DC adapter. The light on the
LED should glow red.
3. Create a directory C:\dsktools on the PC and install the software tools provided on the
floppy disc by using the command a:\install.
3
4. To invoke the debugger, type:
C:\DSKTOOLS: DSK3D
If the debugger is properly installed, the light on the LED will change colors from red to
green.
The DSK board is now ready for running real-time DSP experiments
Experiment 1. Generation of sine wave of frequency 1 KHz and 2 KHz.
The first experiment involves the generation of sinusoidal signals and observation on the
oscilloscope.
1. Type DSK3A SINE4P.ASM . This command assembles the file dsk3a sine4p.asm and
creates the executable file sine4p.dsk.
2. Type DSK3D to access the debugger.
3. Type LOAD SINE4P and press F5 to run.
4. Connect the output of the DSK to an oscilloscope, and verify a 2 KHz sine wave on
the screen. However, there is no input to the DSK. Determine the peak amplitude of
the sine wave and take a hard copy of the oscilloscope output.
5. Press HALT to stop.
Repeat steps 1-5 with the file SINE8I.ASM, and verify a 1 KHz sine wave on the
oscilloscope. Determine the peak amplitude of the sine wave and take a hard copy of
the output .
Compare the source programs SINE4P.ASM and SINE8I.ASM, and locate the lines
which specify the different output frequencies. Attach hard copies of both the files.
6. Generate two other waveforms from files available in the directory. Examples are
pseudo-random noise and a square or ramp signal.
4
Experiment 2. Matrix/Vector multiplication using TMS320C3x code
The program MATRIX.ASM is a program to multiply a (3x3) matrix A by a (3x1) vector
B.
1. Use the program to multiply the matrix [ 1 -2 3 with the vector [
4 -5 6
2
7 -8 9]
2]
2
Run the program using the procedure given in Experiment 1, and list the output of the
matrix multiplication. Verify that this result is correct by manual calculation.
2. If changes are made in the program MATRIX.ASM, please note that it should be
assembled using the command
dsk3a matrix.asm
before the program can be run.
3. Run the program again for a new value of matrix A and vector B and verify that the
result is correct.
Experiment 3. Changing the sampling frequency Fs.
1. Four values are defined in 6th line of the SINE4P.ASM file. The first and third values
specify the AIC sampling frequency Fs. Change these values to:
0E1Ch, 1h, 3872h, 67h
which specifies a sampling frequency of 16 KHz.
2. Reassemble the program and load and run the program. Verify that the frequency of
the new generated sinusoid is 4 KHz, since
f = 16000/ number of points
5
Experiment 3. Changing the AIC master clock to change Fs
The first and third value specified in AICSEC are calculated using a specific value for the
AIC master clock. Changing the master clock frequency proportionately changes the
sampling frequency Fs.
1. Back up to the file AICCOM31.ASM file and change the instruction (twelfth line of
program):
LDI 1, R0
to LDI 0, R0 which doubles the AIC master clock and effectively doubles the sampling
frequency.
2. Reassemble the original program SINE4P.ASM and load and run the program, but do
not reassemble the file AICCOM31.ASM, since it is included in the file SINE4P.ASM.
3. Run the program and verify that the frequency of the new generated sinusoid is 4
KHz => 16000/4.
Experiment 4. Filtering of Signals
The second experiment tests 8 different types of filters in the filter package program
FIRALL.ASM.
1. Connect the input of the DSK board to the HP 3324A Signal Generator, and the
output of the DSK board to the oscilloscope.
2. Type FIRALL and then ENTER. The filter menu will appear, with the choice of 8
filter types, which includes lowpass, highpass, bandpass and bandstop filters. In this
experiment, you will plot the frequency response of all 8 filter types.
3. Set the HP35665A dynamic signal analyzer source to chirp signal (a signal of varying
frequency) with amplitude of 1 V peak. Connect the source output of the HP 35665A
6
to its own channel 1 input, and also the input of the TMS320C31 DSK. Connect the
output of the DSK to channel 2 of the HP 35665A Signal Analyzer. For each filter (8
types) plot the output response, obtained in step 3, as a function of frequency. This
plot represents the frequency response of the filter.
4. Run the filter program FIRALL.ASM using lowpass filter, and observe the frequency
response of the filter on the HP 35665A. Take a hard copy of the HP 35665A output.
5. Repeat the experiment using the FIRALL.ASM program for high pass, bandpass,
bandstop filters (all 8 cases), and take hard copies of the frequency response in each
case.
6. Attach a copy of the filter program FIRALL.ASM and identify the filter sections, such
as lowpass, highpass, bandpass.
Experiment 5. Fast Fourier Transform (FFT)
1. Use the FFT.ASM program to determine the Fourier transform of a sinusoidal signal at
5 KHz (use a sampling frequency of 16 KHz in the DSK) generated using the HP 3324A
signal generator.
2. Plot the spectrum of the signal, and compare with measured spectrum obtained
directly using the HP 35665A Signal Analyzer.
3. Repeat for square wave at 5 KHz, generated using the HP 3324A generator, and a
random signal obtained from the HP 35665A source. Plot the spectrum of the signals,
and compare with the measured spectrum using the HP 35665A Signal Analyzer.
7
Download