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.

CCS/LAUNCHXL-F28379D: CFFT on F28379D

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Dear colleagues,

I wrote an FFT operation with reference to the example program of F28379D, and the FFT size of it is 2048.

The program before the breakpoint runs without any problems.But when the program runs the "CFFT_f32(hnd_cfft)" , it will not continue and report an error.

Could this library function do a 2048 FFT operation?

I don't know what happened but after a day the program can run.

However, the result of FFT seems not correct.

Best regards,

Hao

  • Dear Hao,

    From the comments in lines 66-67 of the "fpu_cfft.h" header file, the FFT size seems to be limited to 2^10 = 1024:

    //! This routine computes the 32-bit floating-point FFT for an N-pt
    //! (\f$ N = 2^{n}, n = 5 : 10\f$) complex input.

    I will check with the library author and confirm.

    Regards,

    Richard
  • Dear Hao,

    From the author, since you are generating the twiddle factors at runtime you should be able to do a 2048 pt FFT. The CFFT_f32 algorithm should just iterate over the programmed number of stages, 12 in this case. The only thing to take care about is aligning the input buffer to a 4N boundary, so to an 8192 word boundary, in the linker command file.

    What was the error message you were getting?

    Regards,

    Richard
  • Hi Hao,

    The input buffer size must be 4 times the size of FFT. Since you are using a 2048 point FFT, you must have input buffer size = 4*2048;

    I can see in the picture you attached, the input buffer size is 4096, which is half of what is expected.

    Now, in the linker command file, you also need to change the "CFFT_ALIGNMENT" macro to 

    --define CFFT_ALIGNMENT=8192

    For more information, please check page 25 in ~\c2000\C2000Ware_1_00_XX_00\libraries\dsp\FPU\c28\docs\FPU_SW_LIB_UG.pdf

    Another thing that I would like to highlight here is, that your CFFT will be more optimized if you use the inbuilt twiddle factor tables instead of calculating the twiddle tables. For that, you will have to limit your FFT size to 1024. 

    Please let me know if this solves your problem or you have any other queries.

    - Ritvik

  • Hi Richard,
    The error didn't appear again. I thought it may be accidental. And the reason for miscalculated problem is that I didn't align the input buffer to a 4N boundary.
    Thank you for your help!
    Best regards,
    Hao
  • Hi Ritvik,

    Thank you for you help!

    I solve the problem by aligning the input buffer to a 4N boundary (the code you provided).

    Do you mean to use a inbuilt twiddle factor table rather than the code below?

        CFFT_f32_sincostable(hnd_cfft); 

    Where can I find the inbuilt twiddle factor table? I didn't find it in the example project.

    Best regards,

    Hao

  • Hao,

    To you use the tables, you must limit your FFT to 1024 points first. Then replace the following pieces of code:

    hnd_cfft->CoefPtr = CFFTF32Coef;
    with
    hnd_cfft->CoefPtr = CFFT_f32_twiddleFactors;

    and

    CFFT_f32(hnd_cfft);
    with
    CFFT_f32t(hnd_cfft);

    You can find the complete example at : ~\c2000\C2000Ware_1_00_XX_00\libraries\dsp\FPU\c28\examples\fft\2837x_cfft

    -Ritvik

  • Ritvik,

    Thank you very much, I think I understand how to do it.

    Best regards,

    Hao