Implementation Techniques for DSP

Total Page:16

File Type:pdf, Size:1020Kb

Implementation Techniques for DSP

Implementation Techniques for DSP 1

Implementation Techniques for DSP

Part 1: Development Tools (3 hours) Part 2: FFT Implementation (6 hours)

Introduction

The laboratory exercises presented in this handout will help you put into practice most of the material covered in the DSP implementation module and in particular the use of the Code Composer Studio (CCS) which comprises of the compiler, assembler, linear assembler, linker and simulator. You are also required in Part to implement and FFT algorithm and produce a full report.

Equipment required

Hardware

 PC with Windows NT  DSP Starter Kit – DSK6211 DSP Platform1  Power supply  Parallel port cable  Signal generator  Oscilloscope

Software

 CCS software development tools (compiler, assembly, linear assembly, linker)  See directory p:\courses\ naim\fft

1 Naim Dahnoun 2001 (email: [email protected]) Implementation Techniques for DSP 2

1. Part 1: Development Tools (Using the code generation tools)

1.1 Objective In this section use the program FFTlab.c to get familiar with compiling, assembling, linking and debugging.

1.2 Background

The CCS consists of the following modules: The C-compiler, assembler, linker, simulator and the debugger. If the source code is written in C language, the code should be compiled using the Optimising C Compiler provided by Texas Instruments [SPRU187]. This compiler will translate the C source code into an assembly code. The assembly code generated by either the programmer, the compiler or the linear assembler is then passed through the assembler that translates the code into object code. The resultant object file(s), any library code and a command file are all combined by the linker which produces a single executable file, see Figure 1. The command file mainly provides the target hardware information to the linker.

file_n.sa File_n.asm FILE_n.c File_2.asm file_2.sa FILE_2.c Command file file_1.sa File_1.asm FILE_1.c file.cmd

C Compiler

Assembler

Linker

Simulator DSK EVM Hex Converter

EPROM

Target Hardware

Figure 1 Development tools Implementation Techniques for DSP 3

1.3 using the Code Composer Studio, CCS

The CCS is similar to other Integrated Design Environments (IDE) such as those produced by Microsoft and Borland. Before editing a file(s), compiling, assembling, linking, running and debugging you need to do the following:

A. Create a new project (see Figure 2) Project:New The project information is stored in the .mak file

Figure 2: Creating a new project

B. Set the project options Project:Options The project options control the options for the compiler, assembler and linker.

B.1 Compiler options Implementation Techniques for DSP 4

Figure 3 shows the property sheet where the compiler options are entered and Table 1 shows the options used in this lab.

Figure 3: Compiler options tab

Option Description -g Enables source level debugging -s Creates an interlist file -o3 Highest optimisation level

Table 1: Compiler options used in this lab

B. 2 Assembler options Table 2 shows the options used in this laboratory

Option Description -g Similar to the compiler option -g -l Creates a list file -s Makes all symbols appear as global Implementation Techniques for DSP 5

Table 2: Assembler options used in this laboratory

B. 3 Linker options Table 3 shows the linker options used in this laboratory

Option Description -o Specifies the output file (filename.out) -m Specifies the memory map file (filename.map)

Table 3: Compiler options used in this lab

1.4 Starting the experiment

1 Copy all the files in p:\course\naim\fft to your working directory.

2 Setup the hardware by: (a) Connect the DSK to the PC and connect the power supply (b) Push the reset button on the DSK (c) Open the CCS

2 Create a new project (call it fftlab.mak)

3 Set the compiler, assembler and linker options as shown in Tables 1, 2 and 3

4 Add the files to the project (Project:Add Files) as shown in Figure 3

5 Set CCS to automatically load the executable file (.out) after every build operation by selecting Option:Program Load and ticking the “Load Program after Build” option

6 Build the executable file. To do this either by (a) Select Project:Rebuild All (b) Or use the Rebuild All toolbar icon

7 Run to the main function by selecting Debug:Go Main

8 Follow the instructions of the demonstrator Implementation Techniques for DSP 6 Implementation Techniques for DSP 7

3. Part 2: FFT Implementation

3. 1 Introduction

The Fourier transform is a fundamental tool for spectral analysis. The combination of existence of fast calculation algorithms and high speed and low cost processors has led to a vast diversity of applications which span from high performance spectrum analysis to simple gadgets.

3.2 iObjective of the experiment

During the next two laboratory sessions, you are required to implement an FFT algorithm of your choice on the TMS320C6211 DSP processor. The code should initially be written in C language and if time allows!, you can implement part of the code in assembly. You are also required to produce a formal report describing your FFT algorithm, the implementation issues and finally discuss your results.

Steps to follow

1- Write the FFT algorithm in C and test its functionality using any C compiler. To make the debugging simple, create an input data structure and limit your number of FFT points to 16 (make your FFT length parameter a variable that you can change).

2- Once your FFT algorithm is fully tested and functional do the necessary modifications for porting the C code to the TMS320C6211 platform. At this stage you can use the Code Composer studio with the DSK6211 to debug and test your code (see Part 1).

3- Once step 2 is successfully completed, you can move on to the real-time implementation. Due to the fact that not all the material couldn’t be completed during the lectures because of the time constraint, the overhead code for initialisation of the codec, Multichannel Buffered Serial Port (McBSP), Enhanced Direct Memory Access (EDMA) and interrupts has been written for you and explained during the in Part 1 session (see code in p:\courses\ naim\fft\fftlab.mak). The EDMA is programmed to transfer an N (count) input

data sequence sampled from the codec through the Serial Port 0 at a rate f s determined by the Internal Timer 1. The EDMA is also programmed to generate an interrupt when the transfer of N data samples is completed. This interrupt is also programmed to call the edma_isr( ) function, where the FFT code should reside (see Figure 4 and Figure 5). Implementation Techniques for DSP 8

Buffer (ping)

Destination address 1

count

Source address Serial EDMA Port FFT Buffer (pong) Processing

Destination address 2

event (internal timer 1 is selected) Switch address at the completion of a count transfer

Figure 4: Illustration of the EDMA functionality

Signal S A/D e Generator r i a l Codec TMS320C6211 PC P o Osciloscope/ r Spetrum D/A t analyser 1 DSK6211

Figure 5: Block diagram of the DSP platform i

Recommended publications