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.

C28x FFT

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I'm using the C28x FFT Fixed Point library on a F2812 DSP. I have a problem with the DC component on the first FFT computation, then the value is correct. The value is like 10 times higher. The rest of the spectrum is ok. What I have done to fix the problem is to compute the FFT twice the first time. Here's a part of my code:

char fixbug = 1;

    switch (fft_state) {
        case FFT_STATE_IDLE:
                ...
                break;

        case FFT_STATE_START_ACQUISITION:
            ...
            break;

        case FFT_STATE_WAIT_ACQUISITION:
            ...
            break;

        case FFT_STATE_BREV:
            // Pack N point real data as N/2 and shuffle N/2 complex numbers in bit-reversed order
            RFFT32_brev(ipcbsrc, ipcb, FFT_N);    /* real FFT bit reversing */
            fft_state++;
            break;

        case FFT_STATE_WIN:
            // Windowing
            fft.win(&fft);
            fft_state++;
            break;

        case FFT_STATE_CALC:
            // Perform N/2 point radix-2 complex FFT computation
            fft.calc(&fft);
            fft_state++;
            break;

        case FFT_STATE_MAG:
            // Magnitude square computation
            fft.mag(&fft);
            fft_state++;
            if (fixbug)
            {
                fft_state = FFT_STATE_BREV;
                fixbug = 0;
            }
            break;

        case FFT_STATE_SCALING:
            for (i=0; i<(FFT_N/2+1); i++)
                mag[i] = _IQ30mpy(_IQ30(2.0/(512.0*WINDOW_SCALING_FACTOR)),_IQ30sqrt(mag[i]));    // Window Scaling et IQ30->IQ21
            fft_state++;
            break;

...

}

The samples I get in ipcbsrc are good. When I compute the FFT the first time, the DC is wrong. When I compute it a second time (samples didn't change), the DC value is good so it seems there's a problem within the library. By the way, the code in the library dates from Jan 6 2011. I downloaded the latest ControlSuite and it's the same code.

Anybody has the same problem?

Thanks!
Jocelyn