2018-04-16 05:41 AM
Hello everyone I try to start the Fourier transform on stm32f303vc, but I get a strange result.
I take the following steps:
1.Since the result of the ADC is 12 bit, I move it 3 to the left to get the Q15 format.
2. Since the conversion has 128 samples, the result arm_rfft_q15 is obtained in 7.9 format, shift it to 6 bits to the left to get Q15
3.The result obtained, has a format of 2.14 and for receiving the 12-bit value, move it 2 to the left.
for(k=0;k<FFT_SIZE;k++)
{ fft_Sbuff[k] = current_point_fft<<3; }status = arm_rfft_init_q15(&S, FFT_SIZE, 0, 1);
if(status == ARM_MATH_SUCCESS) { arm_rfft_q15(&S,fft_Sbuff, fft_Dbuff);for (k=0; k<(FFT_SIZE); k++)
{
fft_Dbuff[k] <<=6;}
arm_cmplx_mag_q15(fft_Dbuff, fft_Sbuff, FFT_SIZE);
for (k=0; k<(FFT_SIZE); k++)
{
fft_Sbuff[k] >>=2;}
}As a result, I get data that does not coincide in amplitude with reality, tell me where I'm making a mistake?
#rfft #stm32f303