Вы находитесь на странице: 1из 3

DSP Lab 3 Configuring McBSP and interfacing with codec

Lab 3 In this lab you will learn to configure McBsp (multi-channel buffered serial port) and interface with the codec TLV320AIC23. You will also learn to graph a variable with variety of parameters. 1. Create a project Lab3.pjt in your working folder. Create a new source file and add the following code to the file. This code can also be found in the file Lab3.txt. Save this file as Lab3.c and add to the project.

#include <std.h> #include <dsk6713.h> #include <DSK6713_AIC23.h> Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; int loop = 0; short sine_table[8]={0,7070,10000,7070,0,-7070,-10000,-7070}; int cntr = 0; void c_int11(void) { short out_data = 0; Uint32 in; out_data = sine_table[loop]; if (++loop > 7) loop = 0; output_sample(out_data); return; } void main() { comm_intr(); while(1); } //ISR defined in .cdb

//sine values

//if end of table reinit index //real-time output

//init codec,DSK, MCBSP //infinite loop //end of main

2. 3.

Select File : DSP/BIOS configuration from the menu. This will open a window. From this window select dsk6713.cdb and click OK. Now you will see a Config Tool window with various system options, as shown in the diagram.

4. 5.

6.

7.

8.

Save the file as Lab3.cdb. Double-click on Scheduling. Double-click on HWI-Hardware Interrupt Routine Service Manager. This will show you a list of interrupts ranging from HWI_RESET to HWI_INT15. Right click on HWI_INT11 and select Properties. This will open a window HWI_INT11 Properties. Select MCSP_1_Transmit as interrupt source and type _c_int11 in the function field. Note that you have defined a function c_int11( ) in your Lab3.c. Also note that you have set sampling frequency of 8 kHz for codec. Therefore the ISR will be called 8000 times a second, during execution of program. The other options that you have for sampling frequency are 16, 24, 32, 44, 48 and 96 kHz. Now click on Dispatcher tab. Check Use Dispatcher. Now you have configured interrupt 11 for McBSP1 transmit and an ISR for this interrupt has also been declared. Click OK. Save the file Lab3.cdb again and close. When a CDB file is saved, the Config Tool creates a number of other files:

9.

Now add this file to the project. When you add a CDB file to your project, CCS automatically adds the .c, .cmd and assembly (.s62) files. To prevent confusion, these files are added to the Generated Files folder. Remember that in previous programs you had added a user-generated .cmd file manually. But here .cmd file is generated and added to the project automatically.

10.

11.

12. 13.

Add the following files to the project. C:\CCStudio_v3.1\C6000\dsk6713\lib\dsk6713bsl.lib [Board Support library - required to use peripherals on-board] C:\CCStudio_v3.1\Support\c6713dskinit.c [Contains some useful functions for codec] Right-click on Lab3.pjt in project window and select Build Options. Click on Compiler tab and click on Basic category. Select C671x in Target Version. Now select Advanced category. In Memory Models select Far(--mem_model:data=far). Then select Preprocessors category. In Pre-Define Symbol field, type CHIP_6713. And in Include Search Path field, enter the complete path of the file dsk6713.h. Click OK.

14. 15.

Build the project and load the .out file to the DSP. Run the program. Connect the Line Out of DSP kit to the oscilloscope and see the waveform. Measure the frequency and note down. You may also hear this as a tone on speaker.

Assignment 3 1 In Lab3, you generated 1 kHz sine wave. What factors decided the frequency of the generated signal? Explain with calculations. What may be the simplest modification in code required to generate a frequency of 2 kHz? 2 Create a project A3.pjt similar to Lab3 which should generate a sine wave with frequency 8 kHz.

Вам также может понравиться