cancel
Showing results for 
Search instead for 
Did you mean: 

hardfault while deploying ai model on stm32n6570-dk through cubemx

JaiGanesh
Associate II

Hello everyone — I’m running an AI image-classification model on the STM32N6570-DK and I’m stuck with a reproducible problem. The first inference completes successfully (EVENT_DONE), but on the second run the code gets stuck inside the runtime (run_epoch) with no event returned; on the third attempt it again stalls and then triggers a HardFault. I followed the ST tutorial here when creating the project:
https://community.st.com/t5/stm32-mcus/how-to-build-an-ai-application-from-scratch-on-the-stm32n6570-dk/ta-p/825591

Below are the full details, steps to reproduce, debug info, things I’ve tried, and the files I’ve attached.


Environment

  • Board: STM32N6570-DK

  • Model: Image Classification (generated with STM32Cube.AI)

  • Model and weights: placed in xSPI1 / xSPI2 (QSPI/XSPI) and also copied to internal SRAM for some buffers

  • SRAM clocks: enabled for SRAM3, SRAM4, SRAM5, SRAM6

  • Toolchain:  STM32Cube IDE  - Latest version

  • CubeMX / Cube.AI version: Latest Version

  • RTOS: (bare-metal / FreeRTOS) : Bare-metal


What I did (exact steps)

  1. Followed ST tutorial linked above to generate the project and AI code.

  2. Integrated the Image Classification model and generated C sources/weights with Cube.AI.

  3. Placed model weights and buffers in external XSPI1/XSPI2 and also set some buffers in internal SRAM.

  4. Enabled clocks for SRAM3/4/5/6 so the SRAM regions are accessible.

  5. Confirmed the input buffer address is readable after SRAM clocks are enabled.

  6. Run the code:

    • 1st inference: completes normally — returns event EVENT_DONE.

    • 2nd inference: code enters run_epoch and blocks (no event).

    • 3rd inference: same block in run_epoch, then Hard Fault occurs.

I have attached:

  • The generated project (zipped).

  • A screenshot / image of the HardFault (registers / fault screen).


Observed behavior (more details)

  • First ai_run returns as expected.

  • On subsequent calls, execution enters the AI runtime’s run_epoch (or similar), but the runtime never completes or calls the EVENT_DONE callback.

  • Eventually a Hard Fault occurs; the first HardFault image shows stacked registers (I’ll attach the screenshot).

  • There are no obvious warnings during build; project builds clean.

0 REPLIES 0