We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
Hello,
If you need ARM cortexM MCU optimised FFT, please consider using CMSIS DSP library
https://github.com/ARM-software/CMSIS_5
https://www.keil.com/pack/doc/CMSIS/DSP/html/group__groupTransforms.html
It has real/complex fixed-point and floating point variants that can suit your needs.
Best regards