This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320C5505: FFT Scaling

Part Number: TMS320C5505

Dear,

here is my input signal,

30
28
25
21
14
13
11
12
4
4
2
1
0
0
0
0
0
0
0
0
0
1
0
2
1
5
7
7
10
12
14
17
18
20
28
36
38
42
47
52
56
61
68
72
78
84
90
95
103
108
113
121
129
135
143
148
157
162
171
176
184
192
199
206
212
219
228
238
244
252
258
264
273
277
284
292
298
301
311
316
322
328
332
340
345
353
354
359
364
368
372
374
382
382
386
385
386
386
387
385
391
389
391
389
384
388
387
387
385
386
390
385
387
384
388
384
382
378
378
377
375
368
365
361
358
353
349
347

taken from adc...and its FFT output is with NOSCALE flag is as follwos

25716.000000,0.000000
-1042.386592,13037.298217
-243.499736,3349.075203
-79.273146,2193.355203
-175.615872,1725.259542
-236.459012,1371.154080
-179.383405,1046.971754
-132.099204,878.686838
-164.906974,760.256636
-143.303695,697.028739
-152.275221,605.649875
-146.450374,554.268088
-181.988554,517.542220
-166.062919,476.028315
-132.578647,422.160808
-126.662994,394.949783
-171.656854,394.516811
-150.630487,348.011155
-137.653005,323.477359
-134.994928,303.662997
-165.260173,300.285507
-150.359626,279.822706
-162.935188,252.204921
-165.129580,223.812888
-163.854174,241.428649
-160.545203,210.004491
-163.200512,190.336775
-163.291767,174.991426
-169.384560,180.723245
-125.329504,183.079304
-151.346771,188.756678
-177.504705,169.471903
-168.000000,170.000000
-161.753997,156.049864
-155.394409,143.791947
-161.372964,138.908965
-146.768715,146.002553
-150.787707,133.797404
-169.700965,107.868692
-154.389277,122.631185
-150.974253,104.194018
-149.049749,83.794887
-156.003722,102.120855
-166.096960,83.692498
-155.187192,90.723595
-155.565359,67.223148
-147.197846,70.647072
-173.506704,81.495873
-160.343146,66.516811
-158.093177,61.038877
-143.181647,60.129444
-152.790614,66.609687
-172.877789,60.658231
-168.136723,31.191737
-152.258651,37.358305
-140.408811,34.499033
-144.264599,15.022005
-141.940732,42.714794
-182.869753,23.534265
-162.008799,3.106946
-160.917145,3.216773
-163.098676,8.191766
-162.520523,-15.852507
-164.516014,-13.713830
-140.000000,0.000000
-164.516014,13.713830
-162.520523,15.852507
-163.098676,-8.191766
-160.917145,-3.216773
-162.008799,-3.106946
-182.869753,-23.534265
-141.940732,-42.714794
-144.264599,-15.022005
-140.408811,-34.499033
-152.258651,-37.358305
-168.136723,-31.191737
-172.877789,-60.658231
-152.790614,-66.609687
-143.181647,-60.129444
-158.093177,-61.038877
-160.343146,-66.516811
-173.506704,-81.495873
-147.197846,-70.647072
-155.565359,-67.223148
-155.187192,-90.723595
-166.096960,-83.692498
-156.003722,-102.120855
-149.049749,-83.794887
-150.974253,-104.194018
-154.389277,-122.631185
-169.700965,-107.868692
-150.787707,-133.797404
-146.768715,-146.002553
-161.372964,-138.908965
-155.394409,-143.791947
-161.753997,-156.049864
-168.000000,-170.000000
-177.504705,-169.471903
-151.346771,-188.756678
-125.329504,-183.079304
-169.384560,-180.723245
-163.291767,-174.991426
-163.200512,-190.336775
-160.545203,-210.004491
-163.854174,-241.428649
-165.129580,-223.812888
-162.935188,-252.204921
-150.359626,-279.822706
-165.260173,-300.285507
-134.994928,-303.662997
-137.653005,-323.477359
-150.630487,-348.011155
-171.656854,-394.516811
-126.662994,-394.949783
-132.578647,-422.160808
-166.062919,-476.028315
-181.988554,-517.542220
-146.450374,-554.268088
-152.275221,-605.649875
-143.303695,-697.028739
-164.906974,-760.256636
-132.099204,-878.686838
-179.383405,-1046.971754
-236.459012,-1371.154080
-175.615872,-1725.259542
-79.273146,-2193.355203
-243.499736,-3349.075203
-1042.386592,-13037.298217

