2017-04-20 01:55 AM
Dear Community,
I want to use the arm package: arm_cfft_radix4 to perform a 1K FFT repetitively in a loop on a STM32F407 device. To do so I predefined: __FPU_PRESENT=1,ARM_MATH_CM4 and added the library arm_cortexM4lf_math.lib to my project.
For investigating the arm_fft I copied testcode from:
#define FFT_SIZE 1024
arm_cfft_radix4_instance_f32 S;
//get some test data:
for (count = 0; count < FFT_SIZE; count ++) {
Input[count] = 10* arm_sin_f32(count*PI_loc/ 10);
}
arm_cfft_radix4_init_f32(&S, FFT_SIZE, 0, 1);
// execute the fft repetit
while(1) {
// Process the data through the CFFT/CIFFT module
arm_cfft_radix4_f32(&S, Input);
// Process the data through the Complex Magniture Module for calculating the magnitude at each bin
arm_cmplx_mag_f32(Input, Output, FFT_SIZE);
-> SEND Output to Display
}
However it works just for one times – during all subsequent cycles Output contains nothing. I would be very happy if someone would give a hint.
2017-04-20 02:28 AM
Dear Community,
looks like the buffers: “Input� and “Output� are used for intermediate storage by the arm_math functions: arm_cfft_radix4_f32 and arm_cmplx_mag_f32. After increasing the buffersize up to 2*FFT_SIZE and zeroing each & memcpy new rawdata to “Input� each cycle, the FFT seem to work – in my case it requires 900 µs @ 144 MHz clock speed. The AN4841 appnote states FFT will take only 547 µs - however I think this can be attributed to a difference of the clock speed used for the benchmark (216 MHz).
2017-04-20 02:43 AM
Does your second post indicate it works now for you ?
However, there used to be complete FFT examples in the DSP_Libs distributed especially for the F3 and F4 parts.
I think the are still available, even if 'SPL-based'.
And even if not, most of the DSP lib code, especially this FFT example, comes from ARM directly, and can be downloaded elsewhere.