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.

DSP Library cfft gives wrong results

So my input is a real sine wave with a period of ~60 points, and therefore a 512 or 1024-point cfft_SCALE function should give only one peak (or two, if consider the symmetry). However, there are peaks at multiples of 2 (16, 32 64 and 128, etc), and does anyone know how they are generated?

  • Just to add on: the input is actually from the codec of C5515 ezDSP, and even if there is no sound going into the stereo input, these peaks still persist. Is it like a "calibration" error? Thanks!

  • Hi,

    Team will address your request shortly.

    Regards,
    Sivaraj K

  • Sorry for the delay.

    See below suggestions for fixing this issue. Could you provide your input data vector?

    Input array expected to be in normal order format: real, imag, real, imag
        - would have to insert zeros for the imag part when real data is coming from the codec into
        - array would look like codec_sample_n, 0, codec_sample_n+1, 0, ...
        
    Fixed-point Number range
        CFFT expects number format to be DATA... DATA = Q.15 fixed point format for a range of [-1 to +1]
        void cfft (DATA *x, ushort nx, type) Radix-2 complex forward FFT - MACRO
        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

    Output is in bit-reversed order - did you run the data through bit reverse either before or after running CFFT()?

    Memory alignment
        Twiddle table must reside in SARAM block or DARAM block different than the DARAM block that contains the input data
        Also "twiddle table must be aligned on a 32-bit word boundary, and yet the twiddle.asm source does nothing to ensure that this happens. Adding a single line with " .align 1024" between the .sect and twiddle: label makes everything kosher"
        Input data must be aligned on 32-bit boundary
        
    Refer to TMS320C55x DSP Library Programmer’s Reference (attached)
    also refer to the DSPLIB cfft examples, and their input reference vectors

    Hope this helps,
    Mark

    2376.DSPLIB Programmers Reference.pdf