and with SCALE Flag

203,0
65529,-100
65535,-24
0,-16
65535,-12
65534,-9
65535,-7
0,-5
65535,-5
0,-4
65535,-4
0,-3
65535,-3
65535,-3
65535,-2
0,-2
65535,-2
65535,-2
65535,-2
65535,-2
65535,-1
0,-2
65535,-1
65535,-1
65534,-1
65535,-1
65534,-1
65535,-1
65535,-1
65535,-1
65535,-1
65535,-1
65535,-1
65535,-1
65535,0
65535,-1
65535,-1
65535,0
65535,0
65535,0
65535,0
65535,0
65535,0
65535,-1
65535,0
65535,0
65535,0
65535,0
65535,0
65535,0
65535,0
65535,0
65535,0
0,0
65535,0
65535,0
65535,0
65535,0
65535,0
65535,1
65535,1
65535,0
65535,0
65535,1
0,0
65535,0
65535,1
65535,0
65535,0
65535,0
65535,0
65535,1
65535,0
0,0
65535,0
65535,0
65535,1
65535,1
65535,1
65535,0
65535,1
65535,1
65535,1
65535,0
65535,1
65535,1
65535,1
0,1
65535,2
0,1
65535,1
65535,1
65535,1
65535,1
65535,1
0,1
65535,2
65535,1
65535,2
0,1
0,1
0,1
0,1
65535,2
65535,2
65535,2
65535,2
0,2
0,3
65535,3
0,3
65535,3
65535,3
0,3
65535,4
65535,4
0,4
0,4
65535,4
1,6
65535,6
0,7
0,8
65535,11
0,14
1,17
0,26
65530, 103

and i want to calculate frequency of the signal..actual frequency is 60Hz ..i set the sample rate=512Hz , and 128poin FFT so accordingly i should get an maximum amplitude at 15 bin but in both the scaling and nonscaling process i am getting it at Bin 1...??

that means frequncy is only 4Hz but that completely wrong..i really dont understand whats going wrong???

  • Kanchan,

    I would recommend that you refer to the following tutorial that talks about computing FFT of a Sine wave using DSPLIB. This should provide the right guidance on interpretation of the output as well as scaling the input before passing data to the DSPLIB FFT function.

    C55x_DSPLI_FFT_Computation.ppt

    If you still have questions after reviewing those slides, please post further questions that you have regarding this topic.

    The DSPLIB also has a unit test for each of the functions that you can use for your reference.

    Regards,

    Rahul

  • Dear Rahul,

    Thank u so much..I am using HWAFFT function for the implementation of FFT n tms320c5505.

    i dont understand how to interpret the results of hwafft to find the correct frequency components?? is there any interpretation document for hwafft output

  • plzzz reply

  • Hi Kanchan,

    Prove to yourself that you are using the expected sampling rate. The SAR ADC requires 32 SAR clocks to perform one conversion.

    Whenever you perform a SAR conversion, toggle the XF pin or some GPIO. Then measure the frequency of the pin - if you toggle it every time you sample, then the frequency of the pin will be half of the sampling rate. You can use asm(" BSET XF") and asm(" BCLR XF") to toggle the XF pin of the DSP high and low (assumes your project is set to use mnemonic assembly)

    If you are taking data from the SAR ADC, then there will be a DC offset unless you convert the numbers from the range [0 to 1023] to a 2's complement fractional number in the range [-1.0 to 0.999].

    If your input signal is centered about SAR VDD_REF / 2, then the values from 0 to 511 should map to a negative number.

    Keep in mind that the FFT is expectng to see real and imaginary numbers interleaved 16-bit Real, 16-bit Imag, ... SAR ADC will only provide real numbers. You would have to use software to to copy the real part from the SAR ADC into the Real parts of the Real,Imaginary interleaved buffer. All Imaginary parts will be zero.

    It is easiest for me to read the numbers as hexadecimal. Then you can tell if the MSB of the number is set to 1 that that 2's complement number is negative.

    You can also graph the array and the graphing tool will map the 2's complement numbers to the [-1 to 0.9999] range for you. See the below graph configuration. it defines the number as 16-bit signed, with 15 quotient bits. The Index Increment is set to 2 to skip over the imaginary parts. The invec shown here is a 512 long sine wave centered about 0 (in 2's complement).

    Hope this helps,
    Mark