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.

F28069 - RFFT32 issue

Hi everyone,

Even after the reading of http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/146974.aspx and http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/21202.aspx I still have some issues with my FixedPoint FFT (my previous floating point was working well).

Here is my code :

#include "fft.h"
#define  FFT_SIZE   1024


// FFT SECTIONS
RFFT32 fft=RFFT32_1024P_DEFAULTS;
#pragma DATA_SECTION(Fft_in,"FFTIN");
long Fft_in[2*FFT_SIZE];
#pragma DATA_SECTION(Spectro,"FFTOUT");
long Spectro[(FFT_SIZE/2)+1];


// FFT CALCULATION
void realfft(void)
{
	fft.ipcbptr=Fft_in;
	fft.magptr=Spectro;
	fft.init(&fft);

	RFFT32_brev(Fft_in,Fft_in,FFT_SIZE);
	fft.calc(&fft);
	fft.mag(&fft);
}

And my magnitude buffer Spectro stays empty... Should I move on CFFT32 like Vishal said in the other topic ? Or do you find any error that could explain that ?

Btw, I didn't really understand how this RFFT works (when the Floating Point FFT is logical, this one is hard to understand), if you have further explanation, I'd be glad to read them ! (datasheet read and re-read).

Regards,

Alex

  • Hi Alex

    There doesnt seem to be anything wrong with the snippet of code you have attached. Perhaps you need to look at your input data. Is it in Q30 format?

    Can you try injecting a simple sine wave and seeing what the FFT output is?

    If you want to understand the mechanism behind the real FFT this is a good resource: http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM

  • Hi Vishal,

    Thanks for the answer !

    I finally moved on CFFT like you explained in the other thread and I got spectral Peak on both my Output buffer and my Magnitude buffer (2 pikes for the Output buffer because of the Complex and 1 peak in my Magnitude buffer).

    But now, a new issue came out ! With a sampling frequency of 60kHz for my ADC, I'm supposed to be able to mesure up to 30kHz (Shannon compliant). And, normally, the formula to determine the frequency from the peak position is :

    Freq_input = ((Peak position + 1)/(Number of samples))*Sampling_freq

    But the peak is never at the right place, here is a graph showing the "Peak position after FFT" with "Input frequency".

    In Red, pikes from Magnitude buffer, in blue, from Output buffer.

    I thought it was an issue with my sampling frequency but I double checked and it is all clear.

    So, it could an issue with the Q30 format but I don't know how to convert my ADC results buffer into a Q30 buffer. 

    Regards,

    Alex

  • Hi Alex,

    If your adc gives you a 12-bit reading you need to multiply by 2^19(524288) to get it to Q30 format if you want that to be your input format. So basically you would be doing the following mapping:

    -2048 ->-1073741824 (0xFC0000000 or binary 01.00 0000 0000 0000 0000 0000 0000 0000 ~ decimal -1.0)

        | |

        V

    everything in between * 524288

        | |

        V

    2047 -> 1073217536(0x3FF80000 or binary 00.11 1111 1111 1000 0000 0000 0000 0000 ~ decimal 0.999...)

    So you are effectively converting your 12 bit hex input to the -1.0 to 0.999... decimal range when you convert to Q30 format.

    Also, Im confused as to how your magnitude plot has come out with a lower amplitude than your complex FFT output.

  • Hi Vishal,

    Finally, I decided to use the Floating Point FFT to do my stuff but I appreciate the help !

    Thanks,

    Alex