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.

ratio parameter in C28x FFT library



Hi,

I am using the C28x fixed point FFT library ( http://focus.ti.com/docs/toolsw/folders/print/sprc081.html ) to do a correlation using 4096 point FFT and I am not getting correct results. I am pretty sure that the FFT and my implementation of IFFT (using the complex FFT) is working (I have tested it with an impulse input), but I wonder if I am getting overflow.

I am initialising my FFT structure as follows for the 4096 point FFT:

CFFT32  fft = { (long *)NULL,
        (long *)NULL,
        4096,
        12,
        (long *)NULL,
        (long *)NULL,
        0,
        0,
        1, /* ratio - what's this? */
        (void (*)(void *))CFFT32_init,
        (void (*)(void *))CFFT32_izero,
        (void (*)(void *))CFFT32_calc,
        (void (*)(void *))CFFT32_mag,
        (void (*)(void *))CFFT32_win};

What should the 'ratio' parameter be? There doesn't seem to be anything that describes it in the documentation.

regards,

Charles

 

 

  • This fixed point FFT library is messy and with a lot of bug. We are going to release a new version soon. 

    I have tested the fixed point CFFT code on my own computer. It works from 32 point to 256 point. Not more than that.

    I am not pretty sure the result in your own program in lower stage is also working well?

    The ratio is the search step of twiddle factor look-up table. You can calculate by using 4096/(number of  points).

    for example,

     

     

     

    #define CFFT32_64P_DEFAULTS    { (long *)NULL,\
            (long *)NULL,\
            64,\
            6,\
            (long *)NULL,\
            (long *)NULL,\
            0,\
            0,\
            64,\
            (void (*)(void *))CFFT32_init,\
            (void (*)(void *))CFFT32_izero,\
            (void (*)(void *))CFFT32_calc,\
            (void (*)(void *))CFFT32_mag,\
            (void (*)(void *))CFFT32_win}
    //   ratio 64=4096/64

    so in your case, the ratio is correct. But please try the lower stage of CFFT in your side at first. If the correct is still not correct. Let me know. I will sent you the matlab

    code and my example project for reference.

    Thanks

    Yu Cai

  • After I modified the CMD file and tested the code once more. It works for 512 points and 1024 points.

    Since the header file hasn't defined the 4096 defaults structure. I believe if you modified the CMD file you will get something.

    Given the quantization error problem. As the stages increased, the FFT result will no more accurate enough.

    It is not recommended using this CFFT code more than 10 stages.

  • Hi Charles, My application is using FFT and IFFT to extract the harmonic from 2nd (100Hz) to 20th (1000Hz) of an electric signal. I intend to use FFT 128 points with 6400 sample freq. But I wonder if I get the exact signal with 128 points FFT and IFFT ? Could you kindly tell a guide to use IFFT, I didn't find it in TI fixed point lib. Thanks so much, Cuong.
  • Hi Hoang Cuong,

    I'm not really sure what your question has to do with the ratio parameter in the C28x FFT library - it is a good idea to keep discussions on the topic of the title and original discussion to help others who are searching or following discussions.

    I can't say for sure whether you will get exactly what you want out of your FFT processing because I don't know what you are looking for, but I suggest that you Google to find some good descriptions of how FFT can be used, or find a good book on FFT or DSP. The guides provided by TI will only tell you how to use the library, but won't teach you digital signal processing.

    Good luck.

     

    regards,

    Charles

  • I hope the following is of your help.

    http://www.adamsiembida.com/node/23

    In short,  IFFT(X) = conj(  FFT( conj( X ) ) ); 

    Hope this helps. 

     

  • Dear Hiroshi Nomura,

    Thanks very much for your help. In the past I have found this fomular and it help me do the IFFT. By the way, could I make friend with you? My email: gnaohcuong@gmail.com.

    Regards,

    Hiangcuong.