filtering using the tms320c6711 dsk handouts... · 2016. 5. 17. · 4. 16mb (megabytes) of...

15
1 FILTERING using the TMS320C6711 DSK (OPEN ENDED LABORATORY EXERCISE) OBJECTIVES: Our aim is to become familiar with: Testing the software and hardware tools with Code Composer Studio CSS. TMS320C6711 DSP chip and supporting architecture (DSK). Targeting Your C6711 DSK via Real-Time workshop in Simulink INTRODUCTION TO DIGITAL SIGNAL PROCESSORS: Digital signal processing (DSP) is a rapidly growing field within electrical and computer engineering. Analog processing is achieved using components such as resistors, capacitors, and inductors, whereas digital processing uses a programmable microprocessor. The main advantage of digital processing is that applications can be changed, corrected, or updated very easily by reprogramming the microprocessor, unlike analog systems, which would require components, such as resistors or capacitors, to be physically changed. Additionally, DSPs also reduce noise, power consumption, and cost, when compared with analog systems. A DSP is a special purpose processor that is different from a general purpose processor such as an Intel Pentium processor. While the latter is used for large memory, advanced operating applications, the DSP is small, low power consumption, low cost device. Digital signal processors are used for a wide range of applications, from communications and controls to speech and image processing. They're found in cellular phones, fax/modems, disk drives, radio, GPS (global positioning system) receivers, portable medical equipment, and digital music players.

Upload: others

Post on 18-Sep-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

1

FILTERING using the TMS320C6711 DSK

(OPEN ENDED LABORATORY EXERCISE)

OBJECTIVES:

Our aim is to become familiar with:

Testing the software and hardware tools with Code Composer Studio CSS.

TMS320C6711 DSP chip and supporting architecture (DSK).

Targeting Your C6711 DSK via Real-Time workshop in Simulink

INTRODUCTION TO DIGITAL SIGNAL PROCESSORS:

Digital signal processing (DSP) is a rapidly growing field within electrical and computer

engineering. Analog processing is achieved using components such as resistors, capacitors,

and inductors, whereas digital processing uses a programmable microprocessor. The main

advantage of digital processing is that applications can be changed, corrected, or updated

very easily by reprogramming the microprocessor, unlike analog systems, which would

require components, such as resistors or capacitors, to be physically changed.

Additionally, DSPs also reduce noise, power consumption, and cost, when compared with

analog systems.

A DSP is a special purpose processor that is different from a general purpose processor such

as an Intel Pentium processor. While the latter is used for large memory, advanced operating

applications, the DSP is small, low power consumption, low cost device.

Digital signal processors are used for a wide range of applications, from communications and

controls to speech and image processing. They're found in cellular phones, fax/modems, disk

drives, radio, GPS (global positioning system) receivers, portable medical equipment, and

digital music players.

Page 2: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

2

DSK SUPPORT TOOLS

To perform this lab experiments, the following tools are used:

1. TI’s DSP starter kit (DSK). The DSK package includes:

a) Code Composer Studio (CCS), which provides the necessary software support tools.

CCS provides an integrated development environment (IDE), bringing together the C

compiler, assembler, linker, debugger, and so on.

b) A board, shown in Figure 1.1, that contains the TMS320C6711 (C6711) floating-

point digital signal processor as well as a 16-bit codec for input and output (I/O)

support.

c) A parallel cable (DB25) that connects the DSK board to a PC.

d) A power supply for the DSK board.

2. An IBM-compatible PC. The DSK board connects to the parallel port of the PC through

the DB25 cable included with the DSK package.

3. An oscilloscope, signal generator/microphone, and speakers

DSK BOARD

The DSK package is powerful, yet relatively inexpensive, with the necessary hardware and

software support tools for real-time signal processing. It is a complete DSP system. The

DSK board includes:

1. The C6711 floating-point digital signal processor and a 16-bit codec AD535 for input and

output.

2. A 4-MHz clock onboard the DSK connects to this codec to provide a fixed sampling rate of 8

kHz.

3. A daughter card expansion is also provided on the DSK board.

4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash

ROM.

5. Two connectors on the board provide input and output and are labeled IN (J7) and OUT (J6).

6. 150 MHz onboard clock. Also onboard the DSK are voltage regulators that provide 1.8V for

