Lab4: Introduction To DSP Kit TMS 320C6713 DSK: EE-330 Digital Signal Processing
Lab4: Introduction To DSP Kit TMS 320C6713 DSK: EE-330 Digital Signal Processing
Latif________________
Lab4
Objectives
The objective of this lab is to introduce the DSP Starter Kit C6713
The DSK also has four user-programmable DIP switches and four LEDs that can be used to control and
monitor programs running on the DSP. All features of the DSK are managed by the CCS, which is a
complete integrated development environment (IDE) that includes an optimizing C/C++ compiler,
assembler, linker, debugger, and program loader. The CCS communicates with the DSK via a USB
connection to a PC. In addition to facilitating all programming aspects of the C6713 DSP, the CCS can
also read signals stored on the DSP’s memory, or the SDRAM, and plot them in the time or frequency
domains.
1.2 Warmup
1.2.1 QUICK TESTS OF THE DSK ( ON POWER ON AND USING CCS )
Connect the USB cable from the DSK6713 to the computer and then connect power to the DSK6713. If
this is the first time the DSK has been connected to the computer, you may see Windows install the
device driver software:
You can also check that the DSK is recognized by going into the Device Manager and looking for "SD
USB Based Debug Tools". You should see a "Spectrum Digital TMS320C6713 DSK" listed as a correctly
installed device. If not, then CCS v6 has probably not been installed correctly.
Now start CCS v6 by double-clicking on the desktop icon (or navigating through the start menu). You
may be prompted to select a workspace. If so, choose a directory that you would like to use as your
workspace and click "OK". If the TI Resource Explorer window comes up, just close it. Eventually, you
should get to the main CCS v6 window, which should look something like this
This is the "normal" edit view of CCS v6 where you will manage projects, build and debug your code,
and interact with the DSK. Since this is the first time we are using CCS v6, we must set up a "target
configuration" for the DSK6713.
From the normal view of CCS v6, click on "Window->Show View->Target Configurations" to expose the
target configurations panel.
When you first use CCS v6, there won't be any target configurations. So we will set one up for the
You can name the new target configuration anything you want, but it is a good idea to pick something
descriptive. I've named the target configuration DSK6713.ccxml (the extension will be added
automatically) and stored it in the default shared location. Click "Finish".
A new panel should appear where you set some options for this DSK6713.ccxml target configuration. In
the connection pull down menu, select "Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator". In
the device selector, select "DSK6713"
Click "Save".
If you get an error, then either CCS v6 wasn't installed correctly or you haven't set up the target
configuration correctly.
Now click on "Run->Connect Target" (or press Ctrl+Alt+C). You should then see a window something
like this The message "GEL StartUp Complete" in the Console means that CCS v6 is successfully talking
with the DSK.
1.2.2 Sine Wave Generation Using Eight Points with DIP Switch Control (
sine8_LED )
This example generates a sinusoidal analog output waveform using a table – lookup method. More
importantly, it illustrates some of the features of CCS for editing source files, building a project,
accessing the code generation tools, and running a program on the C6713 processor. The C source file
sine8_LED.c listed in Figure 1.2 is included in the folder sine8_LED .
The program statement while(1) within the function main() creates an infinite loop. Within that loop, the
state of DIP switch #0 is tested and if it is pressed down, LED #0 is switched on and a sample from the
lookup table is output. If DIP switch #0 is not pressed down then LED #0 is switched off. As long as DIP
switch #0 is pressed down, sample values read from the array sine_table will be output and a sinusoidal
FIGURE 1.2. Sine wave generation program using eight points with DIP switch control ( sine8_LED.c ).
Each time the function output_left_sample() , defined in source file C6713dskinit.c , is called to output a
sample value, it waits until the codec, initialized by the function comm_poll() to output samples at a rate
of 8 kHz, is ready for the next sample. In this way, once DIP switch #0 has been pressed down it will be
tested at a rate of 8 kHz. The sampling rate at which the codec operates is set by the program statement
Uint32 fs = DSK6713_AIC23_FREQ_8KHZ;
One cycle of the sinusoidal analog output waveform corresponds to eight output samples and hence the
frequency of the sinusoidal analog output waveform is equal to the codec sampling rate (8 kHz) divided
by eight, that is, 1 kHz.
These steps assume that you have correctly installed and configured CCS v6. You should be able to
connect to the DSK and see something like the following window before proceeding.
Click on "File->New->CCS Project". If this is the first time using CCS v6, you may have to click "File-
>New->Other" and then select CCS project. The following window should appear and set values
according to figure.
You might have some other panels visible, but the Project Explorer panel should show the sin8_LED
project as "Active" and should show the C6713.cmd file.
So far, we just have an empty project container with no code. Now you can copy or move sin8_LED.c a,
vectors_poll.asm and c6713dskinit.c into your project directory using Project->add files option.these
files are available on SSC/LMS.Here is what CCS v6 should look like after it recognizes that you moved
the two source files into the project directory.
Part 4: Tell CCS v6 where to find the necessary header files and libraries
If we try to build the project now, we will get some errors because (among other things) CCS v6 doesn't
know how to find the CSL and BSL header files and libraries. We'll first tell CCS v6 where to find the
header files. Click on "Project->Properties". Drill down to "Build / C6000 Compiler / Include Options" in
the left sidebar:
C:\ti\Support
C:\ti\DSK6713\DSK6713\c6000\dsk6713\include
C:\ti\C6xCSL\include.
We now need to tell CCS v6 to include the CSL and BSL library files in the project. Drill down to
"Build / C6000 Linker / File Search Path" in the left sidebar:
Press the button with the green plus sign to add the CSL library
Usually, the CSL library is in C:\ti\C6xCSL\lib_3x\csl6713.lib. Click "OK".
Press the button with the green plus sign to add the BSL library
Usually, the BSL library is in C:\ti\DSK6713\c6000\dsk6713\lib\dsk6713bsl.lib. Click "OK".
Part 5: Tell CCS what to use for stack and heap sizes
You could now compile the project, but you would get some warnings about not explicitly setting the
stack and heap sizes (CCS v6 will just go with some default values). We would like to get rid of these
warnings. To do this, drill down to "Build / C6000 Linker / Basic Options" in the left sidebar and put in
values of 0x400 for stack size and 0x400 for heap size
There is still one more thing to fix before CCS v6 will cleanly compile the project. Drill down to "Build /
C6000 Compiler / Advanced Options / Runtime Model Options" in the left sidebar and set the "Constant
While the project will compile with the current settings, the compiler will not use instructions optimized
for the TMS320C6713 chip unless we tell it to do so. Drill down to "Build / C6000 Compiler / Processor
Options" in the left sidebar and set the "Target processor version" to "6713" (no quotes):
Now click "OK".
Drill down to "Build / C6000 Compiler / Advance options/predefined symbols" and press the button with
the green plus sign add type in CHIP_6713 and press OK as show in figure below
If you've followed all of the steps above, you should be able to build the project without errors or
warnings. Click on the hammer button or "Project->Build All". You should see something like this:
Now click the green bug icon (this launches the debugger). This will cause the executable output of the
build to be loaded onto the DSK and put the instruction pointer of the DSP at the start of your code. You
may be asked to terminate an existing debug session. If so, click "Yes". You may also see some USB
enumeration as CCS connects with the DSK. After a few seconds, you should see something like this
upon entering the debugger:
2. Change the number of samples stored in the lookup table to four. By changing the lines that read
#define LOOPLENGTH 8
short sine_table[LOOPLENGTH]={0,707,1000,707,0, - 707, - 1000,- 707,0};
to read
#define LOOPLENGTH 4
short sine_table[LOOPLENGTH]={0,1000,0, - 1000};
Verify that the frequency of the sinusoid generated is 2 kHz (assuming an 8-kHz sampling
frequency).Remember that the sinusoid is no longer generated if the DIP switch #0 is not pressed down.
A)
void main()
{
comm_poll(); //init DSK,codec,McBSP
DSK6713_LED_init(); //init LED from BSL
DSK6713_DIP_init(); //init DIP from BSL
while(1) //infinite loop
{
if(DSK6713_DIP_get(1)==0) //=0 if DIP switch #0 pressed
{
DSK6713_LED_on(); //turn LED #0 ON
output_left_sample(sine_table[loopindex++]*gain); //output sample
if (loopindex >= LOOPLENGTH) loopindex = 0; //reset table index
}
else DSK6713_LED_off(0); //turn LED off if not pressed
// *************************************************************
}
//end of while(1) infinite loop
Conclusion:
In this lab we learnt how to play an audio signal using DSP Kit TMS
320C6713 DSK. We learnt how to add different header files in our code.
We also used the DIPs on the kit to turn on different LEDS and tune the
audio signal.