Hello everyone. I write FFT, it's ran! But it run very slow speed, I try on STM32F103C8T6 72MHz and used timer to measure time, the result about 360ms and I can't run another program. Somebody help me please! Thank all!
My code here: the DFT http://codepad.org/vwMlHR1V
and FFT : http://codepad.org/HbDwS2TZ
Ok, what do you expect? You are doing a lot of float and double operations on a micro controller w/o FPU.
But there are also "programming faults":
WR = cos(-PI * k / N); WI = sin(-PI * k / N);
Try using "cosf" (float) not "cos" which is double.
Note: The compiler will use double unless you explicitly tell it to use float!So PI should be defined like this:
#define PI 3.1415926535897f
Maybe switch to fixed point math.