Hello,
I am new here and have following problem:
I would like to use the new faster FFT functions from CMSIS Version 5.
My problem is, that I am not able to include the new CMSIS Version.
I tried to copy the files into arduino15 folder and the library folder in the sketch folder.
Both approaches did not work.
Putting the library into a src folder and include arm_math.h did not work either.
The problem might be to have two .h with the same name.
I am not sure what to change. It might be some .txt file with linker stuff in it like this very old post:
https://forum.arduino.cc/index.php?topic=140107.0
It is solely to use the new faster functions on Core M4 processors.
Should have specified a bit more.
IDE: Arduino 1.8.8
Below is the code I want to include CMSIS 5 instead of 4.5 that comes with Arduino 1.8.8.
It does not find the function arm_rfft_fast_init_f32 because it is in CMSIS 5.
Putting CMSIS 5 from the official Github page into the libraries does not work. Arduino tells me that it found an invalid library (when compiler output set to verbose).
Including the CMSIS version via #include "src/CMSIS_5-master/DSP/Include/arm_math.h" gives me an error message that another include file is missing. It is in the CMSIS folder though.
I already looked into this: https://andrestefanov.de/compiling-cmsis-dsp-5-3-0-for-teensy-3-6/
but can not find the folders. I am on macOS or Ubuntu btw.
The code below works but uses the old arm_rfft_f32 function which I want to replace.
Working code(with old slow float 32 FFT):
#define ARM_MATH_CM4
#include <arm_math.h>
//FFT definitions
#define FFT_SIZE 128
unsigned long time;
arm_cfft_radix4_instance_f32 cfft_inst;
arm_rfft_instance_f32 rfft_inst;
static float32_t out[FFT_SIZE*2]; //has to be twice FFT size
static float32_t in[FFT_SIZE*2];
uint8_t ifftFlag = 0;
uint8_t doBitReverse = 1;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
//FFT init
arm_rfft_init_f32(&rfft_inst, &cfft_inst, FFT_SIZE, ifftFlag, doBitReverse);
}
void loop() {
// put your main code here, to run repeatedly:
int i;
for(i=0;i<=FFT_SIZE*2;i++){
in[i] = analogRead(A0);
}
time = micros();
//do the FFT
arm_rfft_f32(&rfft_inst, in, out);
arm_cmplx_mag_f32(out,in,FFT_SIZE);
time = micros() - time;
for(i=0;i<=FFT_SIZE;i++){
Serial.println(in[i]);
}
Serial.println("Time");
Serial.println(time);
delay(1000);
}
It would be good to know what your target board / processor is.
It's either an itsybitsy M4 or a teensy 3.5.
Currently working on the itsybitsy. That should be ATSAMD51 32-bit Cortex M4.
Would be nice if it would work on both but for now the itsybitsy would be nice to get working.
plasma_M4:
It's either an itsybitsy M4 or a teensy 3.5.
Yea, I'd take the question over to the PJRC forums. I've seen such discussions over there and I know the Audio library uses CMSIS functionality (not sure what version) for its FFTs.
I did the same thing according to Using CMSIS Version 5.3 with the Teensy 3.6 .
It works on itsybitsy M4.
for teensy it gives me an error about a missing FPU (strange...).
And it is faster!
FFT length 512
on itsybitsy
old: 330 us
fast: 288 us
What you have to do is to copy all the files the arm_rfft_fast_f32 function needs in the SAME directory under src in the sketch folder.