Professional Documents
Culture Documents
DSP 203766
DSP 203766
MSSV 20203766
MỤC LỤC
BÀI 1: UNIT 1 - DSP TRAINER FAMILIARIZATION...........................................................3
1.1. EX1: DSP Trainer Familiarization................................................................................................................... 3
1.2. EX2: Overview of the DSP Circuit Board........................................................................................................ 3
1.2.1. Discussion: Overview of the DSP Circuit Board................................................................................................3
1.2.2. Procedure: Overview of the DSP Circuit Board................................................................................................3
1.2.3. Review Questions.............................................................................................................................................6
1.3. EX3: Integrated Development Environment (IDE) and Project Structure........................................................7
1.3.1. Integrated Development Environment (IDE) and Project Structure: Discussion.............................................7
1.3.2. Procedure: Integrated Development Environment (IDE) and Project Structure.............................................7
Editing Memory and Registers........................................................................................................................12
1.3.3. Review Questions...........................................................................................................................................13
1.4. Unit Test..................................................................................................................................................... 14
1
BÀI 3: I/O AND PERIPHERALS..............................................................................................48
3.1. I/O and Peripherals: Fundamentals............................................................................................................. 48
3.2. EX01: An Application Using I/Os and Peripherals......................................................................................... 48
3.2.1. Discussion: An Application Using I/Os and Peripherals..................................................................................48
3.2.2. Procedure: An Application Using I/Os and Peripherals..................................................................................48
Set Up and Connections of the DSP Board.....................................................................................................48
Peripheral Registers........................................................................................................................................49
3.2.3. Review Questions...........................................................................................................................................50
3.3. Unit Test..................................................................................................................................................... 51
BÀI 5:............................................................................................................................................79
5.1. Signal Processing Applications: Fundamentals............................................................................................. 79
5.2. EX01: Applications - FIR and IIR Filters......................................................................................................... 79
5.2.1. Discussion: Applications - FIR and IIR Filters..................................................................................................79
5.2.2. Procedure: Applications - FIR and IIR Filters..................................................................................................79
5.2.3. Review Questions...........................................................................................................................................79
5.3. Unit Test..................................................................................................................................................... 79
GIỚI THIỆU
Tài liệu này ghi nhận các kết quả thí nghiệm của sinh viên dựa trên quá trình làm
việc thực tế với bo mạch và các thiết bị thí nghiệm.
2
BÀI 1: UNIT 1 - DSP Trainer Familiarization
1.1. EX1: DSP Trainer Familiarization
o DSP Trainer Familiarization: Introduction
o Types of Microprocessors
o Peculiarities of DSPs
o Program Execution
Vmax(V)=0.9
4
255 (1111 1111)
The echo effect should be quite obvious. The echo delay corresponds to the time
(in milliseconds) between consecutive echoes.
What is the minimal time required for your brain to perceive distinct repetitions?
a................................................................................................................Ty
pically 5 to 15 ms
b................................................................................................................Ty
pically 20 to 80 ms
c................................................................................................................Ty
pically 100 to 160 ms
d................................................................................................................Ty
pically 180 to 300 ms
Choose Answer:b
14. Click on the icon (next to the Run icon) to terminate the execution of the
program.
5
Choose Answer:d
17. Click on the icon to terminate the execution of the program. Return to the
projects tab and quit Code Composer. Turn OFF the power supply and remove the
connections (leads) you made on the circuit board.
3. What does the TMS320C5535 chip found on the DSP circuit board use to set the
frequency of its master clock?
a. The DSP uses its 100 MHz internal oscillator.
b. The DSP uses a 32.768 kHz external oscillator and a phase-locked loop.
6
c. The DSP uses the 33.3 MHz oscillator of the CODEC.
d. The DSP uses the clock of the computer through the USB connection.
Choose Answer:b
5. Increasing the echo delay has which effect on the signal at the output of the DSP?
a. It increases the echo effect.
b. It increases the time between consecutive echoes.
c. The sound seems more remote.
d. All of the above
Choose Answer:d
6. Go to the Registers tab and look for the Program Counter (PC) register. This
register is in the Core Registers list. Is the value of the PC register the same as the
main function starting address?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
Press the assembly step into button to go to the next assembly instruction. What
is the value of the PC register now?
a. The next sequential address in the program
b................................................................................................................Th
e main function starting address
c................................................................................................................Th
e function ending address
8
d................................................................................................................No
ne of the above
Choose Answer:a
7. While keeping an eye on the main.c, Disassembly and Variables tabs, experiment
with the different debugger step arrows to observe what happens with the debugger
and the different variables.
8. Press the run button to run the program on the board. Adjust the GAIN
potentiometer of the audio amplifier to obtain a sound output of the appropriate
volume. At this point, you should see the following information on the LCD of the
DSP circuit board: LabVolt 91031 Ex1-2 - Sin Generator freq = x Hz (where x is
a number).
9. It should be quite obvious by the name on the LCD and by playing with the dc
source knob that this application generates a sinusoidal waveform which is heard
from the loudspeaker (or earphones). Adjust the potentiometer of the dc source and
observe the result on the signal:
a................................................................................................................Th
e frequency of the signal displayed is modified as the potentiometer is adjusted.
b................................................................................................................Th
9
e value of the frequency is also modified accordingly on the LCD.</li>
c................................................................................................................As
the frequency changes the audio signal also changes.</li>
d................................................................................................................All
of the above
Choose Answer:b
10. Use an oscilloscope to observe the signal at the analog output of the CODEC.
Does the amplitude of the signal change as you change the frequency?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:b
10
}
Open the Expressions tab and type sintbl in the <new> field to obtain the values of
the sintbl table of integers. It is necessary to expand the display to see an element of
interest. Note the address of the sintbl variable:
0x001862
13. Another method is to open a Memory window to visualize the data table. Go to the
View menu of Code Composer and choose Memory Browser to open a new
window.
sintbl variable = <recall>recall(hex1)</recall></p>
Search for the address of the sintbl variable in the Memory window. Specify that
the looked-after variable is in the DATA part of the memory and that its type is 16-bit
signed integer.
The content of the memory can thus be observed in a table such as this:
This is an improvement, but due to the sheer size of the sintbl integer table, a
different method should be used.
14. Another method to visualize a large array of data is to use the graphics display
tool.
15. In the Tools menu, choose Graph, then Single Time. In the dialog box, set the
parameters as shown and click OK. The Start Address is the location in memory
where the table begins. The sintbl variable contains that address.
Which of the following best represents the resulting graph of the contents of the
sintbl table?
a................................................................................................................
b................................................................................................................
Choose Answer:b
16. The use of breakpoints is very important to any debug process. With the debug
process halted, insert a breakpoint in the main function below the comment
identified as “ //Breakpoint #01 ” in the code. Do so by double clicking to the left
11
of the line number below the Breakpoint #01 identifier in the code.
In the expressions tab, keep an eye on the value of the freq variable.
Press the run button to run the program. The execution of the program should
halt pretty quickly at the appropriate line in the main function. Note the value of the freq
variable:
3011.719
Adjust the dc source potentiometer in any direction and press the run button
again. The process should run briefly until it halts again at the same line of code.
Observed freq variable = <recall>recall(fib1)</recall>
Is the current value of the freq variable the same or close to the same as observed
in the previous step?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
Press the yellow step into arrow to execute the current line.
What is the value of the freq variable now?
a. The value remained the same
b................................................................................................................Th
e value updated corresponding to the new position of the dc source potentiometer
c................................................................................................................Th
e value has dropped to zero
d................................................................................................................No
ne of the above
Choose Answer:b
17. It is possible to go deeper in the code by placing a breakpoint in the assembly code
directly.
The breakpoint which was placed below the “ //Breakpoint #01 ” identifier in the C
code corresponds to a breakpoint automatically placed in the disassembly code at address
0x023059.
Add a breakpoint in the Disassembly window at address 0x023086.
This adds a corresponding breakpoint in the main.c file at which line?
23
12
Breakpoint line = <recall>recall(fib2)</recall>
Remove the breakpoint at address 0x023086, then add a breakpoint in the main.c
file at the line you just wrote down.
At which address in the Disassembly window is a breakpoint added?
a................................................................................................................0x
023086
b................................................................................................................0x
023049
c................................................................................................................0x
023059
d................................................................................................................0x
02307C
Choose Answer:d
Why?
a. Instruction 0x023086 was an intermediate step of the command, not its
beginning (0x02307C).
b................................................................................................................Th
e instruction at address 0x023046 was an include statement.
c................................................................................................................Th
e instruction at address 0x023046 was a comment only.
Choose Answer:a
21. Click on the icon to terminate the execution of the program. Return to the
projects tab and quit Code Composer.
22. Turn OFF the power supply and remove the connections (leads) you made on the
circuit board.
2. What step(s) must you perform to execute a program from within the Code Composer
Studio software?
a. Turn the power on to the DSP circuit board and connect it to your
computer.
b. Launch Code Composer and start the debug mode for your program.
c. Execute the Run command from the Debug toolbar.
d. All of the above
Choose Answer:d
14
3. Which of these features of Code Composer is false? Code Composer Studio allows a
developer:
a. to run and halt a program and execute single instructions.
b. to automatically generate C code for any application.
c. to place breakpoints at source statements.
d. to edit, build, debug, and manage DSP projects.
Choose Answer:b
2. Which of the following is not displayed in one of the columns of the Disassembly
window in Code Composer Studio?
a. The CPU register
b. The machine code instruction
15
c. The instruction mnemonic
d. The instruction operand(s)
Choose Answer:a
4. Which of the following statements about digital signal processors is not true?
a. They allow for more complex processing of signals than is possible
with analog circuitry.
b. They are less common than before in high-tech devices.
c. They provide repeatable performance.
d. Digital processing code can be easily modified, making design updates
or changes more flexible.
Choose Answer:b
5. What files are generated by Code Composer when a program is compiled and built?
a. .obj files
b. .asm files
c. .out files
d. Both a. and c.
Choose Answer:d
6. Which of the following circuit blocks can be used to interact with a DSP program?
a. interrupts
b. Microphone pre-amplifier
c. Auxiliary power input
d. Audio amplifier
Choose Answer:a
17
BÀI 2: UNIT 2 - Architecture
2.1. Architecture: Fundamentals
o Architecture: Introduction
o The Von Neumann Architecture
o The Harvard Architecture
o The Architecture of the TMS320C5535
18
decimal value to an integral decimal value and makes it easy to convert this
number to a binary number (in 2s-format). What is the integral decimal value
obtained?
-16128
3. Use the decimal to binary conversion tool of your calculator to obtain a one Word
(16 bits) binary value. You might have to specify that you want a Word result by
clicking a checkbox.
What is the binary result obtained?
1100 0001 0000 0000
In Q14-format?
-0.984375
b................................................................................................................
Choose Answer:b
Calculate the resulting decimal value and select the correct result.
Choose Answer:a
19
B093h = 1011 0000 1001 0011b
6. The hexadecimal number represents an unsigned integer. Identify the bit weights
associated to this representation:
Choose Answer:a
Calculate the resulting decimal value and select the correct result.
Choose Answer:c
Choose Answer:a
Calculate the resulting decimal value and select the correct result:
Choose Answer:b
20
Identify the bit weights associated with the mantissa:
Choose Answer:b
Choose Answer:b
Choose Answer:a
What is the decimal value of the number in 16-bit floating point format?
Choose Answer:c
9. Connect the DSP board to your computer using USB port number 2 on the board
and a standard USB port on your computer. Make sure that the circuit board power
source is turned ON and that the Code Composer software is installed as explained
in Appendix C. Launch Code Composer on your computer.
10. Make exercise_2_1 the active project simply by clicking on that project in the
Project Explorer window. Launch the Debug mode by clicking the
11. Press the run button to run the program on the board. At this point, you should
see the following information on the LCD of the DSP circuit board: LabVolt
91031 Ex2-1 and some number conversion information. Click on the icon to
halt the execution of code.
12. Open the Expressions tab and type “ var1 ” in the <new> field to see the value of
21
this variable.
Right-click on the current value and select Q-values > Select Q-Value.
Then specify you want to use the Q14-format to display the value, using the select
Q-value option in the Q-Values submenu
Type in -0.984375 as the value of the variable.
Now, right-click on the value and select the decimal format in the Number Format.
Does this value coincide with the one obtained in step 2? submenu
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
13. Right-click on the “ var1” variable and select the binary format. Does this value
coincide with the one obtained in step 3?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
14. Now, choose the hexadecimal (Hex) format for “ var1 ” and type 0xB093 to edit
its value. What is the decimal value of this number? Change the format of “var1”
to decimal in order to obtain this result.
a................................................................................................................-
16128
b................................................................................................................-
20333
c................................................................................................................-
20477
Choose Answer:b
15. What is the Q15 value of this number? Change the format of “var1” to Q15 in
order to obtain this result.
a................................................................................................................-
22
16128
b................................................................................................................-
20333
c................................................................................................................-
0.620514
Choose Answer:c
16. Cast “var1” into a float by selecting the Cast To Type command. Enter “float” in
the cast to type window and press OK. Does this value coincide with the one
obtained in step 8?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:b
A variable, such as “var3”, which is of the float type, uses the (32-bit) floating
point representation.
A variable declared as a float cannot be displayed as a Q-format number. In the
same way, a variable declared as an integer cannot make use of the floating-point
representation.
Add “var3” to the expressions list to verify this for yourself.
17. Recast “var1” into an int. Notice how “var1” cannot be used as an unsigned integer
to obtain the result of step 5. This is because this variable is declared as a 16-bit
signed integer. Add variable “varUnsigned” to the Expressions tab. Edit its value
to 0xB093 and display the result in Decimal notation.
Does this value coincide with the one obtained in step 5?
a................................................................................................................Ye
23
s
b................................................................................................................No
Choose Answer:a
24
1. What is the range of decimal values that a 2s-format 16-bit binary number can
represent?
a. -65536 to 65535
b. 0 to 65536
c. -32768 to 32767
d. 0 to 16
Choose Answer:c
4. What is the proportionality constant between the 2s-format and the Q13- format, for a
16-bit binary number?
a. 13
b. 215
c. 8192
d. -3.0518 x 10-5
Choose Answer:c
25
Choose Answer:d
5. With the execution of the code halted, insert a breakpoint in the LVex2_2.asm file,
just below the Operations identifier. Notice, above the breakpoint you inserted, the
instruction which deactivates the sign-extension mode:
;bclr SXMD ;no sign extension
Also, the following values are used (in 2s-format):
6. Open the Registers window and locate the AC0HL, T0, and ST0 registers among
the Core registers dropdown. Press the run button to restart the program on the
board.
Observe the instructions in the LVex2_2.asm file and click on the arrow to
execute the different instructions as you observe the value of the different registers and
the results of the ADD, SUB, AND, OR, NOT, MACM, MPYM instructions.
Note the results (value of AC0) below:
27
NOT (x): 0xFFFFFFFFE2
7. Go back to your breakpoint and to the instruction which deactivates the sign
extension mode. Deactivate this instruction (transform it into a comment) by
placing a semicolon (;) in front of it like this:
;bclr SXMD ;no sign extension
Click on the icon to terminate the execution of the program in debug mode, then
re-launch the debug mode by icon. This will rebuild the output file and reload the
program into DSP – this time, with the sign extension activated.
Press the run button to run the program on the board. The program will stop at
your breakpoint.
8. Re-execute the different instructions (with the arrow) and note the results of the
second-to-last instruction.
ADD (17, w): 0x0000000000
How is “w” entered in the AC0 register (on the line before the addition)?
W= 0xFFFFFFFFEF
9. Remove the breakpoint you inserted in the LVex2_2.asm file, next to the
Operations identifier
AC0: 0x80FDFC0204
ACOV0: 1
12. Execute the bclr CARRY and bclr ACOV0 instructions (with the arrow) to
clear (value equal to 0) both the CARRY bit flag and the overflow bit of AC0 in
the ST0 status register.Next, execute the different instructions one by one and note
the value of the CARRY bit after the following instructions:
SUB #1001h,AC0 CARRY = 0
29
ADD #1001h,AC0 CARRY = 1
13. With the execution of the code halted, insert a breakpoint in the LVex2_2.asm file,
just below the Operations identifier. Notice, above the breakpoint you inserted, the
instruction which deactivates the sign-extension mode:
;bset SATD ;Saturation mode bit for the D-Unit
Click on the icon to terminate the execution of the program, then relaunch the
debug mode by clicking the icon. This will rebuild the output file and load the
program into DSP – this time, with the overflow saturation mode activated.
Press the run button to run the program. The program will stop at your first
breakpoint.
14. Press the run button a second time. The program will complete the multiple
repetitions of the MAC instruction and stop at your second breakpoint. Note the
following values:
AC0: 0x7FFFFFFFFF
ACOV0: 0
15. Click on the icon to terminate the execution of the program. Delete all
breakpoints and put the semi-colon (;) back in front of the bset SATD instruction
to turn it back into a comment. Remove the semi-colon in front of the bclr SXMD
instruction, just before the Operations identifier
30
16. Make exercise_2_2b the active project simply by clicking on that project in the
Project Explorer window. Open both the main.c and LVex2_2b.asm files of
exercise_2_2b.
17. Observe the contents of the LVex2_2b.asm file. In this routine, two algorithms
calculate the output of a filter for some data. This is typical of a DSP calculation.
The first algorithm does not use parallelism. It uses MAC instructions which are
repeated many times in a loop.
The duration of this algorithm is measured by “delta1”, a variable defined in the
main.c file.
The value of this variable is the difference between two decrementing counters
(timeCnt1 and timeCnt2).
The second algorithm does the same thing as the first, but uses parallelism.
This can be seen by the pairs of MAC instructions separated by the double colon (::).
The duration of this algorithm is measured by “delta2”, a variable defined in the
main.c file.
The value of this variable is the difference between two decrementing counters
(timeCnt3 and timeCnt4).
18. In the Expressions window, add the following two variables: “delta1” and “delta2”
Note that a counter in this program is decremented by one after two clock cycles.
Consequently, the number of clock cycles required to perform each algorithm is
equal to delta * 2
19. Launch the Debug mode by clicking the icon to load the program into the DSP.
Insert a breakpoint in the main.c file at the line below the “//Breakpoint #01”
identifier. This will allow to halt the program just after the execution of the ex2_2b
routine.
20. LPress the run button to run the program on the board. At this point, you should
see the following information on the LCD of the DSP circuit board:
L.V. 91031 Ex2-2b / Memory & Profiling
21. The ex2_2b routine has now been executed. Press the step-into arrow ( arrow)
twice to execute the two instructions which calculate the values of “delta1” and
“delta2”.
Note the results below:
31
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
22. Click on the icon to terminate the execution of the program. Return to the
projects tab and quit Code Composer. Turn OFF the power supply and remove the
connections (leads) you made on the circuit board.
5. What is the result of the sign extension to 8 bits of the 4 bit word: 1010?
a. 1111 1010
b. 0000 1010
c. 1010 1111
d. 1010 0000
Choose Answer:a
34
10. Play back the audio signal (press the button). How would you describe the
quality of the recording?
a................................................................................................................Thi
s depends a lot on the original audio signal and the settings of the system.
b................................................................................................................Th
e quality should be good compared to the 8-bit modes.
c................................................................................................................So
unds good to me!
d................................................................................................................All
of the above
Choose Answer:d
11. The signal is sampled and stored in a table called recBuff. Click on the icon to
halt the execution of the code. Open the Expressions window and add the recBuff
table to the list. What is the number of samples stored in the table?
a................................................................................................................10
000
b................................................................................................................32
768
c................................................................................................................Un
known
Choose Answer:b
35
What is the address of the first element of recBuff?
a. 0x0103E8@DATA
b................................................................................................................0x
010000@DATA
c................................................................................................................0x
017F58@DATA
Choose Answer:b
12. Produce a graph of the first 8000 samples of the recorded signal. In the Tools
menu, choose Graph, then Single Time. In the dialog box, set the parameters as
shown in the Figure and click OK. The Start Address is the location in memory
where the table begins. The recBuff variable contains the required address. Print
the resulting graph. Your graph of the contents of the recBuff table will look
similar to our sample.
13. Adjust the DIP switch of the I/O interface to a value of 1 to activate the 8-bit mode
with μ-law compression.Press the run button to run the program on the board.
14. Record an audio signal (press the button). What is the longest duration of
signal you can record?
a................................................................................................................Ap
proximately 2 seconds
b................................................................................................................Ap
proximately 4 seconds
c................................................................................................................Ap
proximately 8 seconds
Choose Answer:c
15. Play back the audio signal (press the button). How would you describe the
quality of the recording?
a................................................................................................................Bet
ter than the 16-bit recording
36
b................................................................................................................Sli
ghtly worse than the 16-bit recording
c................................................................................................................Ext
remely bad
Choose Answer:b
16. The μ-law compression scheme tries to optimize the quantization noise of the
signal, especially for small values of the signal. Adjust the DIP switch of the I/O
interface to a value of 2 to activate the 8-bit mode without the μ-law compression
scheme and press the button again to play the recorded audio in this new
mode. How is the sound now?
a................................................................................................................Bet
ter than the 16-bit recording
b................................................................................................................Sli
ghtly worse than the 16-bit recording
c................................................................................................................Ext
remely bad
Choose Answer:c
17. Click on the icon to halt the execution of the code. The signal is still sampled
and stored in a table called recBuff. However, each element of the table (16 bits =
2 bytes) contains two samples (1 byte per sample). There are consequently twice as
many samples compared to the 16-bit case. What is the total size of the audio
recording in 8-bit mode?
a................................................................................................................16
KB or 16384
b................................................................................................................32
KB or 32768
c................................................................................................................64
KB, or 65536 bytes
Choose Answer:c
18. Adjust the DIP switch of the I/O interface to a value of 2 to activate the 8-bit
mode. This mode does not attempt to minimize errors caused by the signal
37
quantization. Press the run button to run the program on the board.
19. Record an audio signal (press the button). What is the longest duration of
signal you can record?
a................................................................................................................Ap
proximately 2 seconds
b................................................................................................................Ap
proximately 4 seconds
c................................................................................................................Ap
proximately 8 seconds
Choose Answer:c
20. Play back the audio signal (press the button). How would you describe the
quality of the recording?
a................................................................................................................Sli
ghtly worse than the 8-bit recording with μ-law compression
b................................................................................................................Bet
ter than the 16-bit recording
c................................................................................................................Ext
remely bad
Choose Answer:a
21. What would happen if an audio recording done in 8-bit mode were to be played in
16-bit mode? Adjust the DIP switch of the I/O interface to a value of 0 to activate
the 16-bit mode. Press the button again to play the recorded audio in this
new mode. How is the sound now?
a................................................................................................................Cle
ar
b................................................................................................................Dis
torted
Choose Answer:b
22. Note that the data is recorded in the same data table (at the same address as
before). You can halt the process if you wish and observe the graph of the audio
recording (specify that the data is 8-bit long).
23. Adjust the DIP switch of the I/O interface to a value of 4 to activate the flash
memory erase mode. Make sure the program is running (Press the run button to
run the program on the board, if required). Press the button to delete the
contents of the flash memory.
24. Adjust the DIP switch of the I/O interface to a value of 3 to activate the 16-bit
38
flash memory mode. Calculate the longest duration of signal you can record on the
flash memory, knowing it has a capacity of 8 MB (or 8192 KB). Use the size and
duration of the file previously obtained in steps 9 and 11 for the 16-bit mode.
a................................................................................................................8.5
seconds
b................................................................................................................8.5
minutes
c................................................................................................................8.5
hours
Choose Answer:b
28. Click on the icon to halt the execution of the code. The flash memory is
external to the DSP and must be accessed via a peripheral. Consequently, there is
no simple way to observe the contents of that memory or to obtain the graph.
29. Go to the View menu of Code Composer and choose Memory Browser to open a
new window. Search for address 0x010000 in the Memory window. Specify that
the looked-after variable is in the DATA part of the memory and that its type is 16-
bit hexadecimal. What is the content of that memory word?
16-bit hex value = 4EFD
30. As explained in the theory part of this exercise, if the same memory content were
to be accessed with the program bus, it would be necessary to adjust the addressing
and to access bytes instead of words. Search for address 0x020000 in the Memory
window. Specify that the looked-after variable is in the PROGRAM part of the
memory and that its type is 8-bit hexadecimal. What is the content of that memory
byte?
8-bit hex value = 4E
31. Click on the icon to terminate the execution of the program. Return to the
projects tab and quit Code Composer. Turn OFF the power supply and remove the
connections (leads) you made on the circuit board.
4. A byte is accessed by the program bus at address 0x001011. At which address can the
word containing this byte be accessed by the data bus?
a. 0x000808
b. 0x001022
c. 0x001020
d. It cannot be accesse
40
Choose Answer:a
5. A word in memory is 8A3F and is accessed at address 0x000100 by the data bus. What
is the content of the memory block accessed by the program bus at address 0x000201?
a. 8A3F
b. 8A
c. 3F
d. It cannot be accessed
Choose Answer:c
6. Click on the icon to halt the execution of the code. In the LVex2_4.asm file,
observe the _initCB section of code. This part is used to initialize the circular
buffer. The number of elements is set to 16, the DSP is configured to operate with
circular buffers, and the index is set to 0.
7. Go to the _initDone part of the file and locate the mov mmap(@BK03), AC0
instruction. Insert a breakpoint at this line (below identifier Breakpoint #01) and
press the icon to execute the program up to that point. Which type of addressing
is used with regards to BK03?
a................................................................................................................Ind
irect addressing
b................................................................................................................Dir
ect addressing
c................................................................................................................Im
plied addressing
Choose Answer:b
42
c................................................................................................................c09
6_98
Choose Answer:a
10. Add the following two variables to the Expressions window: average and recBuff.
The average variable contains the result of the sum of the samples divided by 16,
that is, the average of the samples. The recBuff variable is a table containing
sixteen different samples from the signal used in the circular buffer.
11. Edit the different elements of recBuff to values of your choice from the
Expressions window. What is the number of samples stored in the table?
a................................................................................................................15
b................................................................................................................16
c................................................................................................................19
3A
Choose Answer:b
45
How is the quality of the output signal?
a. The output signal is very pure.
b................................................................................................................Th
e output signal is slightly fuzzier than the original one.
c................................................................................................................Th
e two signals are the exactly the same.
Choose Answer:b
16. Increase the frequency of the signal to 800 Hz. Observe both the input signal
(Channel 1) and the DSP output signal (Channel 2) on an oscilloscope. Is the
output signal in sync with the input signal?
a................................................................................................................Ye
s, the two signals are in syn
b................................................................................................................No,
the signal is slightly delayed.
Choose Answer:b
17. Change the frequency of the signal to 450 Hz. Observe both the input signal
(Channel 1) and the DSP output signal (Channel 2) on an oscilloscope. Is the
output signal in sync with the input signal?
a................................................................................................................No,
the output signal is almost inverted with respect to the original signal.
b................................................................................................................Ye
46
s, the two signals are in syn
Choose Answer:a
18. Use a signal generator to produce a triangle waveform with an amplitude of 0.4 V
and a frequency of 100 Hz. Observe both the input signal (Channel 1) and the DSP
output signal (Channel 2) on an oscilloscope. What does the signal look like?
a................................................................................................................Th
e signal is close to being a sinusoidal waveform.
b................................................................................................................Th
e averaging algorithm smoothes the original signal.
c................................................................................................................Th
ere is a delay between the two.
d................................................................................................................All
of the above.
Choose Answer:d
19. Use a signal generator to produce a square waveform with an amplitude of 0.4 V
and a frequency of 180 Hz. Observe both the input signal (Channel 1) and the DSP
output signal (Channel 2) on an oscilloscope. What does the signal look like?
a................................................................................................................Th
e signal looks like a triangular waveform.
b................................................................................................................Th
e signal saturates (crops the triangle tips), as the average of a plateau cannot be
47
higher than the plateau itself.
c................................................................................................................Th
ere is a delay between the two signals.
d................................................................................................................All
of the above.
Choose Answer:d
20. Click on the icon to terminate the execution of the program. Return to the
projects tab and quit Code Composer. Turn OFF the power supply and remove the
connections (leads) you made on the circuit board.
4. Which mode is associated with the @ operator to specify a call of the address of a
variable in the instruction?
a. Absolute addressing
48
b. Direct addressing
c. Indirect addressing
d. Implied addressing
Choose Answer:b
1. What is the basic processor memory architecture most often implemented in digital
signal processors?
a. The Von Neumann architecture
b. The Harvard architecture
c. The modified Von Neumann architecture
d. The ATARI architecture
Choose Answer:b
49
Choose Answer:d
8. What is the result of the sign extension to 8 bits of the 4-bit word: 0110?
a. 0000 0111
b. 0000 0110
c. 1111 0110
50
d. 1111 0111
Choose Answer:b
9. A byte is accessed by the program bus at address 0x004021. At which address can the
word containing this byte be accessed by the data bus?
a. 0x002010
b. 0x004020
c. 0x008042
d. It cannot be accessed.
Choose Answer:a
51
BÀI 3: I/O and Peripherals
3.1. I/O and Peripherals: Fundamentals
o Peripherals, Inputs and Outputs (I/O)
o Codec
52
Choose Answer:e
5. Locate the I2S_initForDMA() function call in the main.c file. Hover the mouse
pointer over the call and perform the Open Declaration command (Ctrl + F3 or use
a right-click and select the command from the menu). Observe that this function
creates a variable, hwConfig, which is of type I2S_Config. This variable is a
structure made of several other variables. Many of these are initialized in the
I2S_initForDMA function. For instance, the variable dataType is set so as to
enable stereo recordings.Go back to the main function.
6. Locate the start_acq() function call in the main function. Hover the mouse pointer
over the call and perform the Open Declaration command (Ctrl + F3 or use a right-
click and select the command from the menu). Code Composer takes you to the
code of the start_acq() function. Among others, a large number of parameters are
set for DMA channels 4 and 5. Find the following command line for channel 5
(I2S write):
This line specifies the address
where the data from the CODEC will be written in the DSP memory as it is transferred.
Hover the mouse pointer over the I2S2TXRT0 definition and perform the Open
Definition Declaration command. This action takes you to the place in the code where
this address is defined and shows that the destination address is 0x2A0C.
Peripheral Registers
7. Halt the program using the button. Open the Registers window and locate the
different registers related to the peripherals. You should see a long list, starting
with DMA0 and going on for the different peripherals. Explore the sub-menus to
see the extent of parameters available for the peripherals.
8. Have a look at the TIMER0 register menu. Observe that there is an enable bit to
activate the timer. (TIMER0 ▶ TCR ▶ TIMEN). Enable the timer by setting this
bit to 1. Set the PSCDIV register to 0x9. Start the timer by setting the START bit
to 1.
Press the arrow a few times and observe the result on the TIMCNT1 and
TIMCNT2 registers. TIMCNT2 should decrease steadily with every click on the arrow
as the timer decreases its counter.
9. Locate the I2S2 register menu and expand it. Expand the I2SSCTRL menu and
locate the ENABLE bit. This bit should be set to 1. Clear the ENABLE bit to 0.
This will deactivate the I2S peripheral used in this application.
10. Press the run button to run the program.Press the button to play back the
recorded signal. What do you obtain?
a................................................................................................................No
Audio playback
53
b................................................................................................................Au
dio playback
Choose Answer:a
Press the button to activate the recording mode and record a new signal.
11. Halt the program using the button and set the ENABLE bit to 1 (I2S2 ▶
I2SSCTRL ▶ ENABLE) to reactivate the I2S peripheral.
12. Press the run button to run the program. Press the button to play back the
recorded signal. What do you obtain?
a................................................................................................................Ne
wly recorded Audio playback
b................................................................................................................Pre
viously recorded Audio playback
Choose Answer:b
13. Halt the program using the button. In the Registers window, edit the DMA1 ▶
DMACH1DSAL parameter to 0x2A0D. This changes the destination address for
data transiting through DMA channel 5 towards the CODEC.
14. Press the run button to run the program. Press the button to play back the
recorded signal. What do you obtain?
a................................................................................................................Au
dio playback
b................................................................................................................No
Audio playback
Choose Answer:b
Changing the destination address of DMA channel 5 made the transfer of data
54
from the DSP to the CODEC impossible, but the data could still go from the CODEC to
the DSP via channel 4.
17. Click on the icon to terminate the execution of the program. Return to the
projects tab and quit Code Composer. Turn OFF the power supply and remove the
connections (leads) you made on the circuit board.
55
5. DMA channels 4 and 5 are used to:
a. set different parameters.
b. set registers related to peripherals.
c. make the use of peripherals possible.
d. All of the above
Choose Answer:a
1. Which peripheral is used to move data between the different parts of memory and the
other peripherals?
a. I²C
b. DMA
c. RTC
d. Timer
Choose Answer:a
2. Which peripheral is used as an interface between the DSP and other devices connected
by a two-wire bus?
a. I²C
b. DMA
c. RTC
d. Timer
Choose Answer:a
56
c. GPIO
d. USB
Choose Answer:a
5. Which peripheral is used as an interface for the acquisition of audio signals or to drive
loudspeakers?
a. I²C
b. I²S
c. GPIO
d. SAR
Choose Answer:c
9. Which peripheral is used to communicate between the DSP and external peripherals?
a. SPI
b. LCDC
57
c. RTC
d. I²S
Choose Answer:a
58
BÀI 4: DSP Real-Time Processing
6. Use the cursors on the oscilloscope to determine the sampling period, that is, the
duration of each step in the output waveform. Then calculate the sampling rate.
Approximate sampling period Ts = 0.084
ms
The approximate sampling rate ƒs =1/T = 12000
Hz
7. In code Composer, pause the program using the Halt button . In the file
interrupt.c, find the comment //Breakpoint #01. Set a breakpoint on the line
immediately below this comment by double-clicking to the left of the line number.
Press the run button to run the program. It will stop after acquiring samples from
the ANALOG INPUT signal, via the DMA buffer, and placing this data in the vector x.
You can display a graph of the vector x in Code composer. In the Tools menu,
choose Graph, then Single Time.
Set the parameters as shown in the Figure.
This Figure shows execution stopped at the breakpoint and shows an example
graph of the values in x. (The starting point of the waveform will be different each time
execution reaches this breakpoint.)
Does the graph of the values in x resemble the output signal waveform displayed
on the oscilloscope?
61
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
8. In Code Composer, deactivate or remove the breakpoint. Press the run button .
Use the button to turn the filters ON. What effect does the anti-aliasing filter
have under the present conditions?
a................................................................................................................It
has little effect on the input waveform because its cutoff frequency (3100 Hz) is
much higher than the input signal frequency (300 Hz).
b................................................................................................................It
has a large effect on the input waveform because its cutoff frequency (3100 Hz) is
much higher than the input signal frequency (300 Hz).
What effect does the post filter have under the present conditions?
a. No effect
b................................................................................................................It
smoothes the steps of the output waveform.
Choose Answer:b
9. Slowly increase the input signal frequency to approximately 3000 Hz. Does the
output signal resemble the original analog signal?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
10. Slowly increase the input signal frequency to approximately 4000 Hz. What
happens.
a................................................................................................................Sin
ce the filters are ON, the output signal amplitude diminishes rapidly as the input
signal frequency increases beyond 3000 Hz.
b................................................................................................................At
4000 Hz, the output signal amplitude is zero.
c................................................................................................................All
of the above
Choose Answer:c
Determine the Nyquist rate for the selected sampling rate. F_Nyquest = ƒs/2
62
ƒs = 12000
ƒ_ Nyquest = 6000
11. Set the sampling rate to 6000 Hz (set the DIP switch to 0000 0010). Our Figure
shows an example of what you should observe. Describe the output signal.
a................................................................................................................a
sinusoidal waveform at a higher frequency than the input signal.
b................................................................................................................a
sinusoidal waveform at a lower frequency than the input signal.
c................................................................................................................a
sinusoidal waveform at the same frequency than the input signal.
Choose Answer:b
Since the input signal frequency is greater than the Nyquist rate, aliasing has
occurred.
a. True
63
b................................................................................................................Fal
se
Choose Answer:b
The output waveform is that of the first replica. Its frequency is ƒs – ƒm = 6000 -
4000 = 2000 Hz.
a. True
b................................................................................................................Fal
se
Choose Answer:a
12. Set the frequency of the input signal to 1000 Hz. Use the button to turn the
filters OFF. Set the sampling rate to each of the values in the Table while
observing the output waveform on the oscilloscope.
Describe the output waveform with the sampling rate set to 2000 Hz and explain
what is happening.
a................................................................................................................Th
e output waveform exactly duplicates the input signal. Four samples are taken per
cycle.
b................................................................................................................Th
e output waveform is almost a square wave at the same frequency as the input
signal. Four samples are taken per cycle.
c................................................................................................................Th
e output waveform is almost a square wave at the same frequency as the input
signal. Two samples are taken per cycle.
Choose Answer:c
13. Set the sampling rate to 1714 Hz (DIP SW: 0000 0111) and then to 1500 Hz (DIP
SW: 0000 1000). The output signal is a stepped waveform.
a................................................................................................................Tru
e
b................................................................................................................Fal
se
Choose Answer:b
64
What is the frequency of the output waveform?
The frequency of the output waveform is 2000 Hz
Since the input signal frequency ƒm is greater than the Nyquist rate, aliasing has
NOT occurred.
a. True
b................................................................................................................Fal
se
Choose Answer:b
The output waveform is that of the first replica. Its frequency is ƒs – ƒm = 1500 -
1000 = 500 Hz.
a. True
b................................................................................................................Fal
se
Choose Answer:a
Frequency-Domain Observations
Frequency domain observations can be made by placing the application in the
Spectrum mode. In this mode, the signal at the analog output of the CODEC contains a
frequency spectrum that can be displayed on a standard oscilloscope. This will allow you
to make qualitative observations in the frequency domain.
In this mode, when the filters are ON, the output signal is filtered by the post filter
before the spectrum is calculated. This allows you to display the spectrum of the filtered
signal.
14. Use the DIP switch to set the sampling rate to 12000 (DIP SW: 0000 0001). Use
the button to set the output mode to Spectrum. Use the button to turn
the filters OFF. Adjust the output level of the signal generator to 0 V.
On the oscilloscope:
o set the Time Base to 0.5 ms/div.
65
o set the Channel 2 Scale to 50 mV/div.<
o set the Trigger Source to Ch 2, set the Trigger Slope to Falling and set the
Trigger Level to approximately -0.05 V.
The oscilloscope should trigger on a negative peak. If necessary, move the
horizontal trigger point in order to see this peak, as shown in our Figure.
15. Move the horizontal trigger position to the extreme left side of the graticule.
Adjust the signal generator to produce a sine wave message signal with an
amplitude of 0.7 Vpp. Set the frequency ƒm of the sine wave to 1000 Hz. You
should see a positive peak near the middle of the first division, as shown in the
Figure.
This positive peak represents a sinusoidal frequency of 1000 Hz. Show the vertical
cursors and position a vertical cursor at the center of this positive peak. Do not move this
cursor for the rest of this exercise. The oscilloscope should indicate the horizontal
position of this cursor in ms.
The extreme left side of the Ch 2 trace corresponds to 0 Hz (dc). The position in
ms of the cursor you moved over the positive peak corresponds to 1000 Hz.
16. Set the frequency ƒm of the input message signal to 3000 Hz. The left-most
positive peak should now be in the second division of the graticule and three other
peaks should be visible, as shown in this Figure.Position a second vertical cursor
vertical at the center of the left-most positive peak, as shown in the same Figure.
This horizontal position corresponds to 3000 Hz. (Do not move the cursor at 1000
Hz.)
Enter the horizontal position (in ms) that corresponds to 3000 Hz in the first row of
the Table.
Use the second cursor to determine the horizontal position of the three other peaks
and enter these in the Table.
The frequency scale of the Spectrum display is roughly 4500 Hz/ms. Use this scale
to determine the approximate frequencies of the last three positive peaks in the Table.
1 0.7 3000 ƒp = fm = fs
2 2.03 9000 ƒp = fs - fm
3 3.35 15000 ƒp = fs + fm
66
4 4.7 21000 ƒp = 2fs - fm
17. Position the second cursor at 3000 Hz, as shown in the Figure. This cursor and the
one at 1000 Hz will serve as frequency references. Set the frequency of the input
sine wave to the first frequency in our Table. Set the sampling rate to 6000 Hz
(DIP SW: 0000 0010). What is the Nyquist rate for the current sampling rate?
a................................................................................................................20
00
b................................................................................................................30
00
c................................................................................................................60
00
Choose Answer:c
18. While observing the frequency spectrum on the oscilloscope, set the frequency of
the sine wave to the other frequencies in our Table. Explain what happens as the
input sine wave frequency approaches the Nyquist rate:
As the sine wave message signal frequency increases, its peak in the spectrum
display moves to the right. At the same time, the peaks in the first replica spread apart.
a................................................................................................................Tru
e
b................................................................................................................Fal
se
Choose Answer:b
Explain what happens as the input sine wave frequency reaches the Nyquist rate:
a. The first replica is much lower than that of the message signal because of
aliasing.
b................................................................................................................Th
e message signal and the lower component of the first replica coincide.
Choose Answer:b
Explain what happens as the input sine wave frequency goes above the Nyquist
rate.
a. The lower component of the first replica moves below the message signal
frequency and aliasing occurs.
b................................................................................................................Th
e message signal and the lower component of the first replica coincide.
67
Choose Answer:a
19. With the input message signal frequency set to 5000 Hz, set the Mode to
Waveform. Describe what you observe.
a................................................................................................................Th
e output waveform is a step waveform with a frequency of 1000 Hz.
b................................................................................................................Th
e output waveform is a step waveform with a frequency of 2500 Hz.
c................................................................................................................Th
e output waveform is a step waveform with a frequency of 5000 Hz.
Choose Answer:c
Using the current configuration, turn the filters ON and explain what you observe:
The post filter smoothes the output waveform. However, the frequency of this
waveform is much higher than that of the input waveform because of aliasing.
a. True
b................................................................................................................Fal
se
Choose Answer:b
The frequency of the output waveform is that of the lower component of the first
replica, that is, ƒs – ƒm = 6000 - 5000 = 1000 Hz.
a. True
b................................................................................................................Fal
se
Choose Answer:b
20. Set the frequency of the input sine wave to 2250 Hz. Turn the filters ON and OFF.
Compare the input and output signals when the filters are ON. Does the post filter
correctly reconstruct the output signal?
a................................................................................................................Ye
s, the output signal has the same frequency as the input signal.
b................................................................................................................No,
the output signal has a different frequency than the input signal.
Choose Answer:b
21. Click on the icon (next to the Run icon) to terminate the execution of the
program. Return to the projects tab and quit Code Composer. Turn OFF the power
supply and remove the connections (leads) you made on the circuit board.
2. When sampling an analog signal, to ensure that the samples adequately represent the
analog signal the Sampling Theorem must be respected, that is, all frequency
components in the analog signal must be less than one-half the sampling rate.
a. True
b. False
Choose Answer:a
3. To ensure that the samples adequately represent the analog signal the Sampling
Theorem must be respected. What measures could be taken if this condition is not
respected?
a. The sampling rate could be increased to a rate higher than twice the
highest frequency.
b. An anti-aliasing filter could be used to remove frequencies in the analog
signal that are greater than the Nyquist rate.
c. Both a and b
Choose Answer:c
69
4. What is the purpose of the post filter at the output of a D/A converter?
a. To remove the replicas in the D/A converted signal.
b. To keep only the desired message signal.
c. To smooth the waveform.
d. All of the above
Choose Answer:d
5. What happens between samples at the output of a D/A converter and how does this
affect the D/A converted signal.
a. The voltage at the output of the D/A converter remains constant
between samples.
b. The constant voltage at the output of the D/A converter causes the
frequency spectrum of the D/A converted signal to have a curved envelope with
nulls at multiples of the sampling frequency.
c. The constant voltage at the output of the D/A converter causes aperture
distortion (attenuation of the higher frequencies in the reconstructed signal).
d. All of the above.
e. None of the above.
Choose Answer:d
70
The Fast Fourier Transform (FFT): Introduction
Using the FFT
o Optimizing an FFT Application
Optimizing an FFT Application: Introduction
Library Functions
Code Optimization
Using Complier Intrinsics
Optimizing With Compiler Options
Hardware FFT Accelerator
FFT Display
This application applies an FFT to the signal at the AUDIO INPUT in order to
calculate the frequency spectrum of the signal. The first 20 points of the magnitude
frequency spectrum are displayed as a bar graph on the LCD.
6. Make the connections shown in the Figure. With these connections, the generated
sine wave is applied to the ANALOG INPUT of the CODEC. The DSP will
calculate the FFT of the input signal in real time and display the magnitude
frequency spectrum on the LCD as a bar graph.
The LCD can display four rows of 20 characters each. In this exercise, the last two
rows are used together to display a bar graph of the spectrum. The position of each bar in
the display corresponds to the center frequency of one of the frequency bins. Figure
shows a bar in position 2.
Our next Figure shows the 20 positions of the bar graph and the center frequency
72
of each corresponding frequency bin. Position 0 corresponds to the dc component of the
signal being analyzed.
Each bar in the frequency spectrum is composed of one or two block characters, as
shown. The height of each block character can range from 0 to 8 pixels, but the bottom
row of pixels is always displayed to mark the position. This means that the height of each
bar can range from 1 to 16 pixels.
The height of each bar represents the relative magnitude of the output of the
corresponding frequency bin. A bar 1 pixel high represents zero (the corresponding
frequency is absent) and a bar 16 pixels high represents the maximum displayed
magnitude for that frequency bin.
7. Adjust the sine-wave generator to different frequencies and observe the displayed
spectrum. Start with the frequencies shown here.
10. In the toolbar of the graph window, click the graph properties button to
redisplay the Graph Properties dialog box.
You can graph just the real values in fft_x_data by setting Index Increment to 2
and the Display Data Size to 64, as shown. This graphs every other value in the vector,
starting with the first real value. Setting the Time Unit to ms shows time on the horizontal
axis.
Our next Figure shows the graph with these new settings. As expected, only the
real values, which were acquired by the CODEC, are graphed. All imaginary values (the
added zeros) are skipped.
11. Clicking in the Single Time graph window displays two red cursors as well as the
74
values that these cursors represent. You can use these cursors to measure the
period of one cycle of the waveform, as shown.
Click in the graph window and carefully move horizontal cursor to the first sample
on the vertical axis and, while still holding down the mouse button, move the vertical
cursor to the intersection of the horizontal cursor and the next cycle of the waveform.
This displays the approximate period in milliseconds of the waveform.
Considering the frequency of the sine wave, is the observed period what you
would expect?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
Compare the period T of the sine wave to the duration in seconds of the time
window Twin. Where:
a.
b.
c.
Choose Answer:a
The waveform in the graph is shown as a continuous line. Is this the graph of a
continuous signal or of a discrete signal? (To check your answer, show the Graph
Properties dialog box and change the Data Plot Style from Line to Bar. Set Time Display
75
Unit to Sample.)
a. Continuous
b................................................................................................................Dis
crete
Choose Answer:b
12. In the Breakpoints window, check all four breakpoints. Press the run button .
The lines between //Breakpoint #01 and //Breakpoint #02 will be executed.
Before //Breakpoint #02, the library function cfft calculates the FFT of the data in
fft_x_data. This is a complex function that operates on N complex time-domain values
and outputs N complex frequency-domain values. This function performs an in-place
calculation which means that the results are placed in the vector that holds the input data.
The original contents of this vector are destroyed in the process.
Because of the way an in-place complex FFT algorithm works, the values in the
output vector are not in normal order. Instead these values are ordered in bit-reversed
order.
Since the purpose of this program is to display the spectrum on the LCD, the
complex values in this vector must be rearranged in their normal order. This is
accomplished by the cbrev function. This function reorders the data and places the results
in another vector fft_out.
13. The vector fft_out contains the frequency domain values in interleaved Re-Im
format, as shown.
To graph these values in Code Composer, you should graph the real values and the
imaginary values separately.
In the Tools menu, choose Graph, then Single Time. Set the parameters as shown
in the new Figure. Since the real and imaginary values are interleaved, setting Index
Increment to 2 and Start Address to fft_out will graph only the real values.
Here we can see an example of the graph of the real values of the frequency-
domain information.
Recall that the time-domain representation of the waveform contained only real
values (all imaginary values were set to 0).
Describe the symmetry of the real values of the frequency-domain representation.
a................................................................................................................Th
e real values of the frequency-domain representation have even symmetry about
the Nyquist frequency
b................................................................................................................Th
e real values of the frequency-domain representation have odd symmetry about the
Nyquist frequency
76
c................................................................................................................Th
ere is no symmetry
Choose Answer:a
What frequency does this correspond to based on the frequency of the first
(leftmost) peak?
a. -250 Hz
b................................................................................................................25
0 Hz
c................................................................................................................20
0 Hz
Choose Answer:a
14. Display the Graph properties for this graph and set the Start Address to fft_out+1.
With Index Increment set to 2, this displays only the imaginary values Im X [ ].
Describe the symmetry of the imaginary values of the frequency-domain
representation.
a................................................................................................................Th
e real values of the frequency-domain representation have even symmetry about
the Nyquist frequency
b................................................................................................................Th
e real values of the frequency-domain representation have odd symmetry about the
Nyquist frequency
c................................................................................................................Th
ere is no symmetry
Choose Answer:b
15. Press the run button . The lines between //Breakpoint #02 and //Breakpoint #03
will be executed. The purpose of this application is to display the first 20 points of
the frequency magnitude spectrum on the LCD. This is calculated by the following
code:
77
The for loop initializes the variables i and j to 0.
Each pass of the loop takes two consecutive values from the vector fft_out and
squares them:
o The loop takes the value in fft_out[j] (a real value) and multiplies this value by
itself to obtain the square. The result is stored in the variable a. Then j is
incremented.
o The loop again takes the value in fft_out[j] (an imaginary value) and multiplies
this value by itself to obtain the square. The result is stored in the variable b.
Then j is incremented.
o The variables a and b are added together and stored in fft_out[i], overwriting
the original ith value of this vector. The loop then increments i and repeats.
When all 20 passes have been completed the first 20 values of fft_out each
contain the magnitude squared of a spectral point.
To graph the first 20 values of fft_out, Change the graph properties as shown.
16. Press the run button . The lines between //Breakpoint #03 and //Breakpoint #04
will be executed.
The function sqrt_16 acts on the first 20 values of fft_out, taking the square root of
each value and placing the result in the corresponding position of the vector root. After
this line has been executed, root contains a 20-point frequency magnitude spectrum.
Graph the first 20 values in root, using the Graph Properties shown here.The graph
should resemble our sample shown.
17. The for loop after //Breakpoint #04 uses the values in root to place the appropriate
block characters in the character arrays line3 and line4. These character arrays are
sent to the LCD using the function updateDisplay. The LCD displays the block
characters in lines 3 and 4 of the LDC in order to display a spectrum.
Press the run button . The for loop after //Breakpoint #04 will execute, and then
the LCD will be updated. (Execution will stop after //Breakpoint #01.)
Compare the graph of root with the spectrum displayed on the LCD.
78
Spectral Leakage
18. Clear all breakpoints and then press the run button . Set the frequency of the
generated sine wave to 1000 Hz (1000 0000b). Describe the spectrum on the LCD.
The spectrum has the following:
a................................................................................................................tw
o components in positions 2 (250 Hz) and 8 (1000 Hz)
b................................................................................................................one
component in position 8 (1000 Hz)
c................................................................................................................one
component in position 7 (875 Hz)
Choose Answer:b
How many periods of the sine wave signal waveform fit inside the time window?
a. Twin / T = 16 ms/1 ms = 16
b................................................................................................................Tw
in / T = 8 ms/10 ms = 0.8
c................................................................................................................Tw
79
in /T = 8 ms/1 ms = 8
Choose Answer:c
20. Clear all breakpoints and then press the run button . Set the frequency of the
generated sine wave to 1062.5 Hz (1000 1000b). Describe the spectrum on the
LCD.
a................................................................................................................Th
e spectrum has a strong component in position 8 (1000 Hz).
b................................................................................................................Th
e spectrum has a strong component in positions 8 (1000 Hz) and 9 (1125 Hz), as
well as tails to either side.
Choose Answer:b
Pause the program using the Halt button . Activate Breakpoint #02 and press the
Run button . Which two (2) sample graph sets more closely represent the two
frequency-domain graphs you observe in Code Composer.
a. and c.
b................................................................................................................and
c.
c................................................................................................................and
b.
Choose Answer:a
Optimization
21. Look at the two lines following //Breakpoint #01 in the main.c file. Referring to
the Discussion, what library functions are called in these two lines?
a................................................................................................................cfir
and cfft32
b................................................................................................................ciff
t and convol2
c................................................................................................................cfft
and cbrev
Choose Answer:c
The cbrev function bit-reverses the elements in a complex vector in order to place
the frequency-domain values in the normal order.
a. True
b................................................................................................................Fal
se
a
What is the advantage of using library functions for these operations, rather than
programming the functions from scratch?
a. Library functions are ready-to-use functions that can be that can considerably
shorten development time.
b................................................................................................................Lib
rary functions are highly optimized assembly language functions.
81
c................................................................................................................Lib
rary functions execute faster than functions programmed in a high-level language.
d................................................................................................................All
of the above
Choose Answer:d
22. Find the #pragma directives in the main.c file. The DATA_SECTION pragma
allocates space for a symbol in a section named section name. The syntax for the
DATA_SECTION pragma is as follows:
#pragma DATA_SECTION (symbol, “section name”) [;]
As was shown in previous tables in the Discussion, the input data for the library
functions cfft and cbrev must be aligned on a 32−bit (4-byte) boundary. This is
accomplished by the text align(4) in the definition of the section .input.
Is it important to respect requirements such as this?
a................................................................................................................Ye
s
b................................................................................................................No
Choose Answer:a
23. Look at the for loop after //Breakpoint #02 in the main.c file.
In this loop, certain functions are called whose names begin with an underscore.
Example: The functions _smpy and _sadd.
What types of functions are these?
a................................................................................................................co
mpiler intrinsics
b................................................................................................................inli
ne assembly
c................................................................................................................Ob
ject
Choose Answer:a
82
available
c................................................................................................................the
optimizer can expand them differently, align buffers, or make other adjustments
depending on the context and arguments of the call
d................................................................................................................All
of the above
Choose Answer:a
24. In the C/C++ Projects window of Code Composer, right-click on exercise_4_2 and
choose Properties.
In the Properties for exercise_4_2 window, click C/C++ Build.
In the list, under C5500 Compiler, click Basic Options. This shows, among other
things, the selected Optimization level.
What is the optimization level selected?
a................................................................................................................Op
timization level 1
b................................................................................................................Op
timization level 2
c................................................................................................................Op
timization level 3
d................................................................................................................Op
timization level 4
Choose Answer:c
3. In the DSP program, the DFT or FFT library function returns a vector containing a
series of numbers. What do these numbers represent?
a. The amplitude coefficients corresponding to each of the basis functions,
as calculated by the library function.
b. The frequency parameter
c. Both a. and b.
Choose Answer:c
84
b. using regular functions
c. using compiler intrinsics
d. selecting the appropriate compiler optimization options
e. using a hardware FFT accelerator built into the CPU of the DSP
Choose Answer:b
1. A compact audio disk (CD) contains audio signals that were sampled at a rate of 44
100 Hz. In theory, what is the highest frequency that can be encoded on a CD.
a. 88 200 Hz
b. 44 100 Hz
c. 22 050 Hz
d. 11 025 Hz
Choose Answer:c
85
5. Approximately how many steps are required to perform an N-point DFT using the
correlation method?
a. 2N
b. N/2 + 1
c. N2
d. N log2 N
Choose Answer:d
6. Approximately how many steps are required to perform an N-point FFT using the
correlation method?
a. 2N
b. N/2 + 1
c. N2
d. N log<sub>2</sub> N
Choose Answer:d
86
b. a frequency component lies between adjacent frequency bins.
c. the post filter is incorrectly adjusted.
d. too many basis functions are used.
Choose Answer:b
87
BÀI 5:
5.1. Signal Processing Applications: Fundamentals
o Signal Processing Applications
88
a. 15
b................................................................................................................63
c................................................................................................................31
d................................................................................................................5
Choose Answer:b
5. Press the run button to run the program on the board. At this point, you should
see the following information on the LCD of the DSP circuit board: LabVolt
91031 Ex5-1 / FIR Filter
89
1400 0.03 -22.5
8. Based on the graph obtained, the FIR filter used in this example is a what kind of
filter?
a................................................................................................................A
band-pass filter
b................................................................................................................A
high-pass filter
c................................................................................................................A
low-pass filter
Choose Answer:c
90
a................................................................................................................10
discrete coefficients are listed
b................................................................................................................No
coefficients are listed
c................................................................................................................5
coefficients are listed twice
Choose Answer:c
The coefficients are given in this order: b2, b1, b0, a2, and a1. They are written as
natural numbers but are used in Q31-format in the algorithm. Coefficient a0 is implicitly
taken to have a value of 1.
The transfer function of the filter used, sometimes known as a biquad, looks like
this:
The coefficients are repeated because the biquad transfer function is used twice (or
cascaded) to produce the final IIR filter.
What are the P and Q orders of a single instance of the transfer function?
a. P = 2 and Q = 2
b................................................................................................................P =
2 and Q = 1
c................................................................................................................P =
1 and Q = 2
Choose Answer:a
What are the orders for the complete IIR filter (two consecutive biquads)?
a. P = 2 and Q = 2
b................................................................................................................P =
4 and Q = 4
c................................................................................................................P =
4 and Q = 2
Choose Answer:b
13. Press the run button to run the program. At this point, you should see the
following information on the LCD of the DSP circuit board:
LabVolt 91031 Ex5-1b / IIR Filter
14. Use a signal generator to produce a sinusoidal waveform with an amplitude of 0.4
V and a frequency of 100 Hz. Observe both the input signal (Channel 1) and the
DSP output signal (Channel 2) on an oscilloscope.
15. Use the oscilloscope to measure the amplitude of the output signal (Channel 2) as a
91
function of the frequency of the input signal. Calculate the gain and fill in the
Table.
Observe both the input signal (Channel 1) and the DSP output signal (Channel 2)
on an oscilloscope.
Remember that the Gain = 20 ∙ log (Aout / Ain), where Ain = 0.4 V.
The system will plot a graph of the gain as a function of the frequency.
100 0.45 1
200 0.45 1
1300 0.16 -8
Based on the graph obtained, the IIR filter used in this example is a what kind of
filter?
92
a................................................................................................................A
band-pass filter
b................................................................................................................A
low-pass filter
c................................................................................................................A
high-pass filter
Choose Answer:b
2. Which of the following types of filters attenuates all signal frequencies below and
above a certain range?
a. Low-pass filter
b. Comb filter
c. Band-pass filter
d. High-pass filter
Choose Answer:c
93
3. A filter modifies the signal?
a. by applying a gain which is dependent upon the frequency.
b. by shifting the frequency contents of the signal to higher frequencies.
c. by shifting the frequency contents of the signal to lower frequencies.
d. All of the above
Choose Answer:a
4. Why are filters implemented on DSPs preferred over analog filtering circuits?
a. A digital circuit ensures reproducible results.
b. Analog filters do not exist.
c. DSP filters can be used on all types of signals.
d. All of the above
Choose Answer:a
2. DSPs are
a. based on the mathematical theory of digital signal processing.
b. a tool to implement the findings of digital signal processing theory.
c. ubiquitous in many aspects of modern life.
94
d. All of the above.
Choose Answer:d
95
96