<< Chapter < Page Chapter >> Page >

Line 31 branches back to the top, where we wait for the next block to arrive and start over.

Using test vectors

A second version of the core file offers the same interface as the standard core file, but instead of reading inputsamples from the A/D converters on the six-channel board and sending output samples to the D/A converters, it reads andwrites from test vectors generated in MATLAB.

Test vectors provide a method for testing your code with known input. Given this known input and the specificationsof the system, we can use simulations to determine the expected output of the system. We can then compare theexpected output with the measured output of the system. If the system is functioning properly, the expected output andmeasured output should match

Will the expected output and the actual output from the DSP systemmatch perfectly? Why or why not?

Testing your system with test vectors may seem silly in some cases, because you can see if simple filters work by lookingat the output on the oscilloscope as you change the input frequency. However, they become more useful as you writemore complicated code. With more complicated DSP algorithms, testing becomes more difficult; when you correct an errorthat results in one case not working, you may introduce an error that causes another case to work improperly. This maynot be immediately visible if you simply look at the oscilloscope and function generator; the oscilloscope doesnot display the signal continuously and transient errors may be hidden. In addition, it is easy to forget to check allpossible input frequencies by sweeping the function generator after making a change.

More importantly, the test vectors also allow you to test signals that cannot be generated or displayed with theoscilloscope and function generator. One important signal that cannot be generated or tested with the functiongenerator and oscilloscope is the impulse function; there is no way to view the impulse response of a filter directlywithout using test vectors. The unit impulse represents a particularly good test vector because it is easy to comparethe actual impulse response of a digital filter against the expected impulse response. Testing using the impulseresponse also exposes the entire range of digital frequencies, unlike testing using periodic waveformsgenerated by the function generator.

Lastly, testing using test vectors allows us to isolate the DSP from the analog input and output section. This is usefulbecause the analog sections have some limitations, including imperfect anti-aliasing and anti-imaging filters. Testingusing test vectors allows us to ensure that what we see is due only to the digital signal processing system, and notimperfections in the analog signal or electronics.

After generating a test vector in MATLAB, save it to a file that can be brought into your code using the MATLAB command save_test_vector (available as save_test_vector.m ):

>> save_test_vector('testvect.asm',ch1_in,ch2_in); % Save test vector

(where ch1_in and ch2_in are the input test vectors for input channel 1 and input channel 2; ch2_in can be omitted, in which case both channels of the test-vector input will have the same data.)

Next, modify your code to include the test-vector support code and the test-vector file you have created. This can bedone by replacing the first line of the file (which is a linker directive to copy in core.asm ) with two lines. Instead of:

.copy "core.asm"


.copy "testvect.asm" .copy "vectcore.asm"

Note that, as usual, the whitespace in front of the .copy directive is required. ( Download vectcore.asm into your work directory if you do not already have a copy.)

The test vectors occupy the .etext section of program memory between 08000h and 0FEFFh . If you do not use this section, it will not interfere with your program code or data. This memoryblock is large enough to hold a test vector of up to 4,000 elements. Both channels of input, and all six channels ofoutput, are stored in each test vector element.

Now assemble and load the file, and reset and run as usual. After a few seconds, halt the DSP (using the Halt commandunder the Debug window) and verify that the DSP has halted at a branch statement that branches to itself: spin b spin .

Next, the test vector should be saved and loaded back into MATLAB. This is done by saving 6 k memory elements (where k is the length of the test vector in samples, and the 6 corresponds to the six output channels) starting withlocation 08000h in program memory. Do this by choosing File->Data->Save... in Code Composer, then entering the filename output.dat and pressing Enter . Next, enter 0x8000 in the Address field of the dialog box that appears, 6 k in the Length field, and choosing "Program" from the drop-down menu next to "Page." (Always ensure that youuse the correct length - six times the length of the test vector - when you save your results.)

Last, use the read_vector function (available as read_vector.m ) to read the saved test vector output into MATLAB. Do thisusing the following MATLAB command:

>> [ch1, ch2, ch3, ch4, ch5, ch6] = read_vector('output.dat');

The MATLAB vectors ch1 through ch6 now contain the output of your program code in response to the input from the test vector.

Questions & Answers

how can chip be made from sand
Eke Reply
is this allso about nanoscale material
are nano particles real
Missy Reply
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
where is the latest information on a no technology how can I find it
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
Application of nanotechnology in medicine
has a lot of application modern world
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
yes that's correct
I think
Nasa has use it in the 60's, copper as water purification in the moon travel.
nanocopper obvius
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
analytical skills graphene is prepared to kill any type viruses .
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now

Source:  OpenStax, Dsp laboratory with ti tms320c54x. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10078/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Dsp laboratory with ti tms320c54x' conversation and receive update notifications?