the C6711 core and 3.3 V for its memory and peripherals.

Page 3: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

3

TMS320C6711 DIGITAL SIGNAL PROCESSOR

The TMS320C6711 (C6711) is based on the very-long-instruction-word (VLIW)

architecture, which is very well suited for numerically intensive algorithms. The internal

program memory is structured so that a total of eight instructions can be fetched every cycle.

Features of the C6711 include 72 kB of internal memory, eight functional or execution units

composed of six ALUs and two multiplier units, a 32-bit address bus to address 4 GB

(gigabytes), and two sets of 32-bit general-purpose registers.

The C67xx (such as the C6701 and C6711) belong to the family of the C6x floating-point

processors; whereas the C62xx and C64xx belong to the family of the C6x fixed-point

processors. The C6711 is capable of both fixed- and floating-point processing.

Figure 1.1: A photograph of TI TMS320C6711

CODE COMPOSER STUDIO

The Code Composer Studio (CCS) provides an integrated development environment (IDE) to

incorporate the software tools. CCS includes tools for code generation, such as a C compiler,

an assembler, and a linker. It has graphical capabilities and supports real-time debugging. It

provides an easy-to-use software tool to build and debug programs.

The C compiler compiles a C source program with extension .c to produce an assembly source

file with extension.asm. The assembler assembles an.asm source file to produce a machine

language object file with extension.obj. The linker combines object files and object libraries as

input to produce an executable file with extension. out. This executable file represents a linked

common object file format (COFF), popular in Unix-based systems and adopted by several

makers of digital signal processors. This executable file can be loaded and run directly on the

C6711 processor.

Page 4: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

4

PROGRAMMING LANGUAGES

Assembly language was once the most commonly used programming language for DSP chips

(such as TI’s TMS320 series) and microprocessors (such as Motorola’s 68MC11 series).

Coding in assembly forces the programmer to manage CPU core registers (located on the DSP

chip) and to schedule events in the CPU core. It is the most time consuming way to program,

but it is the only way to fully optimize a program. Assembly language is specific to a given

architecture and is primarily used to schedule time-critical and memory-critical parts of

algorithms.

The preferred way to code algorithms is to code them in C. Coding in C requires a compiler

that will convert C code to the assembly code of a given DSP instruction set. C compilers are

very common, so this is not a limitation.

In fact, it is an advantage, because C coded algorithms may be implemented on a variety of

platforms (provided there is a C compiler for a given architecture and instruction set).

Finally, a hybrid between assembly language and C exists within CCS. It is called linear

assembly code. Linear assembly looks much like assembly language code, but it allows for

symbolic names and does not require the programmer to specify delay slots and CPU core

registers on the DSP. Its advantage over C code is that it uses the DSP more efficiently, and its

advantage over assembly code is that it does not require the programmer to manage the CPU

core registers.

USEFUL TYPES OF FILES

You will be working with a number of files with different extensions. They include:

1. file.pjt: to create and build a project named file.

2. file.c: C source program.

3. file.asm: assembly source program created by the user, by the C compiler, or by

the

linear optimizer.

4. file.sa: linear assembly source program. The linear optimizer uses file.sa as input to

produce an assembly program file.asm.

5. file.h: header support file.

6. file.lib: library file, such as the run-time support library file rts6701.lib.

7. file.cmd: linker command file that maps sections to memory.

8. file.obj: object file created by the assembler.

9. file.out: executable file created by the linker to be loaded and run on the processor.

Page 5: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

5

PROGRAMMING EXAMPLES TO TEST THE DSK TOOLS

Two programming examples are introduced in this experiment to illustrate some of the

features of CCS and the DSK board. The primary focus is to become familiar with both

the software and hardware tools.

QUICK TEST OF DSK

Launch CCS from the icon on the desktop. Press GEL → Check DSK → Quick Test. The

Quick Test can be used for confirmation of correct operation and installation. The following

message is then displayed:

Switches: 7

Revision:

2 Target

is OK

This assumes that the first three switches, USER_SW1, USER_SW2, and USER_SW3, are all

in the up (ON) position.

This assumes that the first three switches, USER_SW1, USER_SW2, and USER_SW3,are all

in the up (ON) position.

Change the switches to (1 1 0 x)2 so that the first two switches are up (press the third switch

down). The fourth switch is not used. Repeat the procedure to select GEL Check DSK

Quick Test and verify

that the value of the switches is now 3 (with the display “Switches: 3”).You can set the value

of the first three user switches from 0 to 7.Within your program you can then direct the

execution of your code based on these eight values. Note that the Quick Test cycles the LEDs

three times.

Page 6: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

6

FIR TYPE-I Lowpass Filtering

using TMS320C6711

Floating Point Processor

Using CCS

• Start CCS by either:

– Using the desktop icon:

or

– Start -> Programs -> Texas Instruments -> Code

Composer Studio 2 -> Code

Composer Studio.

or

– Run cc_app.exe in c:\ti\cc\bin\

Troubleshooting

• If the following window appears on your screen then:

– Check that the DSK is connected properly and

powered up.

– Check if the port address and mode is correct

Page 7: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

7

CCS DSK Utilities

Quick Test

Run from CCS GEL menu

Defined in dsk6xinit.gel

Non-intrusive test by reading and writing:

LEDs

Switches

DSK board revision

Outputs switch values

Creating a New Project

From the Project menu, choose New.

In the Project Name field, type filter.

In the Location field, browse to the working folder you created in

step 1.

In the Project Type field, select Executable (.out).

In the Target field, select the target you have CCS configured for

and click Finish.

Page 8: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

8

Adding Files to a Project

• Choose Project→Add Files to Project. Select filter.c and click

Open.

• Choose Project→Add Files to Project.

– Select Asm Source Files (*.a*, *.s*) in the Files of

type box.

– Select vectors.asm and load.asm, and click Open.

• Choose Project→Add Files to Project.

– Select Linker Command File (*.cmd) in the Files of

type box.

– Select filter.cmd and click Open.

Adding Files to a Project

• Choose Project→Add Files to Project. Go to the compiler

library folder (C:\ti\c6000\cgtools\lib).

– Select Object and Library Files (*.o*, *.lib) in the

Files of type box.

Page 9: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

9

– Select the rts.lib file for the target you are configured

for and click Open.

• In the Project View window, right-click on filter.pjt and select

Scan All Dependencies.

– filter.h should appear under the Include folder in the

Project View window.

Adding Files to a Project

• Expand the Project list by clicking the + signs next to Project,

filter.pjt, Libraries, and Source.

• This list is called the Project View.

Page 10: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

10

Header file

Page 11: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

11

Main program-libraries and functions

Page 12: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

12

Main program-body

Page 13: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

13

Building and Running the Program

• Choose Project→Rebuild All or click the

(Rebuild All) toolbar button.

• By default, the .out file is built into a debug directory located under

your current project folder.

Choose File→Load Program. Select the program you just rebuilt,

filter.out, and click Open.

Displaying Graphs

• Choose View→Graph→Time/Frequency.

• In the Graph Property Dialog, change some of the variable properties

to the values shown here.

• Click OK. An Input graph window for the Input Buffer appears.

• Right-click on the Input graph window and choose Clear Display

from the pop-up menu.

• Choose View→Graph→Time/Frequency again.

• This time, change the Graph Title to Output and the Start Address to

out_buffer. All the other settings are correct.

• Click OK to display the Output graph window.

Page 14: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

14

Animating the Program and Graphs

• In the volume.c window, put your cursor in the line that calls dataIO.

• Click the (Toggle Breakpoint) toolbar button or press F9. A red

icon is placed in the selection margin to represent the breakpoint.

• Arrange the windows so that you can see both graphs.

• Click the (Animate) toolbar button or press F12 to run the program.

• From the Debug menu, choose Halt.

Page 15: FILTERING using the TMS320C6711 DSK handouts... · 2016. 5. 17. · 4. 16MB (megabytes) of synchronous dynamic RAM (SDRAM) and 128kB (kilobytes) of flash ROM. 5. Two connectors on

15

Animating the Program and Graphs

Assignment:

Design a FIR TYPE-I high-pass filter using the C program structure which has been

provided for the low-pass filter example. You may obtain the coefficients of the

high-pass filter by using the MATLAB platform and the function fir1(n,f,’high’)

therein.