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.

A weired issued found with sprc081 (fft lib): Works in one project but not in another

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

The fft lib is working with my test project but failed with my main project, here is differences:

 

Differences of the 2 projects
Project Test project Main project
Languange Pure C FFT functions are coded with C but will finally called by C++
Run-time location RAM Flash
Code

#define N_SHIFT 7
#define N (1 << N_SHIFT)
#define PI 3.1415926f


#pragma DATA_ALIGN(Buffer, N << 2)
long Buffer[N+2];

/*
 * hello.c
 */
int main(void) {

 unsigned int i;
 
 RFFT32 fft = RFFT32_128P_DEFAULTS;

 // Number of periods to sample
 unsigned int Np = 10;

  // Sample step
 unsigned long Step = (_IQ(PI) * Np) >> (N_SHIFT - 1);

  fft.ipcbptr = Buffer;
 fft.magptr  = Buffer;
 fft.init(&fft);

 // Construct the signal
 for (i = 0; i < N; i++) {
  //Buffer[i] = _IQsin(Step * i) + _IQmpy(_IQ(0.33f), _IQsin(Step * i * 3));
  Buffer[i] = _IQsin(Step * i + _IQ(PI/3));
 }

 RFFT32_brev(Buffer, Buffer, N);

 fft.calc(&fft);

 fft.split(&fft);
 fft.mag(&fft);

return 0;

}

void AutoTuneCalcRFFT32_128P(INT32* pBuffer)
{
 // Calculating result
 RFFT32 fft = RFFT32_128P_DEFAULTS;
 fft.ipcbptr = pBuffer;
 fft.magptr = pBuffer;     
 fft.init(&fft);
 
 RFFT32_brev(pBuffer, pBuffer, 128);
 
 fft.calc(&fft);
 fft.split(&fft);
 fft.mag(&fft); 
}

Even the address of the buffer has been located to be the same, and I even tried saving the buffer(data) from the main project and then load to the buffer of the test project, but the calculating results (fft.calc(&fft);) are still not the same.

Did I missed anything?

Any comments are appriciated in advance.