LoopBack Application

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

Loop Back (or Pass Through) Application

The loop back or pass through application consists of sending an audio file
from a PC to the C6713 DSP via the analogue to digital converter (Codec)
and then getting it back through the digital to analogue converter (Codec).
Two peripherals of the C6713 DSP are used for this purpose; the Multichannel
Buffered Serial Port (MCBSP) and the Enhanced Direct Memory Access. This
application will be used as the basis for implementing a three band equalizer.
The implementation will be embedded between the receive side of the EDMA
(gBufferRcv) and the transmit side of the EDMA (gBufferXmt), using
hardware events.

Figure 1: Pass through application

Enhanced Direct Memory Access (EDMA)


The EDMA is a peripheral that can be set up to copy data from one location
to another without CPUs intervention. The EDMA can be set up to copy data
or a programme from a source (external/internal memory, or serial port) to a
destination (e.g. internal memory). After this transfer completes, the EDMA
can auto-initialise itself and perform the same transfer again, or it can be
reprogrammed. In the case of C6713 DSP, it includes 16 channels and is able
of storing parameters for 69 reload entries (for reprogramming the EDMA).

Multichannel Buffered Serial Port (MCBSP)


Multichannel buffered serial ports provide an interface to inexpensive
(industry standard) external peripherals. They have features such as full
duplex communication, independent clocking and framing for receiving and
transmitting, and direct interface to AC97 compliant device. It allows several
data sizes between 8 and 32 bits.

CODEC

Page 1

The available codec on the DSK 6713 board is the TLV320AIC23 (AIC23) 16bit stereo coder/decoder (CODEC) device. The CODEC interfaces to the 6713
DSP via the MCBSP serial interface.

Starting a new project


Lets start by creating a new project and adding some files to it. The files are
available from Blackboard. Click on: New File CCS Project
(Refer to the introductory lab Introduction to Code Composer Studio v5 for more
details on how to create a new project)

Figure 2: CCS Project Settings Window


Figure 2 provides all the necessary settings for the project. Under project
name, type LoopBack. Keep the output type as executable. Unless you
would like to change the default location, then check the use the default
location. Under Device, choose as Family the C6000 series of DSPs.
Under Variant, choose C671x
floating-point DSP, then pick the
TMS320C6713. Under Connection, choose Spectrum-Digital DSK-EVMeZdsp onboard USB Emulator. Keep the advanced settings
unchanged. We will change them at some points if there is a need for that.
Under Project Templates and Examples, click on Empty Project. Click
on the Finish button to save the settings.
Page 2

Your project explorer should look something like the one in figure 3. Make
sure to delete C6713.cmd if it has been automatically added to the project.

Figure 3: Project Explorer

Adding Files to the Project


Download the LoopBack.zip from Blackboard and extract it to your working
directory. Then, right click on the project name (LoopBack) in the Project
Explorer and click on Add Files to add the following files to your project:

Page 3

main.c
edma.c
codec.c
sine.c
mcbsp.c

At the end of this process, the project explorer should look like the one of
figure 4.

Figure 4: Project Explorer after Adding the Files

Target Configuration
The target configuration has been defined at the beginning when providing
all the settings for the project. The configuration can be modified by double
clicking on it. Otherwise, a new one can be created by the user. Check that
you have the right configuration by double clicking on your configuration file.
Make sure that DSK6713 is selected (See figure 5).
Page 4

Figure 5: Target Configuration Window

Creating a DSP/BIOS Configuration File


DSP/BIOS is a real time operating system created and offered by Texas
Instruments for use in a wide range of DSPs and microcontrollers. DSP/BIOS
provides a wide range of system services to an embedded application such
pre-emptive multitasking, memory management and real-time analysis
(Texas instruments wiki page).
To create a DSP/BIOS Configuration file, click on:
File New DSP/BIOS v5.x Configuration File
A window like the one shown in figure 6 will show up.

Page 5

Figure 6: DSP/BIOS Configuration


Then click on next and select ti.platforms.dsk6713 (as illustrated in figure 7),
which corresponds to the Dsk6713 (225 Mhz). Click on Finish to complete
the process.

Page 6

Figure 7: DSP/BIOS Configuration Platforms


In this application, a single feature of the DSP/BIOS will be used. Only one
object will be set up. It consists of linking the EDMA interrupt to its
corresponding interrupt service routine (ISR).

