Computer Vision application demonstrating the deployment of object detection models on the STM32N6570-DK or NUCLEO-N657X0-Q board.
This application is prebuilt with a people detection model, "YoloX" for STM32N6570-DK and "TinyYOLOv2" for NUCLEO-N657X0-Q.
This top readme gives an overview of the app. Additional documentation is available in the Doc folder.
- Multi-threaded application flow (FreeRTOS)
- Tracking and box filtering (STM32N6570-DK only)
- NPU accelerated quantized AI model inference
- Dual DCMIPP pipes
- DCMIPP crop, decimation, downscale
- LTDC dual-layer implementation
- DCMIPP ISP usage
- Dev mode
- Boot from External Flash
Supported development platforms:
- STM32N6570-DK Discovery Board
- Connect to the onboard ST-LINK debug adapter (CN6) using a USB-C to USB-C cable for sufficient power.
- OTP fuses are configured for xSPI IOs to achieve maximum speed (200MHz) on xSPI interfaces.
- NUCLEO-N657X0-Q Nucleo Board
- Connect to the onboard ST-LINK debug adapter (CN9) using a USB-C to USB-C cable for sufficient power.
- OTP fuses are configured for xSPI IOs to achieve maximum speed (200MHz) on xSPI interfaces.
STM32N6570-DK board with MB1854B IMX335.
Supported camera modules:
- Provided IMX335 camera module
- STEVAL-55G1MBI
- STEVAL-66GYMAI1
For the Nucleo board, one of the following displays is required:
- A USB host for data transmission via USB/UVC (using the USB OTG port CN8)
NUCLEO-N657X0-Q board with USB/UVC display.
- X-NUCLEO-GFX01M2 SPI display
NUCLEO-N657X0-Q board with SPI display.
- IAR Embedded Workbench for Arm (EWARM 9.40.1) + N6 patch (EWARMv9_STM32N6xx_V1.0.0)
- STM32CubeIDE (v1.17.0)
- STM32CubeProgrammer (v2.18.0)
- STEdgeAI (v2.2.0)
The STM32N6 series does not have internal flash memory. To retain firmware after a reboot, program it into the external flash. Alternatively, you can load firmware directly into SRAM (development mode), but note that the program will be lost if the board is powered off in this mode.
Development Mode: used for loading firmware into RAM during a debug session or for programming firmware into external flash.
Boot from Flash: used to boot firmware from external flash.
STM32N6570-DK | NUCLEO-N657X0-Q | |
---|---|---|
Boot from flash | ![]() |
![]() |
Development mode | ![]() |
![]() |
You can see application messages by attaching a console application to the ST-Link console output. Use the following console parameters:
- Baud rate of 115200 bps.
- No parity.
- One stop bit.
You can toggle tracking at runtime using button USER1 for STM32N6570-DK.
Three binaries must be programmed into the board's external flash using the following procedure:
- Set the board to development mode.
- Program
Binary/ai_fsbl.hex
(To be done once) (First stage boot loader). - Program
Binary/network_data-dk.hex
(parameters of the networks; To be changed only when the network is changed). - Program
Binary/x-cube-n6-ai-people-detection-tracking-dk.hex
(firmware application). - Set the board to boot from flash mode.
- Power cycle the board.
- Set the board to development mode.
- Program
Binary/ai_fsbl.hex
(To be done once) (First stage boot loader). - Program
Binary/network_data-nucleo.hex
(parameters of the networks; To be changed only when the network is changed). - Program
Binary/x-cube-n6-ai-people-detection-tracking-nucleo-uvc.hex
(firmware application). - Set the board to boot from flash mode.
- Power cycle the board.
- Set the board to development mode.
- Program
Binary/ai_fsbl.hex
(To be done once) (First stage boot loader). - Program
Binary/network_data-nucleo.hex
(parameters of the networks; To be changed only when the network is changed). - Program
Binary/x-cube-n6-ai-people-detection-tracking-nucleo-spi.hex
(firmware application). - Set the board to boot from flash mode.
- Power cycle the board.
See How to Program Hex Files STM32CubeProgrammer.
Make sure to have the STM32CubeProgrammer bin folder added to your path.
Intructions below are for STM32N6570-DK. For NUCLEO-N657X0-Q you have to select one of the two nucleo project according to your use case.
export DKEL="<STM32CubeProgrammer_N6 Install Folder>/bin/ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr"
# First Stage Boot Loader
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG -el $DKEL -hardRst -w Binary/ai_fsbl.hex
# Network Parameters and Biases
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG -el $DKEL -hardRst -w Binary/network_data-dk.hex
# Application Firmware
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG -el $DKEL -hardRst -w Binary/x-cube-n6-ai-people-detection-tracking-dk.hex
Before building and running the application, you have to program network_data.hex
(model weights and biases).
This step only has to be done once unless you change the AI model. See Quickstart Using Prebuilt Binaries for details.
More information about boot modes is available at Boot Overview.
Set your board to development mode.
Intructions below are for STM32N6570-DK. For NUCLEO-N657X0-Q you have to select one of the two nucleo project according to your use case.
Double click on STM32CubeIDE/STM32N6570-DK/.project
to open the project in STM32CubeIDE. Build and run with the build and run buttons.
Double click on EWARM/STM32N6570-DK/x-cube-n6-ai-people-detection-tracking-dk.eww
to open the project in IAR IDE. Build and run with the build and run buttons.
Before running the commands below, be sure to have the commands in your PATH.
- Build the project using the provided
Makefile
:
make -j8
- Open a GDB server connected to the STM32 target:
ST-LINK_gdbserver -p 61234 -l 1 -d -s -cp <path-to-stm32cubeprogramer-bin-dir> -m 1 -g
- In a separate terminal session, launch a GDB session to load the firmware image into the device memory:
$ arm-none-eabi-gdb build/Project.elf
(gdb) target remote :61234
(gdb) monitor reset
(gdb) load
(gdb) continue
Set your board to development mode.
Intructions below are for STM32N6570-DK. For NUCLEO-N657X0-Q you have to select one of the two nucleo project according to your use case.
Double click on STM32CubeIDE/STM32N6570-DK/.project
to open project in STM32CubeIDE. Build with build button.
Double click on EWARM/STM32N6570-DK/x-cube-n6-ai-people-detection-tracking-dk.eww
to open project in IAR IDE. Build with build button.
Before running the commands below, be sure to have them in your PATH.
- Build project using the provided
Makefile
:
make -j8
Once your app is built with Makefile, STM32CubeIDE, or EWARM, you must add a signature to the bin file:
STM32_SigningTool_CLI -bin build/Project.bin -nk -t ssbl -hv 2.3 -o build/Project_sign.bin
You can program the signed bin file at the address 0x70100000
.
export DKEL="<STM32CubeProgrammer_N6 Install Folder>/bin/ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr"
# Adapt build path to your IDE
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG -el $DKEL -hardRst -w build/Project_sign.bin 0x70100000
Note: Only the application binary needs to be programmed if fsbl
and network_data.hex
have already been programmed.
Set your board to boot from flash mode and power cycle to boot from external flash.