cancel
Showing results for 
Search instead for 
Did you mean: 

Getting started FFT STM32?

Endika Caño de Miguel
Associate II
Posted on March 12, 2018 at 12:18

Hello everyone:

I have to make the FFT on my STM32L4 32KC board and I don�t know where to start. 

Sound is coming from the outside and I have to make the FFT.

Any tips would help a lot.

I�ve looking on the net for help, but everything was a little to messy for me. 

I�m pretty new to micro-controlers, so there are many things that I ignore unfortunately.

Thanks in advance for your time and help.

#stm32 #fft #l4 #cmsis #dsp
15 REPLIES 15
Andrew Neil
Chief II
Posted on March 12, 2018 at 13:00

Do you have any experience with FFTs, or digital signal processing in general?

Clearly, that's a basic foundation.

http://www.dspguide.com/

Do you have any prior experience with the STM32?or any other microcontroller(s)? or programming in general?

For basic getting-started tips, see:

https://community.st.com/0D50X00009XkWm7SAF

JC Lebreton
Associate II
Posted on March 13, 2018 at 10:18

Hi there, 

I'm currently on a projet where i'm using a FFT! 

So in order to start, and to explain it as simply as i can, here are some functions that you'll need :

arm_cfft_f32(&arm_cfft_sR_f32_len2048,son0, I_FFT_FLAG, BIT_REVERSE_FLAG); 

arm_cmplx_mag_f32(son0, a_signal_output, LENGTH_FFT); 

these two functions combined return you an FFT of your sampled signal. 

'son0' is your input signal 

'a_signal_output' is your FFT

of course it's not this easy ... 

You have to add some files to your project! indeed theses function are from ARM libraries. I can't share you them, but if you found arm_math.h on google, you are heading the right way. (i'm sorry i don't remember where i get the files from ...)

I'm not very experienced with FFT on the STM32 but mine is working so i hope i can give you some clue! 

oh! i forget to mention, an FFT takes a HUGE TIME to be calculated (test it on mathlab) so if you want better performances try using an STM32H7 at 400Mhz! I think it will help you a lot!
Posted on March 13, 2018 at 09:55

I know the common idea of FFT, but I´ve never worked with it or anything related.

Yes I have worked with STM32 but only with the basics, Timers, ADC, UART,GPIO...

Thank you

Amel NASRI
ST Employee
Posted on March 13, 2018 at 13:07

Hi

de_Miguel.Endika

‌,

My recommendation for you is to start with

http://www.st.com/resource/en/application_note/dm002739pdf

:

Digital signal processing for STM32 microcontrollers using CMSIS.

The associated firmware (

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-dspdemo.html

) is developped and tested using STM32F429xx and STM32F746xx MCUs, but can be adapted toSTM32L4.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on March 13, 2018 at 12:11

Thank you, I will try it

Posted on March 13, 2018 at 12:24

oh! i forget to mention, an FFT takes a HUGE TIME to be calculated (test it on mathlab) so if you want better performances try using an STM32H7 at 400Mhz!

That depends on one's definition of 'huge'.

Last time I checked, the FFT implementation of the ARM_DSP lib was limited to 2048 points.

In one of my projects, that took about 2.5 ms per cycle on a F407 with 168 MHz, using only compiler optimizations.

Just turn up (frequency) resolution as much as necessary, and not as possible.

Posted on March 13, 2018 at 13:08

yes indeed! 

I try with an F4 too, but it doesn't even contest the H7 for the FFT calculations! 

and of course resolution imply much for the FFT !

henry.dick
Senior II
Posted on June 25, 2018 at 18:01

You should try to break the problem down to at least two separate parts.

1. Fft: most fft routines are hardware independent and can be debugged easily on a PC. All is involved here is to organize the input as per the requirements of your fft routines.

2. Adc: this part is hardware dependent but can be easily structured so that the hardware dependence is minimized.

The 2nd part is specific to your target and you can figure that out on your own. The first part is easy to solve as there are tons of code floating around, from arm, St, integer or floating, ....

You just need to have some understanding of fft and it becomes quite easy after that.

Posted on June 25, 2018 at 17:38

Hi

st.mcu

‌,

Any examples on FFT single point calculation for STM32F4 MCUs ? I need to calculate FFT for specific points, and not for a whole table.

Regards,

Wael.