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.

IRFFT with FPU on 28377

Other Parts Discussed in Thread: TMS320F28377D, CONTROLSUITE, TMS320F28375D

Hi all i am using TMS320F28377D for my application.

I want to do FFT on an incoming signal, for that i have taken reference of RFFT form control suite example,

c:\ti\controlSUITE\libs\dsp\FPU\v1_50_00_00\examples\fft\2837x_rfft_adc_rt

But i was wondering why there is no "Inverse RFFT" example with FPU?

  • Hi,

    I'm not sure why there isn't one - this is the first time someone has requested it since i joined TI. I will put in a ticket to look at implementing it - I know how the forward RFFT is done but it will take some time to figure out the reverse.

    I doubt it will make it to the next release as I am close to code freeze on that, but the one after that is more likely.
  • K3y4r said:
    But i was wondering why there is no "Inverse RFFT" example with FPU?

    K3y4r,

    I would like to learn more regarding how you are using the inverse RFFT. 

    Is your question out of curiosity, for testing, or do you need the inverse RFFT for an end application? 

    Thank you

    Lori

  • Hi Lori,

    I want to do FFT of an incoming signal then do some processing on it (while the signal is still in frequency domain) and then doing inverse FFT to generate the modified time domain signal.

    Some details.

    • Number of samples : 256
    • Fundamental frequency:50 Hz
    • Frequency of interest:  upto 2550 Hz
    • Processor: TMS320F28375D

    For finalization I am benchmarking different methods and libraries for  FFT in terms of speed and performance.

    I am exploring the VCU library and FPU library.

    And i am also exploring some methods of DFT which are not part of library like STFT and Goertzel algorithem.

    During that time i came acorss this question.

    If you have any suggestion or advice for optimized  way of calculating FFT you are most welcome.

  • K3y4r,

    You can use RFFT to compute the IRFFT.  Suppose you had a real valued discrete-time sequence x(k) on which you took the FFT and determined the result X.  To get back to x(k) from X, you do this:

    1) Swap the real and imag parts of each member of the complex input array X.

    2) Perform the complex FFT

    3) Swap the real and imag parts of each memory of the complex result.  You will find that the imag part is actually all zero since x(k) was real valued.  So, you don't really have to do a swap.  Rather, just discard the real part, and take the imag part as the result.

    4) Scale the result by 1/FFTSize.  This is the original x(k).

    The ICFFT function in the FPU library uses this technique, although for CFFT you do get both real and imaginary parts at step 3.  For RFFT, you only have imag part at step 3.  Anyway, the above works.  You could implement this by writing a small C function that calls the RFFT function in the FPU library, and performs the necessary swapping before and after, and the post scaling.

    Regards,

    David

  • Hi David,
    Thanks for the suggestion.
    I see that same thing is done in example with VCU library

    C:\ti\controlSUITE\libs\dsp\VCU\v2_10_00_00\examples\fft\2837x_vcu2_rifft_256

    Regards,
    Keyur
  • I also request IRFFT on F28377D, especially TMU version. Since TMU gives faster results, it would be useful for me.
  • Is it possible to generate x(k) from phase and magnitude outputs?
  • I suppose you could, since you have the phase (theta) and magnitude (M) you can get the complex spectrum as follows (i think i got the math right -- someone will correct me if its wrong)

    theta = tan(y/x) and M = sqrt(y^2+x^2)

    solving 

    x = +- sqrt(M^2/(arctan(theta)^2 + 1))  ----> its the +- that is problematic i think you can figure out the sign from the quadrant

    y = x*arctan(theta)

    Once you have the complex spectrum you do an inverse FFT. Its a cycle intensive operation to be sure.