2015-05-22 07:18 AM
Estimated colleagues,
following I explain the strange behavior:...global and extern variables...
void main(void) { arm_status status; float32_t maxValue; while(1) { status = ARM_MATH_SUCCESS; /* Process the data through the CFFT/CIFFT module */ arm_cfft_f32(&arm_cfft_sR_f32_len1024, testInput_f32_10khz, ifftFlag, doBitReverse); /* Process the data through the Complex Magnitude Module for calculating the magnitude at each bin */ arm_cmplx_mag_f32(testInput_f32_10khz, testOutput, fftSize); /* Calculates maxValue and returns corresponding BIN value */ arm_max_f32(testOutput, fftSize, &maxValue, &testIndex); if(testIndex != refIndex) { status = ARM_MATH_TEST_FAILURE; } } } the program throws ARM_MATH_TEST_FAILURE the second time. C) If I define testInput_f32_10khz[] as a constant array on the flash then the program throws ARM_MATH_TEST_FAILURE always. The problem does not have to do with the bit reversal problem of old versions (so much as I could see from other discussions). I am using the sources not the library (because only the ARM library is provided with STMCube. Why is a wrong calculation the second time? Is this an initialization problem? Hopefully someone can help me or give me some tip. Thank you in advance!. PS: I posted this in the ARM Community ten days ago without any answer (http://community.arm.com/message/27591&sharp27591). #arm-cmsis-dsp2015-05-22 11:15 AM
Just looking at the calls
...arm_cfft_f32(&arm_cfft_sR_f32_len1024, testInput_f32_10khz, ifftFlag, doBitReverse);
... arm_cmplx_mag_f32(testInput_f32_10khz, testOutput, fftSize); suggests an in-place operation - the fft function only takes a ''testInput'' array as parameter, but no output array. The 'arm_cmplx_mag' function, which (if I remember correctly) calculates the magnitudes from the real/imaginary components, accepts that ''testInput'' array as input. No wonder it fails with the second call ... To be sure, just check the source code for yourself.2015-05-27 01:54 AM
Thank you for your response.
I tried with Keil uVision5 and it works correctly but I have problem when using GNU ARM compiler. The calculated refIdx is 615 (instead 213). In GNU ARM I have defined:I use softfp because I cant compile with hard float (I need the PDM Filter Library).
When I start a record the FFT seems to detect tones giving a fixed index and a high max value but with the example gives me a wrong index. Any suggestions? Thanks in advance!2015-05-27 03:37 AM
The calculated refIdx is 615 (instead 213). ...
Any suggestions?
Dunno. I had tried this FFT bin example about two years ago, using the gcc-based Crossworks toolchain. But this was, if I remember correctly, CMSIS 1.x. You can add debug code, and compare the input/output data the the cfft routine. BTW, I used the DSP Lib sources at this time, the precompiled libs did not work for me.I tried with Keil uVision5 and it works correctly...
So why not sticking to Keil uV5 ?
2015-05-27 07:44 AM
I am sorry, it was my fault! It works perfectly!
In the program I was writting I set a bitreverse to zero (which obviously gave me another index)! When setting bitreverse to ''1'' I get the index 213 with the GNU ARM compiler too. Thank you for your time!!