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.

Computing real number FFT

Other Parts Discussed in Thread: TMS320C5535

Hello,

I use the kit TMS320C5535 with CCS V5.5.0 platform. In the application I'm developing, I need to calculate the FFT of an input signal. I use the function RFFT from DSPLIB.h library for this. This function takes an input vector of type DATA, and calculates the FFT of this vector,  which would be of real elements (FLOAT type).

However, when testing, I noticed that the function was not computing data as the actual type (float). I made a function to print the array elements of type DATA, which returned me the elements without the real part. For example my element was 2154.574, and printed, was 2154.000. The ignored element part(0.574) would be of great importance in my application.


My problem is, how to use elements of type float in an array of type DATA without it losing its precision in RFFT function?


How can I solve this problem?

  • Hello,

    DSPLIB works with fixed-point integers only - no float types.

    Look at the typedef for DATA - it is actually a short integer - typedef short DATA; (in TMS320.H)

    In the DSPLIB user's guide, the DATA type is further defined as Q.15 fractional fixed-point format:

    http://www.ti.com/lit/ug/spru422j/spru422j.pdf

    DSPLIB handles the following fractional data types:
    Q.15 (DATA) : A Q.15 operand is represented by a short data type (16 bit)
    that is predefined as DATA, in the dsplib.h header file.

    Hope this helps,
    Mark

  • Mark, thanks for replying.

    So if I change the type of vector for LDATA, which uses the format Q.31 will work? Or there is not how to calculate the FFT of a vector of real numbers?

    There is function RFFT32 in the DSPLIB library, that instead of receiving an input vector type DATE, receives LDATA, and also calculates the FFT vector.

     

    Thanks for listening,

    Rubem

  • Hello Rubem,

    How does the data for the input signal get into the C5535? Are you capturing from ADC? What is the original bit depth and format?

    The C5535 DSP is a fixed point processor. It does not have support for float, at least not directly. You can convert from float to fixed, but it might be easier to avoid float entirely. However, I suspect that your data does not originate in float at all. Q.15 and Q.31 are both Real numbers, in the sense that they can take on fractional values. However, the values can only range from -1 to +1. With fixed point data, you have to take core of overflow and underflow, but otherwise you're still dealing with Real numbers. dsplib distinguishes between Real and Complex numbers, with the assumption that Real numbers are fixed-point, not floating-point. Does this clarify?

    Brian

  • Hello Brian,

    You answered my question.
    Thanks for listening.
     
    Rubem