Tool/software:
F280039和F2800132使用相同的库和同一组ADC采样数据计算fft,得到结果差异过大,不知道是什么原因造成的呢?
fft配置如下:
1、初始化
CFFT_f32_setInputPtr(hnd_cfft, AFCIDataBuffer);
CFFT_f32_setOutputPtr(hnd_cfft, FFTBuffer);
CFFT_f32_setTwiddlesPtr(hnd_cfft, CFFT_f32_twiddleFactors);
CFFT_f32_setStages(hnd_cfft, (FFT_STAGES - 1U));
CFFT_f32_setFFTSize(hnd_cfft, (FFT_SIZE >> 1));
2、计算FFT
float *p_temp;
int ii;
for (ii = 0; ii < 512; ii++)
{
AFCIDataBuffer[ii] = (float) fftWindow[ii]*pADC_data[ii];
}
for (ii = 512; ii < 1024; ii++)
{
AFCIDataBuffer[ii] = (float) fftWindow[(1024 - 1)-ii]*pADC_data[ii];
}
// Run the N/2 point complex FFT
// NOTE: Can only use the 't' version of the CFFT with the
// pack and unpack functions
CFFT_f32t(hnd_cfft); // Calculate FFT
// Run the unpack function on the N/2 point complex spectrum
// to get the N/2+1 point complex spectrum of the N point real
// data. The unpack function will generate the complex
// spectrum from F(0) to F(N/2).
// The pointer, p_currOutput points to the complex spectrum
// of the real N-point input data.
CFFT_f32_unpack(hnd_cfft);
//
// switch the CurrentInPtr and CurrentOutPtr pointers
//
//here check the buffer "test_output" for FFT results
p_temp = CFFT_f32_getCurrInputPtr(hnd_cfft);
CFFT_f32_setCurrInputPtr(hnd_cfft, CFFT_f32_getCurrOutputPtr(hnd_cfft));
CFFT_f32_setCurrOutputPtr(hnd_cfft, p_temp);
// Run the magnitude function
// Calculate magnitude, result stored in CurrentOutPtr
CFFT_f32_mag_TMU0(hnd_cfft);
fft输出结果如图
