cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using fftw3 with STM32MP157f-dk2

DevESG
Associate II

Hello, I need to do FFT transforms of long signal traces, so  using CMSIS DSP doesn't look possible because of the 4096 points limit. I tried to use fftw3 library (3.3.10). I built it using OpenSTLinux SDK from the Github source without problem. Here is configuration I used: 

configure --host=arm-ostl-linux-gnueabi --enable-neon --enable-single --with-slow-timer

Library libfftw3f.a  was built successfully and test app was also successfully linked with it. Here is relevant part of the test app code:

int fft_points = 131072;

fftwf_plan pr2c, pc2r;
fftwf_complex* fft_cbuf = 0;
float* fft_buf = 0;
fft_cbuf = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex)*(fft_pts/2 + 1));
memset(fft_cbuf, 0, sizeof(fftwf_complex)*(fft_pts/2 + 1));
fft_buf = (float *)fftwf_malloc((fft_pts + 2) * sizeof(float)); 
memset(fft_buf, 0, (fft_pts + 2) * sizeof(float));
printf("allocated buffers: %p, %p\n", fft_cbuf, fft_buf);
pr2c = fftwf_plan_dft_r2c_1d(fft_pts, fft_buf, fft_cbuf, FFTW_ESTIMATE);    // Segmentaion fault crash here
printf("created pr2c\n");
pc2r = fftwf_plan_dft_c2r_1d(fft_pts, fft_cbuf, fft_buf, FFTW_ESTIMATE);
printf("created pc2r\n");

When program runs, it crashes with "Segmentation fault (core dumped)" while trying to create first fft plan.
Is there something I missed, some compilation flag maybe? Any advice is appreciated.
Thanks in advance.
 
 
2 REPLIES 2
AScha.3
Super User

Hi,

So you want to do a 128K FFT complex in float, 

that's needing a lot of memory - sure, that enough RAM is free, for input and output arrays?

Malloc...is okay ?

 

If you feel a post has answered your question, please click "Accept as Solution".
DevESG
Associate II

No, it's actually real FFT, so it's like 64K complex. Turned out I didn't need to build fftw3 library myself. I'm new to STM32 development and didn't realize that Developer Package comes with shared libfftw3 libraries. When I used provided 3.6.10 library I didn't have any problem to build and run my app. Test app ran fine even with double type FFT transform.