links and files

code composer studio

CCS 3.1 Quick Start Guide.

A brief CCS tutorial from Rice University.

The official TI CCS tutorial. This is more comprehensive but also pretty long.

The official TI CCS users' guide.

tms320c6713 dsk

The SpectrumDigital DSK technical reference.

AIC23 codec datasheet.

A nice Java applet by Analog Devices that demonstrates how sigma-delta ADCs work.

The CCS help system has a lot of useful information. You can get access to datasheets and other information. For information about the library functions you can call from your code, search for the file "C6713DSK.HLP" in the CCS directory. Open this file and drill down into the tree to Software, Board Support Library, BSL API Reference.

The PDF version of the BSL API reference. Note that it is slightly out of date since it references a different codec than the AIC23. I don't believe the updated BSL API reference has been released yet. If in doubt, refer to the CCS help system since it appears to be more up to date.

tms320c6000 assembly/c programming reference material

TMS320C6000 CPU Instruction Set and Reference Guide.

TMS320C6000 Programmer's Guide

TMS320C6000 Assembly Language Tools User's Guide

tms320c6713 dsp chip

The TI TMS320C6713 datasheet.

The PDF version of the CSL API reference. Again, sections may be out of date. If in doubt, refer to the CCS help system.

Some information about the IEEE floating point standard.

matlab

A large number of Matlab tutorials and other information are indexed here.

Lots of information on Matlab's Link for Code Composer Studio. This web page has several tutorials as well.

If you have specific questions about Matlab or Matlab functions, try the Matlab help system.

how to plot the magnitude response of your filter using white noise

Here is a quick outline of how to plot the magnitude response of your filter using white noise and Matlab.

Step 1: In Matlab, generate some white noise. One way to do this is

fs = 44100; % sampling frequency

T = 10; % duration

x = randn(fs*T,2); % stereo white noise

x = 0.99*x/max(max(abs(x))); % normalize

sound(x,fs); % play sound

Step 2: Make sure you have a clean playback/recording loop and that your volume levels are set correctly. Connect your line out (or headphone out) jack directly to your line in (or mic in) jack. Begin recording in, for example, Goldwave, and then run your Matlab script to play the white noise. You should not see any clipping during this test.

Step 3: Get ready to test your filter. Connect your line out (or headphone out) jack to the line in jack of the DSK. Connect your DSK's line out jack to the line in (or mic in) jack of your computer. Go into CCS and load your filter program to the DSK. Run it.

Step 4: Test your filter. While the DSK is running your filter code, start recording in Goldwave. Play the white noise signal from Matlab until it finishes. Make sure there was no clipping in the recorded signal. Trim off the ends of the recording to remove the transients and background system noise. Save the recording as a .wav file.

Step 5: In Matlab, analyze the recording. One way to do this is

[y,fs] = wavread('fname.wav'); % read your recording

[Py1,f] = pwelch(y(:,1),1024,512,1024,fs); % estimate psd of left channel

[Py2,f] = pwelch(y(:,2),1024,512,1024,fs); % estimate psd of right channel

plot(f/1e3,10*log10(Py1),f/1e3,10*log10(Py2)); % plot psd in dB

grid on

xlabel('frequency (kHz)');

ylabel('magnitude response (dB)');

Step 6: Compare your results to your theoretical predictions. Note that you may need to apply overall scaling to the PSD but you should otherwise have good agreement between the theory and the actual filter realization.

Can you explain how this technique works?

how to interpret the df-ii second order sections header file generated by matlab

The C header files generated by Matlab for IIR filters with the DF-II SOS realization structure can be a bit cryptic. Here is how to interpret those header files.

When you open your C header file, you will see that there are two two-dimensional arrays, one for the numerator coefficients in each SOS and the other for the denominator coefficients in each SOS. Here is what the coefficient arrays might look like:

const int NL[MWSPT_NSEC] = { 1,3,1,3,1,3,1 };

const real32_T NUM[MWSPT_NSEC][3] = {

{

0.2557556629, 0, 0

},

{

1, 2, 1

},

{

0.191392228, 0, 0

},

{

1, 2, 1

},

{

0.1671115905, 0, 0

},

{

1, 2, 1

},

{

1, 0, 0

}

};

const int DL[MWSPT_NSEC] = { 1,3,1,3,1,3,1 };

const real32_T DEN[MWSPT_NSEC][3] = {

{

1, 0, 0

},

{

1, -0.5886620283, 0.6116847396

},

{

1, 0, 0

},

{

1, -0.4405193925, 0.2060882896

},

{

1, 0, 0

},

{

1, -0.3846336901, 0.05308004469

},

{

1, 0, 0

}

};

Each row contains 3 coefficients. The numerator (NUM) coefficients in each row, from left to right, are b[0], b[1], and b[2], in our class notation. By the same token, the denominator (DEN) coefficients in each row are a[0], a[1], and a[2]. Note that a[0] is always equal to 1 and that we don't use it in our calculations (refer to the input/output equation given in lecture and in your textbook). The rows are processed from top to bottom. Denoting the first row of each array as "row 0", here is how it works.

Notice that the second and third coefficients in each of the even numbered (0,2,4,...) rows are always equal to zero. If you were to actually do all of the SOS computations here, you would see that these rows only apply a gain to the current input. For example, the effect of row 0 in this case is to multiply the current input sample by the gain of 0.255755629. That is all this row does. The same idea applies for rows 2, 4, and 6 (note that row 6 is just a gain of 1, which does nothing). These gains are part of the realization structure (see Matlab's help) and it is important that you implement them correctly to get the correct overall gain for your IIR filter.

Notice that the odd numbered rows (1,3,5,...) usually have non-zero numbers in all three coefficients. In this case, we have three such rows, which agrees with fdatool's design generating three second order sections (for this example). You have to do all of the SOS calculations for these rows. Just follow the procedure discussed in class: (i) compute u[n] using the denominator coefficients (and your scaled x[n] from the prior row) and then (ii) compute y[n] using the numerator coefficients. Since you know that you always have 3 coefficients in this case, you should be able to write one SOS function that does this efficiently.