Summary: This module is a primer for the hardware and software to write, debug, and run DSP programs on the TI C6211 DSP Starter Kit (DSK) board.
This module introduces you to the hardware and software tools that you use to write, debug, and test real-time DSP programs on the TI C6211 DSP Starter Kit (DSK) board. You will compile, run, and debug a C program to try various functions of the development tool Code Composer Studio. In this module, we use a C program only for convenience. You can assemble and run assembly programs in the same way.
Each lab PC is equipped with a Texas Instrument TMS320C6211 DSK board. The DSK board is hooked to the parallel port of the PC running Windows 2000; the PC can control the DSK via the development environment called “Code Composer Studio” (CCS) developed by Texas Instrument. Currently we use CCS version 2.x. If you have your owlnet account, create the Samba password to log in to the machines.
For analog signal input and output, the DSK board has a PCM3003 codec daughtercard mounted on the board. This board provides 16 bit stereo analog input and output channels at maximum sampling rate of 48kHz. Currently, the jumpers on the board are configured to provide a fixed 48kHz sampling rate both for input and output. Do not change the jumper settings unless you know what you are doing. For variable sampling rates, the timers of the C6211 processor can be used to generate appropriate clock signal. You will learn how to use the CPU timers in (Reference).
Each lab station is equipped with a function generator to provide signal to be used to test your signal-processing algorithms and an oscilloscope to display the processed waveforms.
The source analog signal also can be generated using the soundcard of the PC and input to the DSK board for processing. There are two shareware softwares installed on each PC that enables you to use the sound card as a signal generator and a simple spectrum analyzer. In the lab experiments, you will be using the signal generator to generate white noise input to the DSK board and you can watch the spectrum of the DSK output using the soundcard spectrum analyzer.
The TI DSK board is connected to the parallel port of the PC. The board requires external power supply to be connected to it. A speaker and microphone can be connected to the board via the two 3.5mm jacks mounted on the daughtercard that are connected to the PCM3003 codec. The hardware reset button (white) is on the DSK board to enable hardware reset of the board. When reset the board goes through several steps of self testing and initialization. Please refer to the online help of the Code Composer Studio for detailed board operation. After each hardware reset, the DSK board tends to lose the connection with the host PC. Therefore, you should close the CCS before performing hardware reset. Be sure to save all the files before closing the CCS. After the DSK board finishes the reset, start the CCS again.
Be careful when you handle cables, tools, etc, not to short any circuits on the board.
Before the initial use of CCS, you must configure it so that it correctly connects to our C6211 DSK board. Once you configure it correctly, your configuration is saved as default and CCS will bring up the saved default configuration every time you start CCS.
Run the CCS configuration tool for configuration. You first need to choose C6211 DSK as the processor and then you can choose the type of serial port to which the DSK is connected. Make sure you do not run your code on a simulator. For any code that does not use the I/O on the board, the code would run exactly same way on the simulator as it would on the real DSK board.
When the DSK board is connected to the host PC and the power is on, you can run a self test to check if everything works fine. Simply run C:\ti\c60OO\dsk6x11\conftest\dsk6xtst.exe from the command prompt. The test checks all the functions of the board and report errors, if any. When you are in doubt about the proper functioning of the DSK, it is a good idea to run the self-confidence test to make sure it passes without any error.
If the board fails the test, unplug the power plug to the DSK for several seconds and plug it again, then run the test again. The DSK board sometimes does not reset all the circuits properly when the power is turned on.
The DSK board is controlled by the host PC via the parallel port connection, using the application Code Composer Studio (CCS). The CCS allows the user to download and run the assembled/compiled code. The CCS also provides environment for C/assembly code development, compilation, and debugging. Begin by working through the steps below to familiarize yourself with the programming and debugging environment of real-time systems.
In this part of the lab, you will be using the Code Composer Studio to load example source files, build (compile and link) them, download the code to DSK board, and then execute it. Follow the step-by-step instructions, typing in the commands as they appear below.
1 #define A_ARRAY 1,2,3,4,5,6,7,8,9,10
2 #define X_ARRAY 256,255,254,253,252,251,250,249,248,247
.obj files are stored and the Output Filename under Linker option to change the directory and filename of the output executable files (.out files). By default, the object and executable files are stored in a subdirectory named DEBUG under your working directory. For detailed explanation of the options, please refer to the online help of Code Composer.
Labl.out);
PROJECT:REBUILD ALL
(You can also use the REBUILD ALL toolbar icon.)
lab1.out) by doing:
FILE: LOAD PROGRAM… (if, for some reason, you have to quit the Code Composer before completing this lab, load the project (labl.prj) before loading the executable.)
stdout window of the Code Composer?
main() function. (more precisely, it is the initialization routine right before the main() function). In assembly, you can specify the entry point to be an address defined in your assembly program when you set the assembler options. Therefore, to restart your program from the beginning, you have to Restart and then Run.
main() function and runs the CPU. The execution will halt at the breakpoint. This could be a convenient way to set the PCI at the main() entry point of a C program. However, if the current PC is at a wrong place, the CPU may execute meaningless code, resulting in undesired result. For this reason, we do not recommend using Go Main in this course.
Now it’s time to verify if it is logically correct. This section describes how you can watch the contents of variables or set breakpoints and step through the code.
The CCS has the functionality to watch the contents of variables used in your code. Open the watch window by doing: VIEW:WATCH WINDOW The watch window can be docked to the bottom or side of the Code Composer window or it can float anywhere in the window. Right-click in the window to see the options. Place it however you prefer.
i, m[i], n[i], product, sum
Each variable will correspond to different rows in the watch window. To add each variable, click the Name column of the blank row.You can also change the display method of the variables. Click the Radix column of each variable to change to display method.
Note that the watch window does not update the variable values until the CPU finishes the execution and halts. Because
DEBUG:RESTART to set the PC at the beginning of the code. DEBUG:StepInto or F8 or click the toolbar icon.DEBUG:RUN or F5 or click the toolbar icon.DEBUG:HALT or shift-F5 or click the toolbar icon.DEBUG:RESTART to set the PC at the beginning of the code.dotp function by placing the cursor at the desired line and right-clicking and then choosing the toggle breakpoint in the menu.Watch Locals tab under the watch window, you can watch all the local variables. You do not need to add the local variables. All of them are displayed automatically.Although you can see how the contents of variables change by single-stepping the code, it can take a long time to execute all the code. On the other hand, when running the code, you cannot watch the variables updated on the fly. The "animate” feature solves this problem.
The animate feature requires you to set a breakpoint. When it reaches this breakpoint, code execution stops long enough to update the display and then resumes execution automatically.
DEBUG:RESTART to set the PC at the beginning of the code.dotp subroutine: Open lab1.c and search scroll down to the dotp function.
Click on the statement product=m[i]+n[i]; Right-click to TOGGLE BREAK PT on the line that contains the cursor (Rather than right-clicking, you can also use the toolbar icon.)DEBUG:ANIMATE or F12 or click the toolbar icon.main() function, it goes into running the exit routine. Go ahead and HALT the processor.
Code Composer Studio has the capability of benchmarking your code, meaning that you can analyze how long your code takes to execute. In the following example, you will be analyzing how long it takes to execute each call of the dotp() function.
One way of benchmarking your code is to set two breakpoints. When you run the program, the breakpoints will tell the debugger to stop execution. A clock-cycle counter, built into the debugger, can be used to count the number of cycles between these breakpoints.
DEBUG:RESTART to set the PC at the beginning of the code.PROFILER:START NEW SESSION... with session name of your choice.lab1.c file in the Project View to view the file. Place the cursor on any line inside the dotp() function and right click. Choose Profile Fimction -> in (session-name) Session, where (session—name) identifies the profiling session you created.DEBUG:RUN.Functions tab of the profiling window to see the result of the profiling of the dotp() function.dotp() function gathered by CCS while executing the code.Profiler:Viewing Profile Data by choosing the Help:Contents menu on the CCS menu bar.dotp() function?The DSK board is sometimes temperamental. If there is no output, try the following (from less to more drastic):
DEBUG:RESET CPU, reload the coder and restart the code.However, when you reset (software or hardware), the host PC tends to lose the connection to the DSK board. If this happens, you need to quit and restart the Code Composer Studio.
If you encounter problems that result in your code not loading correctly, or any software reset not working properly, close the Code Composer Studio and unplug the DSK. If problems persist after unplugging the DSP and plugging it back in, verify that the DSK board is functioning properly by executing known good code. If you try all of these steps and the DSK board is still not functioning, contact a TA to ask for assistance.
In my experience, these are some of the things you can do to screw up either the DSK, CCS, or the connection between the host PC and DSK:
Run command without properly setting the program counter first. If the PC happened to be at an improper address, the CPU starts executing some garbage, eventually doing some weird things. It is always a good idea to issue Restart before issuing the Run command.Using the signal generator and spectrum analyzer softwares installed on each PC, you can use the PC sound card as a signal generator/analyzer.
play.exe). Generate different signals at different frequencies. You will be able to hear the generated signal through the internal speaker of the PC.File -> Scan Input) and view the spectrum of the signal. scroll, line, bar). What do the display represent? Can you estimate the frequency of the generated sine wave from the displayed spectrum?You can use MATLAB to generate any arbitrary sound through the soundcard. The matlab function sound plays a MATLAB vector as sound using the sound card. It can also play stereo sound, too. For example, you can record a sound file in the .wav format using a windows utility through a microphone connected to the soundcard. Then, you can read in the .wav file into matlab using the matlab function wavread. Then, you can play the sound over and over again to use MATLAB as a very flexible sound source.
These references are available on your lab stations or on TI web page: