CENG 6431 DSP Implementation Summer 2004 LAB #1

CENG 6431 DSP Implementation Summer 2004 LAB #1

CENG 6431 DSP Implementation Summer 2004 – LAB #1

Name: Sam Tran.

  1. Quick Test of DSK:
  1. Testing: GEL  Check DSK  Quick Test.
  2. Observation:
  • Leds 13 on DSK blink.
  • The following message is displayed: “Switches: 7 – Revision: 2 – Taget is OK”.
  • Change the switches lead to the message changes (number of the Switches is changed).
  • Conclusion:
  • The switch that is closest to the boundary is the highest bit .
  • Up = 1, down =0.
  • Find and run the confidence test program for the DSK.

  1. Alternative Quick Test of DSK.
  2. Observation:

  1. Example 1.1:
  2. Study the code for sin8_intr.c found on page 9 of Chassing.
  3. The interrupt occurs every sample period T=1/F = 1/8000 = 0.125 ms.
  4. We have 8 values (stored in sin_table variable) to make a cycle  the frequency is 1/T = 1/ 0.125 x8 = 1000.
  5. The amplitude of the output belongs to the amplitude variable. Its value is 10.
  6. Create the project.
  7. Project  Open  file *.pjt.
  8. Observation:
  • The GEL files include DSK6211_6711.gel. This file is added automatically to initialize the DSK
  • The project includes Dependent Project, DSP/BIOS Config, Generated Files, Include, Libraries, Source folders and C6xdsk.cmd file (linker command file).
  • The Include contains header files (*.h).
  • The Libraries contains library files (*.lib)
  • The Source contains the source program, C6xdskinit.c (It might include some methods to initialize the DSK), and vectors_11.asm.
  • When we need add a file to the project, Project  Add files or right click on the project mane, or even dragging from a different window.
  1. Page 12-16.
  2. Compiler Options: Grouped in 8 categories: Basic, Advanced, Feedback, Files, Assembly, Parser, Preprocessor, Diagnostics.
  • Basic:
  • Target Version selects which version of the TI that you are working on.
  • Generate debug info: Select the debug mode.
  • Opt Speed vs. Size: Select which priority, Speed or Size.
  • Opt Level (-o0, -o1, -o2, -o3): Set level of optimization.
  • Program Level Opt (-op0, -op1, -op2, -op3): Set permission of reference the function or variable of the program from the external.
  • Advance: Contain options that are machine–specific.
  • RTS Modifications (-ol0, -ol2, -ol3): Inform the optimizer about what kind of the library you are using.
  • Auto Inlining Threshold (-oi): Specifies the automatic inlining size (level 3 only) for the -oisize option.
  • Memory Models: Select the way to call data or function.
  • RTS Calls: Are Near (-mr0) makes calls to run-time-support functions near, Are Far (-mr1) makes calls to run-time-support functions far.
  • Aliasing: Aliased Variables (-ma) assumes aliased variables, No Bad Alias Code (-mt) allows the compiler to make certain assumptions about aliasing and loops.
  • Interrupt Threshold (-mi): Specifies an interrupt threshold value for the -min option.
  • Speculate Threshold (-mh): Allows speculative execution by enabling the -mhn option.
  • Turn off Software Pipelining (-mu): Turns off software pipelining.
  • Old 6400 Alignment Compatibility (-mb): Enables the linking of C6400 code with C6200, C6700 and older C6400 source code by enabling the –mb option. The -mb option changes the alignment of top-level arrays to 4 bytes when the -mv6400 switch is used.
  • Turn off Reorder of Associative Floating Pt Operations (-mc): Prevents reordering of associative floating-point operations by enabling the -mc option.
  • Use Function Subsections (-mo): Turns on function subsections so the linker places each function in a file in its own subsection.
  • Feedback: This category contains compiler options that generate feedback.
  • Banners/Quiet: Set output mode.
  • Interlisting: Enable/ Disable the interlisting of source and/or comments of optimizer, C, or assembly.
  • Opt Info File: Enable/ Disable the optimization information file.
  • Generate Optimizer Comments (-os): Interlists optimizer comments with assembly statements.
  • Generate Single Iteration View of SP Loops (-mw): Provides additional compiler/software pipeline feedback in the generated assembly file.
  • Files: This category contains options that control the files generated by the compiler.
  • Asm File Extension: Specifies a default extension for assembly source files (-ea[.]new-extension).
  • Obj File Extension: Specifies a default extension for object files (-eo[.]new-extension).
  • Linear Asm Extension: Specifies a default extension for assembly optimizer source files (-el[.]new-extension).
  • Asm Directory: Specifies an assembly file directory (-fs).
  • Obj Directory: Specifies an object file directory (-fr).
  • Temporary File Dir: Specifies a temporary file directory (-ft).
  • Absolute Listing Dir: Specifies an absolute listing file directory (-fb).
  • Listing/Xref Dir: Specifies an assembly listing file and cross-reference listing file directory (-ff).
  • -@ file: Interprets the contents of a file as an extension to the command line.
  • Assembly: This category of options controls the assembler.
  • Keep generated .asm Files (-k): Retains the assembly language output from the compiler. Normally, the compiler deletes the output assembly language file after assembly is complete.
  • Generate Assembly Listing Files (-al): Generates an assembly listing file.
  • Keep Labels as Symbols (-as): Puts labels in the symbol table.
  • Make case insensitive in asm source (-ac): Makes case insignificant in the assembly language source files. For example, -ac makes the symbols ABC and abc equivalent. If you do not use this option, case is significant (this is the default).
  • Pre-Define NAME (-ad): Defines a symbol using the specified name.
  • Undefine NAME (-au): Undefines the specified predefined constant.
  • .copy File (-ahc): Copies the specified file for the assembly module.
  • .include File (-ahi): Includes the specified file for the assembly module.
  • Parser: Contain options that control the parser.
  • ANSI Compatibility: Set K&R compatible, strict ANSI or non-strict ANSI with the options are –pk, -ps, and -pr respectively.
  • Embedded C++ (-pe): Enables embedded C++ mode.
  • Treat C files as C++ Files (-fg): Causes the compiler to process C files as C++ files. By default, the compiler treats files with a .c extension as C files
  • Ignore Inline Keyword (-pi): Disables definition-controlled inlining. When specified with level 3 optimizations, automatic inlining is still performed.
  • Output Raw Listing to .rl File (-pl): Generates a raw listing file. The raw listing file has the same name as the corresponding source file with a .rl extension.
  • Output XREF Listing to .crl File (-px): Generates a cross-reference listing file. The cross-reference listing file has the same name as the corresponding source file with a .crl extension.
  • Disable intrinsics (-pn): Disables the use of intrinsics to access assembly language statements.
  • Support C++ run-time type information (-rtti): Enables run-time type information for C++ files.
  • Error Limit (-pdel): Specifies the error limit. The compiler abandons compiling after this number of errors. (The default is 100.)
  • Preprocessor: Contain options that control processing
  • Include Search Path (-i): Specifies the directories where the compiler can find include files (-idirectory). Multiple directories must be separated by semi-colons. If an include file is not found in the current directory, the compiler will search the directories specified by this field from left to right. If the include file is still not found, the compiler will search the path specified by the C_DIR environment variable.
  • Define Symbols (-d): Predefines the specified constant(s) for the preprocessor (-dname[=def]). Multiple constants must be separated by semi-colons. This is equivalent to inserting “#define name def” at the top of each C source file. If the optional definition is omitted, the constant is set to 1.
  • Undefine Symbols (-u): Undefines the predefined constant name. This option overrides any -d options for the specified constant.
  • Preprocessing:

None:Standard C/C++ preprocessing functions.

Preprocess Only (-ppo): Performs preprocessing only. Writes preprocessed output to a file with the same name as the input but with a .pp extension.

With Comments (-ppc): Performs preprocessing only. Writes preprocessed output, keeping the comments, to a file with the same name as the input but with a .pp extension.

Dependencies Only (-ppd): Performs preprocessing only, but instead of writing preprocessed output, writes a list of dependency lines suitable for input to a standard make facility. The list is written to a file with the same name as the source file but with a .pp extension.

File Inclusion Only (-ppi): Performs preprocessing only, but instead of writing preprocessed output, writes a list of files included with the #include directive. The list is written to a file with the same name as the source file but with a .pp extension.

With Line Numbers (-ppl): Performs preprocessing only. Writes preprocessed output with line-control information (#line directives) to a file with the same name as the input but with a .pp extension.

  • Continue with Compilation (-ppa): Compiles your source code after preprocessing.
  • Diagnostics: Contain options that control parser diagnostics.
  • Output Diagnostics to .err File (-pdf): Writes diagnostics to the specified file rather than standard error.
  • Display Diagnostic Identifiers (-pden): Displays a diagnostic’s identifiers along with its text.
  • Issue Nonserious Warnings (-pdr): Issues remarks (nonserious warnings).
  • Verbose Diagnostics (-pdv): Provides verbose diagnostics that display the original source with line-wrap
  • Suppress Warning Diagnostics (-pdw): Suppresses warning diagnostics (errors are still issued).
  • Suppress Diagnostic <n> (-pds): Suppresses the diagnostic identified by the specified number.
  • Treat Diagnostic <n> as Error (-pdse): Categorizes the diagnostic identified by the specified number as an error.
  • Treat Diagnostic <n> as Remark (-pdsr): Categorizes the diagnostic identified by the specified number as a remark.
  • Treat Diagnostic <n> as Warning (-pdsw): Categorizes the diagnostic identified by the specified number as a warning.

ii. Linker Options: Consist of Basic and Advanced options.

  • Basic: Contain commonly used basic linker option.
  • Suppress Banner (-q): Suppresses the linker’s banner.
  • Exhaustively Read Libraries (-x): Forces rereading of libraries to resolve “back” references. This flag should always be set so that the order of the object libraries in the project list is not important.
  • Output Module:
  • Absolute Executable produces an executable absolute output module (-a). Absolute modules contain no relocation information. Executable modules contain header information, such as the entry point for execution.
  • Relocatable Executable produces a relocatable executable output module (-ar). Relocatable modules retain relocation information. Executable modules contain header information, such as the entry point for execution.
  • Relocatable Non-Executable produces an unexecutable relocatable output module (-r). Relocatable modules retain relocation information.
  • Output Filename (-o): Names the output file. If you do not specify an output filename, the output file is given the default name a.out.
  • Map Filename (-m): Creates a linker map file with the specified name. If you do not specify a map filename, no map is created. Map filenames typically have the .map extension.
  • Autoinit Model: Specifies the type of initialization: Load-time Initialization (-cr), Run-time Autoinitialization (-c), or No Autoinitialization. Autoinitialization is used by C programs to initialize static variables.
  • Heap Size: Specifies the heap size, in words, used for C programs (-heap). Hex values must be preceded by “0x”.
  • Stack Size: Specifies the stack size, in words, used for C programs (-stack). Hex values must be preceded by “0x”.
  • Fill Value (-f): Specifies the default fill value for holes formed within output sections. The fill value is a four-byte constant. Hex values must be preceded by “0x”.
  • Code Entry Point (-e): Defines a global symbol that specifies the primary entry point for the output program.
  • Library Search Path (-i): Specifies the directories where the linker can find object libraries. Multiple directory names must be separated by semi-colons. If an object library is not found in the current directory, the linker will search the directories specified by this field. If you add libraries directly to the project list, you do not need to provide a search path for those libraries.
  • Include Libraries (-l): Specifies the names of object libraries to be linked into your program. If you add libraries directly to the project list, you do not need to specify them here.
  • Advanced: Contains additional linker options.
  • Disable Conditional Linking (-j): Disables conditional linking that has been set up with the assembler .clink directive. By default, all sections are unconditionally linked.
  • Disable Debug Symbol Merge (-b): Retains duplicate symbolic debugging information.
  • Strip Symbolic Information (-s): Strips all symbolic information from the output module. If this flag is selected, the debugger cannot provide C source-level debugging.
  • Make Global Symbols Static (-h): Makes all global symbols static.
  • Warn About Output Sections (-w): Displays a message when an undefined output section is created.
  • Define Global Symbol (-g): Overrides the -h option for the specified symbol.
  • Create Unresolved Ext Symbol (-u): Introduces an unresolved symbol into the linker’s symbol table. This forces the linker to search a library and include the member that defines the symbol.

iii. Build and Run the project:

  1. To build the project: Project  Build/ Rebuild All.
  2. To Run: File  Load Program to load the *.out file to the kit. And then, Debug  Run.
  3. Observation: The output of the DSK will have a sin signal with the frequency of 1KHz.

iv. Monitor the Watch Window:

1. View  Quick Watch. Type amplitude, then click on “Add to Watch”.

At amplitude = 10:

At amplitude = 30:

At amplitude =33:

Conclusion: When changing the amplitude variable from 10 to 30, the amplitude of the output signal jumps from 0.82 V to 2.54 V and the frequency does not change (1KHz) at that time. When the amplitude variable is 33, the amplitude of the signal is 2.71 V and frequency is around 3KHz. The frequency is changed because an overflow happened. At 33, the range of the value is from + or – 33,000. However, the capacity of the codec is 16 bits meaning the output value is limited from –32,768 to 32767. So the overflow happens. And because of that, the output signal can’t reach the peak value (33,000). It leads to the cycle is ended sooner. That means the frequency is impacted.

v. Correct Program Errors:

vi. Apply the Slider Gel File:

The output at this value (25) is:

Conclusion: I get the same result with “Quick Watch” at the value of 10, 30, and 33. I try with the value of 35, and the DSK is hanged.

Example 1.2 (page 17 of Chassaing):

a. Study the code found for sin8_buf on page 18 of Chassaing:

Run the sin8_buf project with the output is multiplied with 10, I get:

I have to multiply the output with 10 because without it, the output signal level is too low. So, the oscilloscope might not realize it.

Plotting with CCS:

View  Graph  Time/Frequency

FFT Magnitude:

Single time:

Conclusion: The graph shows values of the out_buffer array (256 elements). However, the values in the array are exactly as the output value (output sample). So, we get the graph as it showed in the oscilloscope. In FFT display type, it shows the frequency of the signal. We can see the fc = 1KHz.

4. Testing the EVM (page 52 of Dahnoun)

a. Setup CCS for 6701:

From the Setup CCS window, clear the old one and import the driver for 6701 EVM (PCI).

  1. Run the confidence test for EVM:

Using sampling rate is 8000 and the input is 4000, 1 Vpp. I get:

When we increase the input frequency more than 4000, the amplitude of the output decrease significantly because the sample rate is 8000 so the fc is around 4000.

  1. Take frequency and phase response measurement and compare with Figure 3.8 on page 54.

To do this experience, we have to generate a frequency from 0 to 25KHz and set sample_rate variable in INOUT.c to 44100. I get the frequency response of the codec:

CH3: input signal sweeping from 1Hz to 25KHz.

CH1: output 1.

CH2: output 2.

Here are some values about frequency response and phase response: (Using website to calculate the gain:

- 5KHz:

Magnitude = 20*log10 (Vout/Vin) = 20*log10 (0.81/1.96) = -7.67 (the value in the book is -10)

10KHz:

Magnitude = 20*log10 (Vout/Vin) = 20*log10 (0.76/1.92) = -8.04 (the value in the book is -10).

15KHz:

Magnitude = 20*log10 (Vout/Vin) = 20*log10 (0.71/1.88) = -8.45 (the value in the book is -10).

20KHz:

Magnitude = 20*log10 (Vout/Vin) = 20*log10 (0.46/1.92) = -12.4 (the value in the book is around -12).

25KHz:

Magnitude = 20*log10 (Vout/Vin) = 20*log10 (0.0001/1.92) = -85.66 (the value in the book is -85).

Phase Response:

At 5KHz:

At 10KHz:

Conclusion:

The shape of the response is as exactly as in the book.