Anda di halaman 1dari 5

Applied Signal Processing

Texas Instrument DSP Starter Kit 6711DSK


A Brief introduction
Tomas McKelvey
2003, 2004, 2005

1 Introduction
The purpose of this documentation is to give a very brief overview of the structure of
the 6711DSK. Included is also a mini tutorial on how to program the DSP, download
programs and debug it using the Code Composer Studio software.

2 The DSP starter kit


The Texas Instrument 6711DSK is a DSP starter kit for the TMS320C6711 DSP chip.
The kit contains:

• An emulator board which contains:

– DSP chip, memory and control circuitry.


– Input/output capabilities in the form of
∗ An audio codec (ADC and DAC) which provides 1 input and 1 output
channel sampled at 8 kHz.
∗ Digital inputs and outputs
∗ A connector for adding external evaluation modules, like the PCM3003
Audio daughter card which has 2 analog in and 2 analog out sampled at
48 kHz.
– A parallel port for interface to a host computer used for program development,
program download and debugging.

• The Code Composer Studio (CCS) software which is an integrated development


environment (IDE) for editing programs, compiling, linking, download to target
(i.e., to the DSK board) and debugging. The CCS also includes the DSP/BIOS
real-time operating system. The DSP/BIOS code considerably simplifies the code
development for real-time applications which include interrupt driven and time
scheduled tasks.

1
3 Usage overview
Working with the DSK involves the following steps:
• The first step is the algorithm development and programming in C/C++ or as-
sembler. We will only consider coding in C in this document. The program is
typed using the editor capabilities of the CCS. Also the DSP/BIOS configuration
is performed in a special configuration window.
• When the code is finished it is time to compile and link the different code parts
together. This is all done automatically in CCS after pressing the Build button. If
the compilation and linking succeeded the finished program is downloaded to the
DSK board.
• The operation of DSK board can be controlled using CCS, i.e., CCS also works as
a debugger. The program can be started and stopped and single-step. Variables in
the program can be inspected with the “Watch” functionality. Breakpoints can be
inserted in the code.

4 Getting started with the 6711DSK and CCS


In this section you will be introduced to the programming environment and will download
and execute a simple program on the DSK.

4.1 Connecting the PC and DSK


The DSK is communicating with the host PC using the parallel-port interface.

1. Start Code Composer Studio (CCS) by clicking on the “CCStudio 3.01” icon on
the workspace.
2. Check that the DSK is powered up. If not, power up the DSK by inserting the
AC power cable (mains) to the black AC/DC converter. Note: Never unplug the
power cable from the DSK card.
3. Make a connection between CCS and the DSK by selecting menu command
Debug→Connect. If connection fails perform following steps:
(a) Select menu command Debug→Reset Emulator
(b) Power cycle the DSK by removing the AC power cord from the AC/DC con-
verter, wait about a second and then reinsert.
(c) Select menu command Debug→Connect.

4.2 Getting familiar with CCS


CCS arranges its operation around a project and the “Project view” window is displayed
to the left. Here you can find all files which are related to a certain project. At the
bottom of the CCS window is the status output view in which status information will be
displayed such as compile or link errors as well as other types of information. Note that
the window will have several tabs for different types of output.

2
4.3 Loading programs from CCS
One setting might need to be changed in CCS in order to automatically download the
program after compilation and linking (a build). You find the setting under menu
command Options→Customize and tab Program Load Options. Tick the box Load
Program After Build

4.3.1 Project view and building an application


You open an existing project by right-clicking on the project folder and select the desired
“.pjt” file or select the command from the menu Project→Open....

• Open the project “intro.pjt” which you find in the “intro”folder.

• Press the “+” sign to expand the view. Several folders appear which contain all
the project specific files.

• Open up the Source folder. Here you will find all the files with source code which
belongs to the project.

• Double click on the “intro.c” file to open up an editor window with the file “intro.c”
file loaded.

• Look around in the file. The code calculates the inner product between two integer
vectors of length “COUNT” by calling the function “dotp” and then prints the
result using the “LOG printf” command.

• Compile, link and download the code selecting the Project→Build command or
use the associated button. If the download fails. Power cycle the DSK and retry
Project→Build.

4.3.2 Running the code


After a successful build command (compile,link and download) the program is now res-
ident in the DSK and ready for execution. A disassembly window will appear showing
the Assembly language instructions produced by the compiler. You can minimize the
window for now. At the bottom left you will see the status “CPU HALTED” indicating
that the CPU is not executing any code.
A few options are available depending on if you want to debug or just run the code.
To simply run the code do:

