Showing results for 
Search instead for 
Did you mean: 

CMSIS DSP library with X-Cube-Ai

Associate II

I am trying to use the statistical features of CMSIS DSP Library on STM32L4 board using TensorFlow lite with X-Cube-Ai (version 7.2.0) in Cube IDE (version 1.10.1) for machine learning. I am not able to use the FFT function with this, other than FFT all the statistical feature are computable. There comes multiple errors when i try to attach files to overcome this problem. Is there any way to use the FFT Function in X-Cube-Ai with tensorflow lite in the same version?

ST Employee

Can you be more explicit on the errors you have ?

The CMSIS DSP is part of the STM32CubeFW delivery, are you using this version ?




To elaborate the above post i would share the process we are following

1. we are using stm32l476zg nucleo board for this deployment.

2. In the cube ide 1.10.1 we are adding the cube ai software pack for STMicroelectronics cube AI. For AI deployment we are using tensorflow lite model which we are attaching to the network tab and analyzing the model for deployment parameters and then we are generating the code using cubeide.

3. The deployed models are working fine on the stm32 board and we are able to generate the inferences.

4. But now i have a similar application where i need to compute the fft before feesing the inputs to the input tensor for inference generation.

5. All statistically function from cmsis-dsp work fines as they are included as part of the Middlwares generted for tensorflow on code generation by cubeide itself.

6. But the cmsis-fft function does not work because Transform functions are not included in the cmsis directory generated in the middleware by the cubeide code generation.

7. We tried adding the Transform functions available inside the stm32l4fw repository in the stm32cube folder into the middleware section of the generated code but we have started getting multiple compilation errors.

Can you please suggest some better way so that we can use transform function available in cmsis-dsp along with cube ai?



I initialized the cube AI as shown in the first screenshot and it was working fine without errors. After this, I added the arm_const_structs.h to the Middlewares\tensorflow\third_party\cmsis\CMSIS\DSP\Include\ folder and intialized the testInput_f32_10khz signal. After this I tried computing the fft of the signal using function arm_cfft_f32(&arm_cfft_sR_f32_len1024, testInput_f32_10khz, ifftFlag, doBitReverse);

and got the following error "undefined reference to arm_cfft_f32"

Which I thinck is due to no definition available for this function, for this I added the TransformFunctions directory available in STM32Cube_FW_L4_V1.17.2 Repository STM32Cube_FW_L4_V1.17.2\Drivers\CMSIS\DSP\Source\

to the \Middlewares\tensorflow\third_party\cmsis\CMSIS\NN\Source\ of this project I am still getting the following errors:

1. make: *** [Middlewares/tensorflow/third_party/cmsis/CMSIS/NN/Source/TransformFunctions/ Middlewares/tensorflow/third_party/cmsis/CMSIS/NN/Source/TransformFunctions/TransformFunctions.o] Error 1 AI_DSP_Test C/C++ Problem

2. make: *** Waiting for unfinished jobs.... AI_DSP_Test C/C++ Problem

3. conflicting types for 'arm_rfft_fast_f32' arm_rfft_fast_f32.c /AI_DSP_Test/Middlewares/tensorflow/third_party/cmsis/CMSIS/NN/Source/TransformFunctions line 290 C/C++ Problem

Kindly, help me out to avoid these errors. Or is there any other way out to use the cubeAI along with CMSIS DSP library function specifically the FFT functions?