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.

Computing FFT on C6713

Expert 2370 points


Hi,

Referring to given below post, I implement 1024 points FFT for real time sine wave using FFT Code given by (TI guy). I have some confusion about length of Data and Twiddles factors.

http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/115/p/12340/48185.aspx#48185

In my program, I defined them following way.

#define BUFFSIZE 1024                              // No. of FFT Points
#pragma DATA_ALIGN(fft_buffer, 8)        
float fft_buffer[2*BUFFSIZE];                       // FFT input
#pragma DATA_ALIGN(twiddles, 8)
float twiddles[BUFFSIZE];                          // twiddle factors
short bitrev_table[BUFFSIZE];

Here I am converting input samples into complex pair before applying FFT function

for(k=0; k < 2*BUFFSIZE; k++)
           
            {
                fft_buffer[2*k] = (float)gBufferRcvPing[k];
                fft_buffer[2*k+1] = 0.0;
            }

then calling FFT function as given in Brad's folder.

fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);   

The size of fft_buffer is 2*BUFFSIZE and I am performing 1024 point FFT.

Am I using the right way to calculate FFT ?

I don't know whether I should transform input signal into complex pair before computing FFT or not ?

Should the length of twiddle factor be same as of no. of FFT points (BUFFSIZE) or fft_buffer [2*BUFFSIZE] ?

Please help me correcting my confusion.

Thanks and Regards.

  • BAS said:

    for(k=0; k < 2*BUFFSIZE; k++)
               
                {
                    fft_buffer[2*k] = (float)gBufferRcvPing[k];
                    fft_buffer[2*k+1] = 0.0;
                }

    Why are you iterating through your loop 2*BUFFSIZE times?  Since you're writing 2 samples per loop you should only iterate BUFFSIZE times.  Whatever happens to reside just after you loop is getting blown away unless I'm completely misreading this (which is possible since it's very late!).

    BAS said:

    fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);   

    The size of fft_buffer is 2*BUFFSIZE and I am performing 1024 point FFT.

    Am I using the right way to calculate FFT ?

    I think so -- it at least matches with my example and although it's been 5.5 years since I wrote that code I remember using Matlab to verify the output.

    BAS said:
    I don't know whether I should transform input signal into complex pair before computing FFT or not ?

    Are you asking about the format of your "fft_buffer"?  If so, yes, it should be composed of complex pairs in which case stuffing zeros into the odd samples is correct for a real-valued input.

    BAS said:
    Should the length of twiddle factor be same as of no. of FFT points (BUFFSIZE) or fft_buffer [2*BUFFSIZE] ?

    What you have in your example code looks right, i.e. matches my earlier example anyway...