Skip to main content
Visitor II
March 28, 2024
Question

CMSIS DSP CFFT incorrect frequency analysis

  • March 28, 2024
  • 1 reply
  • 1392 views

hi, I'm trying to do the FFT using the CMSIS DSP V1.15.0 libraries but I get a graph with random frequencies...
I have a CM4 microcontroller(without FPU) I implement the below code and get random frequencies.
I test the same code on a CM7 microcontroller(with FPU) and get the correct frequencies.
What am I doing wrong? since the CM4 microcontroller is without FPU I can't use the "arm_cfft_f32" function?

source code:

Spoiler
int16_t data_pcm[512];
float data_fft[1024];
float data_fft_mag[512];
uint32_t ifftFlag = 0;
uint32_t doBitReverse = 1;

arm_status status;
status = ARM_MATH_SUCCESS;

arm_cfft_instance_f32 fftInstance;
status=arm_cfft_init_512_f32(&fftInstance);
if( status == ARM_MATH_SUCCESS)
{
 for(int i = 0; i < 512; i++)
 {
 data_fft[i * 2] = data_pcm[i];
 data_fft[i * 2 + 1] = 0;
 }
 arm_cfft_f32(&fftInstance, data_fft, ifftFlag, doBitReverse);
 arm_cmplx_mag_f32(data_fft, data_fft_mag, 512);
}
    This topic has been closed for replies.

    1 reply

    MaviAuthor
    Visitor II
    March 29, 2024

    Sorry, my mistake works correctly, the FFT is the input data that is noisy... I apologize for the inconvenience, can someone delete the topic please?