1 start ccsv5 and create a project - haw hamburg · digital signal processing lab now, three build...

5
Department Informations- und Elektrotechnik Labor für Signalverarbeitung Praktikum Digitale Signalverarbeitung Digital Signal Processing Lab Create and Debug a CCSv5.5 Project for DSK6713- or DUETT-Board 1 1 Start CCSv5 and create a project Start CCS 5 by double clicking the corresponding icon on the Desktop. If CCS does not start with the CCS Edit Perspective (see Fig. 1), open this via Window Open Perspective Otherand doubleclick on CCS Edit (Fig. 2). Create a new project in D:\ti_work5 with Project New CCS Project. Fill in the New CCS Project window as shown in figure 3 and click Finish. Hint: In the following, c-sourcecode and directory is called get_started.c and get started. Note that the folder get_started will be automatically created. Three project files in this directory contain all project and build information in ASCII format (comparable to Windows INI-files). DSK6713.ccxml (Target Configuration File) contains information about the hardware. Copy the following files to your project directory .\get_started from D:\ti_work5\DSK6713\Lab_support_DSK6713: 1. get_started.c (C-Source Code) 2. C6713dsk_AIC23.cmd (Link command file) 3. DSK_vectors_AIC23.asm 4. c6713dskinit.h for DUETT: from D:\ti_work5\DSK6713\Lab_support_duett: 1. get_started_duett.c 2. C6713_DSK_DUETT.cmd 3. DSK_vectors_DUETT.ASM 4. c6713dsk_DUETT_init.c By refreshing the perspective via <F5> the files appear in the CCS Project Explorer. Remove via right mouseclick the automatically inserted file main.c from the project. 1 Note the colored labeling: in case of differences, description is blue for DSK6713, green for DUETT . Kup, 25.07.2016 1 / 5 Fig. 1: CCS Edit Perspective Fig. 3: New CCS Project Fig. 2: Open Perspective Dialog

Upload: buihuong

Post on 15-Sep-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Department Informations- und ElektrotechnikLabor für Signalverarbeitung

Praktikum Digitale SignalverarbeitungDigital Signal Processing Lab

Create and Debug a CCSv5.5 Projectfor DSK6713- or DUETT-Board 1

1 Start CCSv5 and create a projectStart CCS 5 by double clicking the corresponding icon on the Desktop.

If CCS does not start with the CCS Edit Perspective (see Fig. 1), open this via Window Open Perspective Other… and doubleclick on CCS Edit (Fig. 2).

Create a new project in D:\ti_work5 with Project New CCS Project. Fill in the New CCS Project window as shownin figure 3 and click Finish.Hint: In the following, c-sourcecode and directory is called get_started.c and get started.

Note that the folder get_started will be automatically created.Three project files in this directory contain all project and buildinformation in ASCII format (comparable to Windows INI-files).DSK6713.ccxml (Target Configuration File) contains informationabout the hardware.

Copy the following files to your project directory .\get_started

from D:\ti_work5\DSK6713\Lab_support_DSK6713:1. get_started.c (C-Source Code)2. C6713dsk_AIC23.cmd (Link command file)3. DSK_vectors_AIC23.asm4. c6713dskinit.h

for DUETT: from D:\ti_work5\DSK6713\Lab_support_duett:1. get_started_duett.c2. C6713_DSK_DUETT.cmd3. DSK_vectors_DUETT.ASM4. c6713dsk_DUETT_init.c

By refreshing the perspective via <F5> the files appear in the CCS Project Explorer. Remove via right mouseclick the automatically inserted file main.c from the project.

1 Note the colored labeling: in case of differences, description is blue for DSK6713, green for DUETT.

Kup, 25.07.20161 / 5

Fig. 1: CCS Edit Perspective

Fig. 3: New CCS Project

Fig. 2: Open Perspective Dialog

Digital Signal Processing Lab

Now, three Build Options has to be set. After right mouseclick on the project in CCS Edit Perspective, choose Properties, in section Build, subsection C6000 Compiler:

I. at Advanced Options → Predefined Symbols and via the red encircled button on the right, add: “CHIP_6713”:

II. at Advanced Options → Runtime Model Options choose „far“ for the „Data access model“:

III. at Processor Options insert „6710“ as „Target processor version“:

A further option allows setting/removing breakpoints oder changing content of variables, while the program is running. After right mouseclick on the project in CCS Edit Perspective, choose Properties, in section Debug, subsection Auto Run and Lauch Options check the box „Halt target before any debugger access“:

2 Compile, link and load the project

Connect the DSK6713- and DUETT-Board respectively via USB. Select now Run Debug (<F11>).By this command

the inserted files will be compiled, linked, while the linker is interpreting the file C6713dsk_AIC23.cmd and an executable file will be created. The target hardware (DSK6713, DUETT) will be initialised and connected, the executable file ..\get_started\Debug\get_started.out will be loaded to the board.

25.07.20162 / 5

Digital Signal Processing Lab

The program will be started and stopped at the row main().

The „Problems“ window should not show any error or warning and should not be opened respectively.After that, you‘re automatically switched to the Debug Perspective. You can return to the CCS Edit-Perspective via the buttons on the right top (Fig. 4, encircled in red).

Run Resume or <F8> or the corresponding button (Fig. 4, left green arrow in the blue encircled area) starts the program on the DSP. You’ll be asked for input in the „Console“ window.

3 Example program get_started with signal input and outputUsing a simple demo program get_started.c and get_started_duett.c respectively you will now program the DSP for reading an audio signal via the CODEC and output the signal directly. The configuration of CODEC and McBSP is carried out in the given file c6713dskinit.h / c6713dsk_DUETT_init.h and in the system files dsk6713_aic23.h and dsk6713.h. The listed functions are implemented in the Board-System Library dsk6713bsl.lib, which will be added automatically while linking the project. Usually it’s not needed to change one of these files!

The desired samplerate has to be set in the variable fs. The following values can be set (Samplerate at the end of the strings): DSK6713_AIC23_FREQ_8KHZ DSK6713_AIC23_FREQ_32KHZ

DSK6713_AIC23_FREQ_16KHZ DSK6713_AIC23_FREQ_44KHZDSK6713_AIC23_FREQ_24KHZ DSK6713_AIC23_FREQ_48KHZ

In fact, „DSK6713_AIC23_FREQ_44KHZ“ workes with Fs=44,1 kHz.

The samplerate has to be set by dividers for 36621 Hz. The default case, div_TIMER0 = 1 and div_TIMER1 = 1 let work both McBSP at 36,621 kHz. This allocation has to be carried out previous to:

fs_act = SampleRates_DUETT(fs, div_TIMER0, div_TIMER1);

The function MCBSP_read reads 32 bit integer from the ADC, so both channels together. These are buffered in an union. Via union_name.both you have access to the whole 32 Bit. An access to each single channel is delivered in union_name.channel[]. union_name.channel[1] contains the left channel data, the data from the right channel are stored in union_name.channel[0]. Correspondingly, function MCBSP_write outputs 32 bit integer to the DAC of the Codec.

The DUETT version contains two interrupt service routines for both CODECs of PCM3003.

25.07.20163 / 5

Fig. 4: View after Debug Run

Digital Signal Processing Lab

4 The CCS debugging toolRun Restart restarts the program and waits at the first row main().Run Resume executes the program, with the Single Step-functions stepwise. Run Step Over or <F6> executes the program line by line.View further functions of the Run menu in Fig. 5.

However, this will not produce internal DSP-register changes. If youwish to reinitialise the internal CPU and peripheral registers, youmust execute Run Reset Reset CPU (before reloading via Run Debug).

CCS offers excellent debugging possibilities, which will beintroduced step by step. Among others you can:

set and remove breakpoints in the source code run the program in single-step mode view mixed source and assembler code monitor variables view the content of the DSP register (DSP core registers,

peripheral registers) view the content of any memory location

Set a breakpoint right before the line you want to stop the program: place the cursor in front of the line number and double-click (or mark the line , right mouseclick, BreakpointBreakpoint). A blue dot shows the breakpoint. The program in Fig. 6 run up to the breakpoint. View Breakpoints shows all breakpoints in a window.

Right mouseclick on the breakpoint, then Breakpoint Properties opens a new window. You can choose as Action, whether the program should stop (Remain Halted) or e.g. run to the breakpoint again and again and refresh the windowschoosing Update View or Refresh All Windows. This application is needed for graphical displays.

You can set any number of breakpoints in all C or assembler code. Remember that the current position is marked with a blue arrow. In this way you can run the program piecewise. Individual breakpoints can be removed by double-clicking on the blue dot. Toggle Breakpoint in the menu (open with right mouseclick), sets or removes the breakpoint, Disable/Enable Breakpoint can be useful, setting a breakpoint always in the same line.

Fig. 6: Halt at a breakpoint

You can see the Disassembly window (View Disassembly) in the lower right part of Fig. 6. In this window you can observe assembly single steps. One or more (in case of parallel processing of statements) blue arrows show the current position of the program counter.

25.07.20164 / 5

Fig. 5: Debug functions (Run menu)

Digital Signal Processing Lab

Fig. 7: Monitoring variables Fig. 8: View memory in the Memory Browser

To monitor a variable, mark it, right mouseclick, then Add Watch Expression…. Alternatively call View Expressions,add the variable in the opening window, see. Fig. 7.

You have to suspend the program, if you want to change the variables content.Right mouseclick on „Type“ allows changing the „Number Format“, e.g. to „hex“.

You can also check the value of a variable without using the Expressions window: simply place the mouse arrow on the variable, and its value (and the start address respectively, if it is a function) is displayed.

View the content of a memory location with View Memory Browser. The Memory Browser opens. Here you can enter the address like „&a” in the example in figure 8, click on <Go> and choose the data format, e.g. „Hex 32 Bit – C Style“.

View Registers opens a new window to observe the registers. ChoosingCore Registers (interne CPU-Register), you can monitor and change thecontent of the 32 A and B registers and „program counters“ PC. Furtherimportant registers are the interrupt registers ISTP, IFR, IER and IRP andthe interrupt flag GIE (bit #0 in the CSR, see Fig. 9). Currently changedregister content is highlighted in yellow; to change register content, selectit with a mouseclick.

Further registers can be monitored directly in this window:Peripheral Registers (for Timer, Interrupt and EMIF) as well as registersof the serial interfaces McBSP0 and McBSP1, controlling the CODEC.

Fig. 9: View Registers

Hint (arrange windows in CCS):A click on the right mousebutton to e.g. the register-tab, then choose Detached, releases the window, so you can move itfreely and group it. Removing the checkmark in front of Detached implants the window in the CCS surface again. You can drag the subwindows easily to other parts of the CCS surface with the mouse.

25.07.20165 / 5