2026-04-13 8:48 AM
I want to flash a custom object detection model on the STM32N6570-DK board. I followed these steps:
1-I selected the model ST_YOLOXN_D033_W025_416_INT8_OBJECT_DETECTION_COCO_2017_PERSON.TFLITE from ST Edge AI Cloud, with the following parameters: input: 1×416×416×3 (8-bit), output: multiple outputs, model type: STAI_FORMAT_U8. I then generated the corresponding C files.
2-I followed this path: ModelZoo service → application_code → object_detection → STM32N6 → Model → STM32N6570-DK, and replaced the original files with my custom model. The files I modified are:
3- In STM32CubeIDE, I configured the app.config.h file
#define POSTPROCESS_TYPE POSTPROCESS_OD_ST_YOLOX_UI
#define NN_HEIGHT (416)
#define NN_WIDTH (416)
#define NN_BPP (3)
#define COLOR_BGR (0)
#define COLOR_RGB (1)
#define COLOR_MODE COLOR_RGB
/* Classes */
#define NB_CLASSES (1)
#define CLASSES_TABLE const char* classes_table[NB_CLASSES] = {\
"person"}\
/* I/O configuration */
/* Postprocessing ST_YOLO_X configuration */
#define AI_OD_ST_YOLOX_PP_NB_CLASSES (1)
#define AI_OD_ST_YOLOX_PP_L_GRID_WIDTH (52) // Para 416x416
#define AI_OD_ST_YOLOX_PP_L_GRID_HEIGHT (52)
#define AI_OD_ST_YOLOX_PP_L_NB_INPUT_BOXES (AI_OD_ST_YOLOX_PP_L_GRID_WIDTH * AI_OD_ST_YOLOX_PP_L_GRID_HEIGHT)
#define AI_OD_ST_YOLOX_PP_M_GRID_WIDTH (26)
#define AI_OD_ST_YOLOX_PP_M_GRID_HEIGHT (26)
#define AI_OD_ST_YOLOX_PP_M_NB_INPUT_BOXES (AI_OD_ST_YOLOX_PP_M_GRID_WIDTH * AI_OD_ST_YOLOX_PP_M_GRID_HEIGHT)
#define AI_OD_ST_YOLOX_PP_S_GRID_WIDTH (13)
#define AI_OD_ST_YOLOX_PP_S_GRID_HEIGHT (13)
#define AI_OD_ST_YOLOX_PP_S_NB_INPUT_BOXES (AI_OD_ST_YOLOX_PP_S_GRID_WIDTH * AI_OD_ST_YOLOX_PP_S_GRID_HEIGHT)
#define AI_OD_ST_YOLOX_PP_NB_ANCHORS (3)
static const float32_t AI_OD_ST_YOLOX_PP_L_ANCHORS[2*AI_OD_ST_YOLOX_PP_NB_ANCHORS] = {26.000000, 26.000000, 3.640000, 13.000000, 11.960000, 36.400000};
static const float32_t AI_OD_ST_YOLOX_PP_M_ANCHORS[2*AI_OD_ST_YOLOX_PP_NB_ANCHORS] = {13.000000, 13.000000, 1.820000, 6.500000, 5.980000, 18.200000};
static const float32_t AI_OD_ST_YOLOX_PP_S_ANCHORS[2*AI_OD_ST_YOLOX_PP_NB_ANCHORS] = {6.500000, 6.500000, 0.910000, 3.250000, 2.990000, 9.100000};
#define AI_OD_ST_YOLOX_PP_IOU_THRESHOLD (0.5)
#define AI_OD_ST_YOLOX_PP_CONF_THRESHOLD (0.6)
#define AI_OD_ST_YOLOX_PP_MAX_BOXES_LIMIT (100)4-I opened STM32CubeProgrammer and flashed the model weights at address 0x7038000 using the MX66UW1G45G_STM32N6570-DK external loader. Then, I started debugging the STM32N6570-DK Getting Started Object Detection project.
However, during debugging, I encountered the following issues:
STM32N6570-DK_GettingStarted_ObjectDetection [STM32 C/C++ Application] arm-none-eabi-gdb (14.2.90.20240526)
Temporary breakpoint 1, main() at C:/ST/stm32ai-modelzoo-services-main/application_code/object_detection/STM32N6/Application/STM32N6570-DK/Src/main.c:265
MEMSYSCTL->MSCR |= MEMSYSCTL_MSCR_ICACTIVE_Msk;
After this, I selected the Resume boton to continue with the debug and then this happened:
Program received signal SIGTRAP, Trace/breakpoint trap.
HardFault_Handler() at C:/ST/stm32ai-modelzoo-services-main/application_code/object_detection/STM32N6/Application/STM32N6570-DK/Src/stm32n6xx_it.c:42
while (1)
I don't know what I'm doing wrong.
2026-04-14 12:33 AM
Hi @TatianaP ,
Since you are using model zoo, could you please try to use the deployment service?
You will find a yaml example in /modelzoo_service/object_detection/config_file_example/deployment_n6_st_yoloxn_config.yaml
Make sure to use the right version of the st edge ai core.
if this work, you will find the project that was flashed in the same path you mentionned.
Have a good day,
Julian
2026-04-15 6:36 AM
Hi Julian, I’m still having issues. I want to understand the workflow to deploy my own AI model onto the board.
I trained a YOLOv8n person detection model using the STM32 hotspot in Colab. Then, I downloaded the model weights in INT8 format. After that, I used ST Edge AI Core 4.0 to quantize the model (input: uint8, output: int8), and the conversion was successful.
Next, I updated the Neural-ART runtime software stack in the Model Zoo Service by replacing the Npu folder with the new ll_aton files, since I’m using a newer version of ST Edge AI Core.
I then followed this path: ModelZoo Service → application_code → object_detection → STM32N6 → Model → STM32N6570-DK, where I replaced the original files with my custom model.
The files I modified are:
In STM32CubeIDE 1.18.0, I configured the app_config.h file according to the YOLOv8 deployment configuration YAML file.
/* Model Related Info */
#define POSTPROCESS_TYPE POSTPROCESS_OD_YOLO_V8_UI // ← uint8 input, int8 output
#define NN_HEIGHT (480)
#define NN_WIDTH (480)
#define NN_BPP (3)
#define COLOR_BGR (0)
#define COLOR_RGB (1)
#define COLOR_MODE COLOR_RGB
/* Classes */
#define NB_CLASSES (1)
#define CLASSES_TABLE const char* classes_table[NB_CLASSES] = {\
"person"}\
/* I/O configuration */
#define AI_OD_YOLOV8_PP_TOTAL_BOXES (4725) // ← Tu valor
#define AI_OD_YOLOV8_PP_NB_CLASSES (1)
/* Postprocessing ST_YOLO_V8 configuration */
#define AI_OD_YOLOV8_PP_CONF_THRESHOLD (0.5f)
#define AI_OD_YOLOV8_PP_IOU_THRESHOLD (0.5f)
#define AI_OD_YOLOV8_PP_MAX_BOXES_LIMIT (10)
#define AI_OD_YOLOV8_PP_ZERO_POINT (-128) // ← Tu valor
#define AI_OD_YOLOV8_PP_SCALE (0.003925676f) // ← Tu valorWhen I click Build All, the process completes successfully. However, when I flash the weights at address 0x70380000 and then try to debug the program in STM32CubeIDE, I encounter issues. The debugger breaks at the following points in main.c :
static void Hardware_init(void)
{
/* Power on ICACHE */
MEMSYSCTL->MSCR |= MEMSYSCTL_MSCR_ICACTIVE_Msk;
/* Set back system and CPU clock source to HSI */
__HAL_RCC_CPUCLK_CONFIG(RCC_CPUCLKSOURCE_HSI);
__HAL_RCC_SYSCLK_CONFIG(RCC_SYSCLKSOURCE_HSI);
HAL_Init();
SCB_EnableICache();
#if defined(USE_DCACHE)
/* Power on DCACHE */
MEMSYSCTL->MSCR |= MEMSYSCTL_MSCR_DCACTIVE_Msk;
SCB_EnableDCache();Break at address "0x18003a1a".
I followed this steps:
https://community.st.com/t5/stm32-mcus/how-to-run-ai-models-from-model-zoo-on-stm32n6/ta-p/814254
2026-04-15 7:57 AM
Now I’m trying with ST Edge AI Core 3.0, as recommended by the Model Zoo Service GitHub, using STM32CubeIDE 1.18.0.
The program runs without issues in debug mode. However, when I switch the board to flash mode, the camera does not work, the screen remains black, and LED LD4 starts blinking.
I’m not sure what the issue is or what I might be doing wrong. When I flash the .bin file using STM32CubeProgrammer, I select the MX66UW1G45G_STM32N6570-DK external loader and program the weights at address 0x70380000.
I export my model with 480x480 size and Im using STM32CubeIDE 1.18 when the yaml config file says
- the yaml uses 256 size
model_type: yolov8n
and
path_to_cubeIDE: C:/ST/STM32CubeIDE_1.17.0/STM32CubeIDE/stm32cubeide.exe
That could be the problem?