<< 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 we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
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
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
How can I make nanorobot?
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
how can I make nanorobot?
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
While the American heart association suggests that meditation might be used in conjunction with more traditional treatments as a way to manage hypertension
Beverly Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

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?