Skip to main content
Endika Caño de Miguel
Associate III
March 12, 2018
Question

Getting started FFT STM32?

  • March 12, 2018
  • 5 replies
  • 6937 views
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
This topic has been closed for replies.

5 replies

Andrew Neil
Super User
March 12, 2018
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

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Endika Caño de Miguel
Associate III
March 13, 2018
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

JC Lebreton
Associate III
March 13, 2018
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!
Endika Caño de Miguel
Associate III
March 13, 2018
Posted on March 13, 2018 at 12:11

Thank you, I will try it

Amel NASRI
Technical Moderator
March 13, 2018
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 "Best Answer" on the reply which solved your issue or answered your question.
tinymanta
Associate III
June 25, 2018
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.

Andrew Neil
Super User
June 25, 2018
Posted on June 25, 2018 at 17:49

Did you look at the links provided by

st.mcu

‌ ?

Did you see

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

?

Why would an FFT on an STM32F4 differ from an FFT on any other Cortex-M4?

Have you looked at the standard CMSIS stuff?

CMSIS Intro:

https://www.keil.com/pack/doc/CMSIS/General/html/index.html

https://www.keil.com/pack/doc/CMSIS/DSP/html/index.html

https://www.keil.com/pack/doc/CMSIS/DSP/html/arm_fft_bin_example_f32_8c-example.html

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
henry.dick
Associate II
June 25, 2018
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.

Amel NASRI
Technical Moderator
June 26, 2018
Posted on June 26, 2018 at 11:52

Hi,

I recommend you to have a look to the tutorial

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

created by

Majerle.Tilen

‌.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.