cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 FFT USING CMSIS DSP -1024Point FFT

Rishikesh_ELS
Associate

I need to do a 1024 point FFT on the STM32F446RE Eval Board. I try to integrate the CMSIS-DSP Libraries as mentioned in the forum and it creates errors only and I can't even run the program. I need to do a q15 FFT ,but it is not working. Help me to to integrate CMSIS DSP Library with the STM Cube IDE.
This is a simple issue and some ones guidance can help me a lot.

STM.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Imen.D ,

arm_cfft_sR_q15_len1024 is a C structure definition, it's documented here:

bramble_0-1754473600532.png

However, the place that you need to be starting to read is here: https://arm-software.github.io/CMSIS_5/DSP/html/group__groupTransforms.html 

bramble_1-1754473748137.png

You need to decide whether you want a complex or real FFT, then it's easy to find the relevant function.

I have a generic implementation of FFTs in the range 64-1024 based upon this library (compiled from source, which was installed as described on the links given previously by @Rishikesh_ELS ). Here's a little code to hopefully get you started:

    /* Apply window function. */
    arm_mult_q15(config->fft_input, config->fft_window, config->fft_input, FFT_LENGTH);

    /* FFT. */
    arm_rfft_q15(&config->fft_instance, config->fft_input, config->fft_output);

/* In which FFT_LENGTH can be set to 1024 (for your application), and the config structure is as follows: */
/* Spectrogram configuration. */
typedef struct
{
  bool                  valid;
  arm_rfft_instance_q15 fft_instance;
  window_type_t         window_type;
  uint16_t              step_size;
  uint8_t               num_ffts;
  int8_t                normalising_shift;
  q15_t                *fft_window;
  q15_t                *input_buffer;
  q15_t                *fft_input;
  q15_t                *fft_output;
  q15_t                *magnitude;
  q15_t                *spectrogram;
} spectrogram_config_t;

I hope this helps.

View solution in original post

5 REPLIES 5
Imen.D
ST Employee

Hello @Rishikesh_ELS ,

I recommend you the following articles which explain how to integrate a DSP Libraries on STM32 project:

Configuring DSP libraries on STM32CubeIDE - STMicroelectronics Community

How to integrate CMSIS-DSP libraries on a STM32 pr... - STMicroelectronics Community

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
bramble
Senior

Hi @Imen.D ,

The links that @Imen.D provided are indeed helpful, but there are some things not explained very completely there. I added a note to this one https://community.st.com/t5/stm32-mcus/how-to-integrate-cmsis-dsp-libraries-on-a-stm32-project/ta-p/666790 in which I tried to clarify some things that confused me when first doing this.

It would be good if ST updated their docs when users repeatedly raise the same question, but it seems that they prefer just keep creating more and more material, and pay little attention to filling in some obvious holes in existing docs. (ST people, I do think your products are good: this is intended as constructive criticism!)

Rishikesh_ELS
Associate

Hi @Imen.D and @bramble I actually CMSIS Version 5.9.0 so there there i don't have a precompiled library,so I followed the instructuin in second link you provided and actually that works.But the issue arises when I need to do the FFT ,I also need the transform function from the source ,so I added it along with support functions and also commented the 'C' files in the respective files in Transform Function folder. The error I got was somethinf like arm_cfft_sR_q15.c is not there. I think there is no such file.So I cant understand the errors.
@bramble I couldn't find the notes added by you.
Also to a 1024 point real time fft what all source functions we needed?

Hi @Imen.D ,

arm_cfft_sR_q15_len1024 is a C structure definition, it's documented here:

bramble_0-1754473600532.png

However, the place that you need to be starting to read is here: https://arm-software.github.io/CMSIS_5/DSP/html/group__groupTransforms.html 

bramble_1-1754473748137.png

You need to decide whether you want a complex or real FFT, then it's easy to find the relevant function.

I have a generic implementation of FFTs in the range 64-1024 based upon this library (compiled from source, which was installed as described on the links given previously by @Rishikesh_ELS ). Here's a little code to hopefully get you started:

    /* Apply window function. */
    arm_mult_q15(config->fft_input, config->fft_window, config->fft_input, FFT_LENGTH);

    /* FFT. */
    arm_rfft_q15(&config->fft_instance, config->fft_input, config->fft_output);

/* In which FFT_LENGTH can be set to 1024 (for your application), and the config structure is as follows: */
/* Spectrogram configuration. */
typedef struct
{
  bool                  valid;
  arm_rfft_instance_q15 fft_instance;
  window_type_t         window_type;
  uint16_t              step_size;
  uint8_t               num_ffts;
  int8_t                normalising_shift;
  q15_t                *fft_window;
  q15_t                *input_buffer;
  q15_t                *fft_input;
  q15_t                *fft_output;
  q15_t                *magnitude;
  q15_t                *spectrogram;
} spectrogram_config_t;

I hope this helps.

Hi @bramble 

We really appreciate your collaboration on this; your feedback has been very helpful for community members.

I will share your feedback along to the owner in charge of this topic.

Thank you for your contribution.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen