2014-07-14 06:38 AM
Hi,
I am trying to do the FFT over an input real data (audio) on STM32F4 DISCO EVK & external CODEC. I have used the CMSIS function arm_rfft_fast_f32() http://www.keil.com/pack/doc/cmsis/DSP/html/group___fast.html I have implemented the code similar to the found in this forum: http://community.silabs.com/t5/32-Bit-Discussion/arm-rfft-fast-f32-crashes-controller/td-p/108929My simplified code:float32_t In_Buffer[1024];float32_t Out_Buffer[1024];static arm_rfft_fast_instance_f32 s;arm_rfft_fast_init_f32(&s, 1024);arm_rfft_fast_f32(&s, In_buffer, Out_Buffer, 0); ..........After the FFT execution even with ARM_MATH_SUCCESS flag ok I found NaN into several positions of the resulting array, and nonsense random floats *10^35, etc... May I need to scale the input? I tried to scale in different ways and i got the same NaN and positive and negative enormous random numbers, something overflows or I don't know. I have tried the Complex FFT functions padding the imaginary part with 0's and I got at least measurable float numbers. It seems that was correct but I can´t verify the spectrum yet.In my previous measurements the real fast FFT was 3 or 4 faster than the complex one.I need to transform a stereo audio sample as fast as possible and I need to use the real functions for each channel, another solution that I was found is the complex functions with R channel into the real part and L channel into the imaginary part, but I am not sure, I am not an FFT expert and may I am wrong...Please, I need some help, someone knows these functions of CMSIS? there are few references of these real functions. Kind regards.2014-07-16 02:19 AM
After the FFT execution even with ARM_MATH_SUCCESS flag ok I found NaN into several positions of the resulting array, and nonsense random floats *10^35, etc...
Do those NaNs and random floats appear in the upper half of the result buffer ? For <n> sample points, you get only <n/2> frequency points. That is specific property of the Fourier transformation. The resulting spectre is symmetrical, and ranges from -fs/2 ... fs/2. Those 'negative' frequencies are discarded in numerical algorithms.