Forums

FFT & sampling

Started by Boris Corrales February 12, 2004
Greetings:
I have a DSK 'C31 (tools: Dsk3121) and I'm trying to
make some experiences on it. I would appreciate your
help with the next questions:
- I connected a sin signal (3 kHz, 1.2 V) to sample it
(512 points Fs=8kHz), and stored the points in a
memory's sector. When I looked at the values (memd)
they were so big, (153550848, 126091264, 126091263,
168057025, 74043232, 74043168, 168057027,
211564171....).
I read thath these values are in two's complement
format, how can I give a physical sense to these
values to represent the sin signal (1.2, 1.1, 1.0 ,
...)?

- In the FFT1024.ASM program (included in the
DSK3121), the data arrays are packed, and theres a
quick log routine. How does it work? and: How can I
get the real values from the specter to get the
harmonics from any signal?

Thanks for your help

Boris Corrales

_________________________________________________________



Hello Boris

The FFT outputs floating point, not decimal outputs, so you should be using
the 'memf' command to look at the raw data values directly. I dont recall
everything about that particular FFT, but the raw data could be in
bit-reverse form making it difficult to decipher.

The array that goes PC is created from the raw data using the 'fastlog'
routine you found. Basically the fastlog output is an 8 bit log value
expressed in 7.1 fixed point allowing it to be packed into a smaller 128
word array that does go to the PC. This gives a 4:1 improvement in transfer
speed to the host PC.

But before you beat your head agains the wall, you might want to download
the latest tools at

VC33 DSK Web Page: focus.ti.com/docs/toolsw/folders/print/tmdsdsk33.html
C3x DSK Code: www-s.ti.com/sc/psheets/sprc147/sprc147.zip

The C31 DSK is supported, but the demo development basically stopped when
the VC33 DSK came about.

There are two FFT analyzers for the C31 DSK as well as a much more spiffed
up Windows version for the VC33 DSK. What you will likely appreciate most
is that these FFT's have a frequency auto measurement feature that scans the
FFT data for the strongest signal followed by a centroiding of the full
precision raw data (only needs to download 7 full precision values) to get a
very accurate frequency measurement. Hint: If you dig into this part of the
code (on the PC side) you should be able to determine where the harmonics
you are interested will be.

The fast logarithm is based on the fact that the exponent of a floating
point value is a log2 value that scales a fractional value (the mantissa) by
powers of 2 (..0.25, 0.5, 1, 2, 4...). The fractional mantissa provides the
additional accuracy and has a value ranging from 1.0-1.99. Interestingly,
when the mantissa is also take in log2 form, the fractional part almost
matches the true log2 value making it possible in many cases to be used as
an approximation.

For additional fast logarithm information I suggest looking into the
DSK3HELP.HLP file that comes with the latest tools. This is a big help
file, so it will help if you do a 'Content->Find' search on 'logarithm' to
find it.

Best regards,
Keith Larson
-
At 10:23 AM 2/12/04 -0600, you wrote:
Greetings:
I have a DSK 'C31 (tools: Dsk3121) and I'm trying to make some experiences
on it. I would appreciate your help with the next questions:

- I connected a sin signal (3 kHz, 1.2 V) to sample it (512 points Fs=8kHz),
and stored the points in a memory's sector. When I looked at the values
(memd) they were so big, (153550848, 126091264, 126091263, 168057025,
74043232, 74043168, 168057027, 211564171....).

I read thath these values are in two's complement format, how can I give a
physical sense to these values to represent the sin signal (1.2, 1.1, 1.0 ,...)?

- In the FFT1024.ASM program (included in the DSK3121), the data arrays are
packed, and theres a quick log routine. How does it work? and: How can I
get the real values from the specter to get the harmonics from any signal?

Thanks for your help

Boris Corrales
+--------------------------+
| Keith Larson |
| Member Group Technical Staff |
| Texas Instruments Incorporated |
| |
| 281-274-3288 |
| |
| www.micro.ti.com/~klarson (TI internal web only) |
|--------------------------+
| TMS320C3x/C4x/VC33 Applications |
| |
| TMS320VC33 |
| The lowest cost and lowest power 500 w/Mflop |
| floating point DSP on the planet! |
| |
| Web: focus.ti.com/docs/toolsw/folders/print/tmdsdsk33.html |
| Code: www-s.ti.com/sc/psheets/sprc147/sprc147.zip |
+--------------------------+