This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with arm_cfft_q15

Hello,

I am doing an application that needs an FFT from the input data from the ADC (12 bits .. I'm using stm32f4 microcontroller). As it's common, the ADC does not accept negative voltages so I added a DC offset to the signal.

I have noticed that the arm_cfft_q15 give an incorrect output.

In order to test the function i:
- Took a the input data from the ADC and graphed it in a program I made, and I was able to see a good, albeit little noisy sinusoidal signal. After that I performed the FF and calculated the RMS value of the wave;
- I created a sinusoidal wave in run time float var; var = 0.0625F * arm_sin_f32(2 * PI * i / 128 + PI/2) + 0.0625F; arm_float_to_q15(&var, &buffer[i], 1);

After that I took the data and graphed the floating point sinusoidal wave and the q15 wave, both gave me a nice sinusoidal wave. After that I performed the float CFFT and the q15 CFFT and all the calculations were correct.

- As you can imagine, it got me curious to see that the "perfect" sinusoidal wave gave a correct output both for q15 and float, when the output of the q15 FF for real data was faulty. So I decided to convert my entire buffer to floating point with arm_q15_t_float and also assigning the 12 bit value of the ADC directly to the float buffer and my results were the correct value (of course there was an issue with scaling factors, but after I worked them out the output was correct).

Has anyone had this problem with the q15 CFFT? I'd prefer to use the q15 version of the FFT because it means I don't have to spend time converting values.