Get ready for the STM32 Summit 2026 | Online, November 3
Ask questions and find answers on how to deploy, debug, and optimize AI models on ST microcontrollers, microprocessors, and smart sensors.
Most recent activity
Unfortunately I missed a training held by STM32 in October this year, because I only got the board in November, and now I don’t have any information about the board, including schematics, chips, module data manuals, etc., so I need some urgently. Help, any help is greatly appreciated.
Hi,I’m currently trying to upload the following LSTM model into a STM32L476RG via X-CUBE-AIUploading the Keras .h5 model works well, however when I try to upload the TensorFlow Lite converted version of the same model, I get the following prompt:Any ideas about how to solve this problem? Some information about my setup:STM32CubeMx version: 6.8.0X-CUBE-AI version: 8.1.0TensorFlow version: 2.10.0 Thank you very much.
STM32 CubeAI v1.7.0 (STM.ai v8.0.0-19389)error: list index out of rangeThis is a model created and transformed using pytorchIs the model too big?
Hi,I am trying to use the FSM of the ISM330DHCX to check multiple decision tree outputs from the MLC.I want to be able to change the Decision Tree value in the CHKDT condition within the program flow, as I want to be checking multiple decision trees and outputs in the same FSM.From the documentation, I understand that to do this, I need to use the SETP command to change the value of the DECTREE Byte. However, I cannot seem to find the right configuration for the SETP command to be able to change the expected Dec. Tree value.Could you please point me in the right direction?Specifically, what State Machine Address should I be selecting, and what value should I be writing to it, to change the Decision Tree and Decision Tree result in the CHKDT condition? Thanks in advance.
The error occurs when I try to run the code generated for model squeezenetv1.1_xxx_tfs_int8.tflite The command I used to generate code is stm32ai generate -m squeezenetv1.1_128_tfs_int8.tflite -O ramAnd I follow the guide "How to run locally a c-model" in the X-CUBE-AI Documentation to get the executable.When I run the elf, it returns an assertion failed which like this.Assertion failed: (((ai_size)(ai_array_get_byte_size(((ai_array_format)(((ai_array*)(p_tensor_scratch->data))->format)), (((ai_array*)(p_tensor_scratch->data))->size)))) == scratch_size), function ai_layer_check_scratch_size, file layers.c, line 289.To figure it out, I observe the intermediate output per layer following the guide "Platform Observer API" in the X-CUBE-AI Documentation.And I find out that stm32ai generates the wrong size for the scratch data of one Conv2D layer. The correct shape should be (1, 63, 63, 64), but
The error occurs in both Mac m1 and windows. When I use "stm32ai validate/generate" command, I find that "-O ram" outputs totally strange results. Let's use fdmobilenet_0.25_224_tfs_int8.tflite from stm32ai-modelzoo as an example. "stm32ai validate -O time/balanced fdmobilenet_0.25_224_tfs_int8.tflite" outputs as belowThe "X-cross #1" here is 100% which is perfect, but for "stm32ai validate -O ram fdmobilenet_0.25_224_tfs_int8.tflite", something strange happens.The "X-cross #1" is 10% and the accuracy of c-model is 0% meaning that the model can hardly do what the developers want to do. Note that this happens in about 30% models for image classification in stm32ai-modelzoo as I tested.To get a rough reason for this problem, I observer the intermediate output per layer between "-O ram" and "-O time/balanced". I find that, for only fdmobilenet_0.25_224_tfs_int8.tflite, the difference first happened in a "conv2D + maxpool" layer. In "-O ram", it is fused
Hello,I'm trying to figure out how Unico calculates it feature values during .arff creation.Unfortunately, if I calculate the features as described in AN5804, the feature values differ from the Unico output.I have attached two files, accelerometer samples with five values per axis and the .arff output of Unico for a window size of five (feature mean X/Y/Z/V).Can someone explain how the feature values are calculated by Unico during .arff creation? Best regards
My binary classification algorithm has one input (270 data) and one output, I refer to section 6.4 of the code(AI:How to perform motion sensing on STM32L4 IoTnode - stm32mcu (stmicroelectronics.cn))Question 1:but the output category is always wrong, I don't know if the input data is wrong or the output result function is wrongI used a dummy dataset 【test_buf】 as my input data, and I know that the category of the current 【test_buf】 is class1 (H2), but it always output class0(CO) Question 2:How can I tell if the algorithm is doing calculations on the input dataIs the algorithm effective? Attach my code, please check, I would appreciate your help!!!!!! thanks! /** ****************************************************************************** * @file app_x-cube-ai.c * @author X-CUBE-AI C code generator * @brief AI program body ****************************************************************************** * @attention * * Copyright (c) 2024 STMicroelectronics.
When I use a function 【int ai_run(const void *in_data, void *out_data)】to make predictions,the out_data always output【0】No matter how I change the value of the input data, the value of the output data will not change, it will always be 0.int ai_run(const void *in_data, void *out_data) { ai_i32 batch; ai_input[0].data = AI_HANDLE_PTR(in_data); ai_output[0].data = AI_HANDLE_PTR(out_data); batch = ai_network_run(network, &ai_input[0], &ai_output[0]); if (batch != 1) { ai_log_err(ai_network_get_error(network), "ai_network_run"); return -1; } printf("Output1: %f\r\n", *(float*)out_data); return 0; } the picture is cube_ai Analyzing Network information
I am trying to create an AI App with X-CUBE-AI but I encountered the following error:TEMPLATE - Error create_and_init type=0x30 code=0x13I have not touched the code yet so it is really frustrating. If I comment the line "MX_X_CUBE_AI_Init();" the code runs (but does nothing, as everyone could guess). I found some posts where the solution was to initialize the CRC, but the app is supposed to do it automatically and it seems that MX_CRC_Init(); is workign properly.I tried to investigate where the error came from and it looks like it comes from the function ai_network_create_and_init, and if I am not mistaken from ai_network_init ( I could not trace back more than that). Any idea of how to solve it?
Hi,I'm doing a university project on top down people counting and the existing People Counting program in the FP-AI-VISION1 package seems perfect. I'm new to microcontrollers and AI, generally speaking, but I just wanted to know if it was possible to retrain the existing program with a data set I created? Any help or tips would be appreciated. Thanks,Darrin
I'm trying to add different trained models to my CubeMX project, but all Keras and ONNX models (even example models from the stm model zoo) produce the same error during the analization process: Failed to execute script 'pyi_rth_pkgres' due to unhandled exception! When using TFLite models, only the TFLite micro runtime is working, the STM32Cube.AI runtime produces the same error as above. Do i need any additional packages or download the STM32Cube.Ai runtime manually? Thanks, Marisa
Hello,I'm new to C and STM32 deployment. I am developing a ML model that I would like to run on a STM32F446RE board. I'm using STM32CubeIDE 1.14.0 and X-Cube-AI 8.1.0. I followed the first steps to add the model, Analyze and Validate on desktop and on target.After that, I'd like to develop my own application to calculate inferences with real-time data. So I used "ApplicationTemplate" when I added X-Cube-AI to the project. I saw that I needed to complete the acquire_and_process_data function to be able to add my own data: int acquire_and_process_data(ai_i8* data[]) { /* fill the inputs of the c-model for (int idx=0; idx < AI_NETWORK_IN_NUM; idx++ ) { data[idx] = .... } */ return 0; } The problem is that my data is of type float but I need data of type int8_t. How do I get float input?Also, I haven't found any documentation or an example of how to complete the template, does anyone have an example?Thanks in advance!
Hi ST professional team Following the documentation instructions & opteratingHow to use Teachable Machine to create an image classification application on STM32 https://wiki.stmicroelectronics.cn/stm32mcu/wiki/AI:How_to_use_Teachable_Machine_to_create_an_image_classification_application_on_STM32 How to resolve compilation error messages:
Hello, I am developing an AI classification model based on LSM6DSOX sensor data. Before adding the X-CUBE-AI software pack to Cube IDE, I was firstly developing the data acquisition code with the driver from X-CUBE-MEMS1, which I managed to do. After adding the Cube AI software pack, I uploaded my .h5 file, analyzed and validated the model (both on desktop & target) and I didn't get any errors, so everything was fine. However, after the generated code was integrated into the project, I started to get several build errors. I didn't change anything in my main.c or in any generated file, so I don't understand why this is happening. For further information, my MCU is a STM32U585CIU6, and I attached a .txt file with the errors I had.Could anyone help me, please? Thank you!
I want to run AI machine vision applications using STCubeAI. After training the model with TensorFlow components, I obtained a tflite file. Then, I imported and analyzed the model using the CubeAI toolkit in STM32CubeMX, and subsequently generated CubeAI C code. The first strange phenomenon I encountered here is that, although I have configured the use of external RAM and external flash and specified addresses in the CubeAI section of CubeMX, the compiler still reports insufficient RAM during compilation in Keil. This indicates that the external RAM settings I configured in CubeAI did not take effect.Despite setting the usage of external RAM as mentioned above, the generated code still throws an error indicating insufficient RAMSo I had to use the 'attribute' keyword to specify that some variables used by CubeAI should be stored in external RAM, which is inefficient and error-prone.Then the program compiled successfully. However, at runtime, the program triggered a hard fault at the 'r
My binary classification algorithm has one input (270 data) and one output, I refer to section 6.4 of the code(AI:How to perform motion sensing on STM32L4 IoTnode - stm32mcu (stmicroelectronics.cn))but the output category is always wrong, I don't know if the input data is wrong or the output result function is wrongI used a dummy dataset 【test_buf】 as my input data, and I know that the category of the current 【test_buf】 is class1 (H2), but it always output class0(CO)Attach my code, please check, I would appreciate your help!!!!!! thanks! /** ****************************************************************************** * @file app_x-cube-ai.c * @author X-CUBE-AI C code generator * @brief AI program body ****************************************************************************** * @attention * * Copyright (c) 2024 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this
Hello,I am working on an AI model that I want to deploy on a board with a STM32U5 Series MCU (it's not an ST board). I'm using Cube.AI to convert my .h5 model into C code, but deploying the model on my board has been quite complicated, as I'm not really experienced with Cube IDE and I see some compatibility limitations between my board features and this IDE.I've been using Arduino IDE to run some other projects on my board, including AI projects based on Nano Edge, I judge it to be easier because I already have libraries for the respective sensors that I'm using. In this scenario, I'm trying to use the C code generated by Cube AI as a library on Arduino IDE. I have structured the folder accordingly to Arduino formats, but in any case, I am still facing some issues related to compiler flags, or some errors due to different reasons. I'm a bit clueless about how to proceed, since the "solutions" I see from here would require me modifying some of the files generated by Cube AI, and I
I am trying to deploy an AI model on an MCU using Cube AI TFLite Micro runtime. The model is successfully flashed but I get the following error when the validation starts:[AI:network] stm32ai: error: argument --mode: invalid choice: 'stm32_io_only' (choose from 'x86', 'stm32', 'stm32-io-only')The correct argument is 'stm32-io-only', but somehow the app chooses 'stm32_io_only' instead.Can I manually change this mode argument somehow to see that it's set correctly?
When I use my STM32 BL475E IoT Node for operations not involving peripherals like blinking the onboard LED,serial printing to monitor,Running an AI model they are working properly.But when I tried to blink an external LED it is not working.same applies for all ports in the peripheral.They neither accept input nor displaying the output.What may be the problem...
Hello everyone,I am currently working on a DIY toy project and I need some advice on selecting the appropriate components. My project involves setting up real-time image recognition artificial intelligence, a compatible camera, and controlling servo motors to aim a cannon based on the position of a detected target.After conducting some research, I have decided to use an STM32 board to host the AI and control the servo motors. However, I am a bit overwhelmed by the various options of STM32 boards available in the market, and I am not sure which one to choose for my specific project.Additionally, I am also looking for a camera that is compatible with the chosen STM32 board, capable of providing high-quality images for real-time image recognition.I would therefore like to seek your expertise in guiding me through the selection of the appropriate STM32 board and camera for my needs. If you have any recommendations or advice on specific models to use for this project, I would be extremely g
..\..\AI\X-CUBE-AI\App\app_x-cube-ai.c(93):error: #20: identifier "AI_AI_DATA_ACTIVATION_1_SIZE" is undefinedstatic uint8_t poo10[AI_AI_DATA_ACTIVATION_1_SIZE];...\...\AI\X-CUBE-AI\App\app_x-cube-ai.c(95): error: #28: expression must have a constant valueai_handle data_activations0[ ] = {poo10}; thank u!!!!!!!!
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!The error are:TEMPLATE - initializationTEMPLATE - Error (ai_network_create_and_init) - type=0x33 code=0x41 and I also have another issue is when I using .h5 file to generate .c from X-CUBE-AI library, STM32CUBEMX Analyzing model warning E010(InvalidModelError): Model file is not a HDF5 file: E:\AST32WB55PACK\1\3.2-xgb_classifier_model.h5
HiRegarding X-Cube-Ai, it seems to be closed source, I wonder if its underlying implementation relies on the api provided in CMSIS-NN? Or did ST implement it all by itself ?
I have a LSTM model which was quantized using TensorFlowLite full integer quantization. After that, I wanted to try deploy the model on the SensorTile Box. I tried analyzing the model but it throws the following error:[AI:network] NOT IMPLEMENTED: UNIDIRECTIONAL_SEQUENCE_LSTM with output type (SIGNED, 8 bit, C Size: 8 bits Scales: [0.007843137718737125] Zeros: [-1] Quantizer: UNIFORM) not supported I would be really grateful for ideas or insights on how to solve this!
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.