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.

FFT for Real Input

Other Parts Discussed in Thread: OMAPL138, ADS62P45

Hi,

Since i am working with Hawkboard (OMAPl138), i have later to capture digital data from an ADS62p45 (14 Bits) and calculate from those digital data the FFT and plot the FFT graph on touch screen connected to the Hawkboard.My input data are real.

For the first test i downloaded the example project for calculating the Real FFT (Real_FFT_Demo) and i imported it  using CCS4.0.You can find the project in the following link: http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input

This example calculates the real FFT for N= 512 points input. Once i changed the value of to N=16384 corrosponding my ADC (2^14 bits) and run the program,  i am getting this result:

Clocks for 16384 Complex FFT = 0

Complex FFT Reconstruction:**FAIL**

Clocks for 16384 Real FFT using N/2 Complex FFT= 0

Real FFT using complex N/2 FFT:**FAIL**

Real FFT Reconstruction using complex N/2 FFT:##PASS##

The code works successful for all values of N= 2^n for n<14 and i am getting this result wenn N= 2^n for n<14, e.i. 8192 points input

Clocks for 8192 Complex FFT = 0

Complex FFT Reconstruction:**PASS**

Clocks for 8192 Real FFT using N/2 Complex FFT= 0

Real FFT using complex N/2 FFT:**PASS**

Real FFT Reconstruction using complex N/2 FFT:##PASS##

If some bady here know why, i would appreciate so much.

Regards

Moadh

 

  • Moadh,

    What version of the C674 DSPLIB are you using?  Older releases didn't support FFTs with size greater than 8192.  Make sure that you are using version 1.2, available at this link:

    http://focus.ti.com/docs/toolsw/folders/print/sprc900.html

    Also, I'm not sure I understand why your FFT length is dictated by the number of bits output by your ADC.  The N value used by the FFT algorithm refers to the number of data samples in the input and output buffers.  It's not related to input values themselves.  If you wanted to break up your input into 1024-sample buffers, it would be perfectly valid to do so.  (Of course, the higher N you use, the greater resolution your FFT will have.)

    Hope this helps.

  • Joe,

    Thank you for reply.

    Actually i use DSPLIB 1.2. The DSPLIP 1.2 was allready included,once i mport the project Real_FFT_Demo. The project is available under this link:

     http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input     under  Example Code C

    If you have time and you use CCS4 you can import it and run it.

    Other question: If my input consist of 512 points,does this mean that the FFT length should be also 512. Cause i noticed in this project  that the FFT length is much greater than the input length N.

    Regards

  • Moadh,

    If you have 512 (real) data points per input buffer, then your N for the FFT should be 256.  You will still have 512 values in the input buffer, but the FFT algorithm will interpret them as 256 complex values (i.e. real/imaginary pairs).  That's the "trick" behind the real FFT method: we compute a half-size FFT since there is no imaginary data to begin with.  The FFT function will output 256 complex values, and the remaining 256 are easy to fill in since the FFT of an all-real sequence is symmetrical.

    Hope this helps.

  • Jeo,

    Yes that's right,but what i meant is: If i have 512 sample points in the time domain,how many points i will have in the frequency domain,or how many places does the Erray  FFT[ x]  have?

    And what do you recomend regard the first qestion?

    Regards.

  • Moadh,

    I'm not sure I understand the question.  If you start with a 512-point real sequence, your FFT data will have 1024 values representing 512 complex numbers.  Using the real FFT trick, you can obtain this sequence by computing a 256-point FFT (i.e. N = 256).

  • Moadh,

    The FFT and inverse FFT code included in that fft example appears to be from an earlier revision of the C674x DSP library. Can you update the DSPF_sp_fftSPxSP.asm and DSPF_sp_ifftSPxSP from the latest version of C674x DSPLIB. You can download this from here http://focus.ti.com/docs/toolsw/folders/print/sprc900.html.

    This code has been verified to compute single precision FFT upto 64K samples. Refer to c674x/dsplib/src/DSPF_sp_FFTSPxSP for example code. Let us know if this resolves the issue that you are observing.

    Best Regards,

    Rahul

  • Hi Rahul,

     

    I just tried to update the DSPF_sp_fftSPxSP.asm and DSPF_sp_ifftSPxSP.asm  from the latest version of C674x DSPLIB and and it works with 16384 points. I appreciate it so much and i'm thankful for this.I lost so much time with this problem.

    Thank you again and hope i can ask you in case of confronting other in this context.

    Best regards

    Moadh

  • Hi Rahul,

    I'm try to get the FFT result from the Memory and i plot them in Code composer and excel,but i don't get the same plot which the TSW1200 gives..I'm getting different plot.


    Are the FFT values which are calculated in the Project Real_FFT_Demo in dBFS?


    Why am i getting positive values ,although in the TSW1200 all of Mgnitude of the FFT are below the zero?


    Does this code calculate the harmonics of the signal?


    Which changes scould i do in the Code to get almost the same plot as of the TSW1200?


    If you can answer some of this questions ,it would be great.

    Kind regards,,
    Moadh

  • Moadh,

    Here are answers to some of your questions.

    Are the FFT values which are calculated in the Project Real_FFT_Demo in dBFS?
     -> No, the values are not in dBFS.

     

    Why am i getting positive values ,although in the TSW1200 all of Mgnitude of the FFT are below the zero? Which changes scould i do in the Code to get almost the same plot as of the TSW1200?

    è This is something that can only be answered by taking a closer look at your code. Is it possible for you to share the project with us. Are you using radix equal to 4 in your code for the 16384 point FFT?

     

    Does this code calculate the harmonics of the signal?

    è The output of the FFT will give you values corresponding to frequencies from 0 to Fs  which will be symmetric about N/2 (Hermitian symmetry). So the magnitude at x sample will be same as magnitude at N-x sample.

     

    Regards,

    Rahul