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.

IFFT & FFT in CCS5

Other Parts Discussed in Thread: TMS320C6416

Hello to all,

I am trying to perform a simple radix 2 IFFT followed by an FFT using CCS v5.

Since TI is saying that it's better to conjugate the input to the FFT function aswell as the output sequences to get the result of IFFT instead of just conjugating the twiddle factors following the spra884a guide, I assumed that once i do that and follow it by the same FFT routine I get the original signal which wasn't the case for me,i put some of the code I am using  so you can see how I proceeded, I can't get a hold of what I did wrong ..I thought of bit reversing the results after each FFT routine but it didn't work after all. I am using the TMS320C6416 and the release mode in CCS if it ever matters.

Any help would be very appreciated. 

#define N (128)


#pragma DATA_ALIGN (x, 8)

#pragma DATA_ALIGN (xx, 8)

#pragma DATA_ALIGN (y, 8)

#pragma DATA_ALIGN (w, 8)

short x[2*N];
short xx[2*N];
short w[2*N];

void main ()

{

/*The main routine*/

gen_twiddle(w, N, scale);

/* ==================================================================== */
/* Conjugate the input to perform IFFT. */
/* ==================================================================== */
for(i=0; i<N; i++)
{

x[2*i+1] = -x[2*i+1];

}

/* ==================================================================== */
/* Perform Radix2 FFT */
/* ==================================================================== */

radix2(N, x, w);

/* ==================================================================== */
/* Conjugate the output to to get the results of the  IFFT. */
/* ==================================================================== */

for(i=0; i<2*N; i++)

{

if(i<N) x[2*i+1] = -x[2*i+1];

}

 

/* ==================================================================== */
/* Perform Radix2 FFT */
/* ==================================================================== */


radix2(N, x, w);

}

  • Hi,

    Thanks for your post.

    I agree with the  spra884a guide saying to conjugate the input before performing FFT function, perform FFT, conjugate the output FFT to obtain the result of IFFT.

    But in reality, it would be recommended that you can re-use fft16x32 or ft32x32 kernel functions to obtain IFFT results from FFT routines. This can be done through first conjugating the input, performing the FFT and conjugating once again which allows fft16x32 or ft32x32 to perform the IFFT as well. Howeve, if you want to avoid double conjugation then the "DSP_ifft32x32" or "DSP_ifft16x32" routines should use the same twiddle factors as the FFT and performs an IFFT. Hence these IFFT routines uses the same twiddle factors as the fft32x32 or fft16x32  routine uses.

    I think, you are aware the twiddle factors uses a fixed scaling factor but since the IFFT functions do not perform automatic scaling, the input data needs to be scaled by 2^ log2(nx) inorder to prevent overflow. Please ensure the input data scaled to the same.

    Please refer the DSP library references for IFFT routines "DSP_ifft32x32" and "DSP_ifft16x32" kernels and their detailed description and special requirements to be met from the spru565b doc. below:

    http://www.ti.com.cn/cn/lit/ug/spru565b/spru565b.pdf ( see pages 4-53 to 4-56 for IFFT routines)

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • Hi,

    Thank you for your reply,

    But would you please correct me if I'm wrong, I know I'm still new to all this and maybe I missed something, but, doesn't these functions "DSP_ifft32x32" or "DSP_ifft16x32" perform mixed radix IFFT..!

    For me it has to be a radix 2 routine for some research purposes, that's why I only use the dsp_radix2 library from the DSP library provided by TI.

    Best regards.

  • Hi,

    Ok, I do understand your concern.

    Are you conjugating twiddle factors as well in addition to conjugating the input to the FFT function and output of FFT results. I would recommend you to do either one of methods below:

    1. Either use FFT to compute IFFT with conjugated twiddle factors

    2. Alternatively, you could try conjugating the input before performing FFT, perform FFT and then conjugate the outputs of FFT to obtain the final result of IFFT

    Choose any one of the above methoed to compute IFFT from FFT but do not append both the methods which i mean is, don't conjugate twiddle factors inaddition to the input & output of the FFT functions together which is wrong and do either any one on the same.

    Also, take care of input data scaling by 2^ log2(nx) inorder to prevent overflow.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • Hi,

    I think, the DSP kernel library functions "DSP_fft16x32" and "DSP_fft32x32" perform a series of radix-4 FFTs followed by a radix-2 FFT, if needed. So, i do understand that these kernels can be used for radix2 FFT as well, incase if it is really needed in addition to performing mixed radix IFFT.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------