• Select Debug→Run to start the execution. At the bottom left you will see the status
“CPU RUNNING” indicating that the program is executed.

• To stop the DSP select Debug→Halt.

• If you want the restart the program do Debug→Restart followed by Debug→Run

Try to run the code in the intro project. To see the output from the LOG printf com-
mands you must enable the view of the Message Log Window. Do DSP/BIOS→Message
Log and select LOG0 in the pull-down menu.

3
4.3.3 CCS Debug
Single stepping For debugging the code do the following:

• Select Debug→Go Main. This will run DSP/BIOS part of the code until the start
of the “main” function. A yellow arrow will appear to the left of the start of the
“main” function in the edit window for the “intro.c” file. The arrow indicates where
the program execution has halted.

• Now you can step the code one line at the time. Three commands are available:

– Debug→Step Into will execute the marked line if it is composed of simple


instructions or if the line has a function call, will step in to the called function.
– Debug→Step Over will execute the marked line and step to the next line.
– Debug→Step Out will conclude the execution of the present function and halt
the execution at the next line of the calling function.

Try to step through the code using the step functions.

View variables If you want to know the value of a particular variable just put the
cursor on top of the variable in the source window. The value will after a short delay
pop up next to the variable. Note that local variables in functions only have defined
values when the execution is located inside the function. Variables can also be added to
the “Watch window” which enables a concurrent view of several variables. Mark the “y”
variable in source code, right-click and select Add to Watch Window. The watch window
will then add variable “y” to the view and show its contents. Also add the “a” variable
(which is a array) to the watch window. Since “a” is an array the value of “a” is an
address. Click on the “+”. This will show the individual values of the array. The watch
window will update its contents whenever the DSP is halted. It is also possible to change
the value of a variable in the DSK from the Watch window. Simply select the numerical
value you want to change and type in a new value. CCS will send the new value to the
DSK before starting the execution.

Break points Break points can also be used to halt the execution at a particular point
in the source code. To illustrate its use consider the “intro”. Place the cursor at the
line which has the “return(sum);” instruction in the “dotp” function. Right-click and
select Toggle breakpoint. A red dot will appear at that line indicating that a break
point is set at that line. Try it out. First do Debug→Restart and then Debug→Run The
execution will halt at the line and we can investigate variables etc. To resume execution
simply issue Debug→Run command again.

Shortcut buttons CCS offers a number of shortcut buttons both for the build process
as well as the debugging. Browse around with the mouse pointer to find them. The
balloon help function will show what command a particular button is associated with,
i.e., move the mouse pointer over a button and wait for the balloon help to show up.

4
Loading the values in a vector into Matlab In the Lab you will need to load the
coefficients of a FIR filter into Matlab for further analysis. The filter coefficients are
stored in vectors. Use the following procedure:

1. Run the your DSP program on the DSK.

2. Halt the execution when it is time to upload the vector.

3. In the File menu you find File→Data→Save In the file dialog assign a name to
the data file and select ”Float” as ”Save as type”.

4. In the next dialog enter the name of the vector in the address field. When you tab
away from it it will change to the absolute memory address of the vector. In the
length box you enter the length of the variable. Note that you need to remove the
0x prefix if you give the length using decimals numbers. The notation with 0x in
the beginning indicates that the number is a Hexadecimal number, i.e. it is based
on a base of 16 instead of the normal base of 10 in the decimal system.

5. Open the file in an editor and remove the first line and save again

6. In Matlab use the ”load” command to load the saved file. The vector will get the
same name as the file name without the extension.

5 Debugging - limitations
The debugging features of the CCS is very handy during the code development. However,
several limitations are present.

• Since the compiler will optimize the code, all lines in the C-code cannot be used as
breakpoints. Since the architecture has several parallel processing units the final
code might execute several lines of C in one clock cycle.

• The processor also has memory cache which speeds up normal operations. This
means that when the DSP loads a particular memory location it will copy it into
the cache memory and then perform the operations (faster) using the cache. After
some time the cache will be written back again to the memory. This can sometimes
confuse CCS and variables in the Watch window can be erroneous.

• The third important issue is when debugging code which is dependent on external
events, e.g., interrupt driven code. When halting such a code by a break point
several features are important to consider. Firstly, since the code is stopped all
real-time deadlines will be broken so future sampled inputs will be lost. Hence a
restart from the point of the break might cause unpredicted behavior.

• Sometimes the code in the DSK which communicates with the CCS stops working.
When this happens it is necessary to power cycle, the DSK board in order to restart
the operation. Sometimes it is also necessary at the same time to restart CCS.