AnsweredAssumed Answered

FFT problem

Question asked by merragmo.miojge on Jun 12, 2011
Latest reply on Jun 13, 2011 by van_hooft.frank.001
I'm trying to calculate FFT of this signal (using Keil uVision and STM32F103VB:

flattu.jpg

but the result looks like this:

200e682.jpg

Here's the code:
/////////////////////////////////////////////////////////////////
const int N=256;
void fft(){
     int i;
     uint16_t real[N], imag[N];
     
     for(i=0; i<N; i++){
          real[i]=(uint16_t)(data[i]);
          imag[i]=0;
          x[i] = (((uint16_t)(real[i])) | ((uint32_t)(imag[i]<<16)));
     }
     cr4_fft_256_stm32(y, x, N);
}
/////////////////////////////////////////////////////////////////

data is a float array containing the sine signal. Pictures above shows x and y arrays.
Could anyone tell me what I'm doing wrong?

Please help.

Outcomes