Adding the HWI to our System


How does the CPU know what to do when the interrupt occurs? Where does
execution go? We need to tell the CPU that when the EDMA interrupt occurs,
to run the interrupt service routine (ISR), edmaHwi(). The following steps will
accomplish this.
Open the TCF file and click the +sign next to scheduling, then click the +sign
next to HWI (figure 8). A list of hardware interrupts will appear. Hardware
interrupt #8 (HWI_INT8) is the EDMA interrupt to the CPU (by default). Right
click HWI_INT8 and select Properties. Change the function name to
_edmaHwi (figure 9). The hardware interrupt vector table is written in
assembly, so the underscore is required to access the C function, edmaHwi().

Page 7

Figure 8: Interrupt Configuration

Figure 9: Interrupt properties Interrupt Source


Use the dispatcher. Click on the dispatcher tab and check Use
Dispatcher checkbox. The hardware interrupt dispatcher will do some
housekeeping for us by saving/restoring the context when processing the
ISR. Close and Save.

Page 8

Figure 9: Interrupt properties Dispatcher

Chip Support Library


The Chip Support Library (CSL) provides a C-language interface for
configuring and controlling on-chip peripherals. It consists of discrete
modules that are built and archived into a library file. Each module relates to
a single peripheral, with the exception of several modules that provide
general programming support, such as the interrupt request (IRQ) module
which contains APIs for interrupt management, and the CHIP module which
allows the global setting of the chip.
The CSLs beneficial features include peripheral ease of use, shortened
development time, portability, hardware abstraction, and a level of
standardisation and compatibility among devices. Specifically, the CSL offers:
Standard Protocol-to-Program Peripherals
The CSL provides a standard protocol for programming the on-chip
peripherals. This includes data types and macros to define a peripherals
configuration, and functions to implement the various operations of each
peripheral.
Basic Resource Management
Basic resource management is provided through the use of open and close
functions for many of the peripherals. This is especially helpful for
peripherals that support multiple channels.
Symbolic Peripheral Descriptions
As a side benefit to the creation of the CSL, a complete symbolic description
of all peripheral registers and register fields has been created. You will find it
advantageous to use the higher-level protocols described in the first two
benefits because these are less device-specific, thus making it easier to
migrate your code to newer versions of TI DSPs.
CSL is not automatically installed with CCS v5. The user has to install it
manually. The library can be downloaded from Texas Instruments website at
http://www.ti.com/tool/sprc090. Under windows, it can be installed in the
Page 9

directory C:\Program Files\C6xCSL. This directory will be adopted through this


document.

Setting up CSL
Initially, some changes have to be made in order to use CSL. To get the
project working, the search path for CSL header files has to be manually
added. To do so, right click on the project name and select properties
(alternatively, from the menu, select Project Properties). Under C6000
Compiler, choose Include Options and click on the green + sign
to add the C:\Program Files\C6xCSL\include.

Figure 10: Project Properties C6000 Compiler Option

Figure 11: Add Directory Window CSL header files

We will take the opportunity to add some other header files that required by
the project. The path represents a working directory. In figure 12, it is
pointing to my working directory.
Page 10

Figure 12: Add Directory Window Other header files

When the process is completed, the Project Properties window should look
like the one of figure 13.

Figure 13: Project Properties after Modifications

CSL will also need to know what DSP platform is to be used. This can be
specified in the Project Properties window (figure 10) by selecting
Predefined Symbols and then clicking on the green + sign
name of the chip CHIP_6713.

. Add the

To add the CSL6713 library to the runtime environment, you will have to
select C6000 Linker and then File Search Path. At the bottom, add the
path to the library and at the the top add the library itself csl6713.lib as
illustrated in figure 14.

Page 11

Figure 14: Project Properties C6000 Linker Option

Build and Run

Build the project, debug, and load it to the DSK.

Run to main(). Run Go Main

Run Code. You should hear audio playing from your headphones. If there
is any distortion, adjust the volume level on your PC. If you get noise, go
back and debug your code. Follow the data from the input/receive side to
the output/transmit side.

Halt the Processor. Alter halting; do you continue to hear an annoying


buzzing sound? Even though the CPU is halted, we configured the McBSP
and EDMA to keep running. Since the output buffers are not being updated
by the CPU anymore, they keep outputting the same sample chunks over
and over again.

Page 12

You might also like