# ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection architecture

> Architecture diagram of the GitHub repository ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection
- Repository: https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection

## Overview

This is an STM32N6570-DK embedded face-detection application, not the Model Zoo generator: the documented user-to-result path is camera capture through DCMIPP, Neural-ART/STAI inference, and application post-processing. ThreadX hosts the application, with LCD display, USBX CDC, Ethernet/NetX Duo, and external-memory support as parallel capabilities. The README and sampled camera-pipeline source establish the main flow; several application and middleware implementations are unsampled, so their internal call links are omitted or marked unverified.

Main entry points: [`FSBL/Application/Core/Src/main.c`](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Core/Src/main.c) (Application entry), [`FSBL/Application/Camera/app_camerapipeline.c`](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/app_camerapipeline.c) (Camera pipeline), [`FSBL/Application/AI/ai_app.c`](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/AI/ai_app.c) (AI application), [`FSBL/Application/Camera/camera_app.c`](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/camera_app.c) (Camera application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vision["Vision and AI"]
  node_camera["Camera application<br/>[camera_app.c]"]
  node_pipeline["Camera pipeline"]
  node_camera_service["Camera DCMIPP"]
  node_crop["Image crop<br/>[crop_img.c]"]
  node_ai_app["AI application<br/>[ai_app.c]"]
  node_network_model["Generated network<br/>[network.c]"]
  node_stai["STAI runtime"]
end

subgraph group_io["Board I/O"]
  node_lcd_app["LCD application<br/>[lcd_app.c]"]
  node_lcd_driver["LCD drawing<br/>[stm32_lcd.c]"]
  node_usbx["USBX CDC<br/>[app_usbx.c]"]
end

subgraph group_runtime["Runtime and platform"]
  node_entry["Application entry<br/>[main.c]"]
  node_threadx["ThreadX runtime"]
  node_platform["STM32 platform"]
  node_cmsis["CMSIS device"]
  node_bsp["Board support"]
  node_filex[("SD file storage<br/>[app_filex.c]")]
  node_external_memory[("NOR and PSRAM")]
end

subgraph group_network["Connectivity"]
  node_netx["NetX Duo<br/>[app_netxduo.c]"]
  node_ethernet["Ethernet interface<br/>[ethernet.c]"]
end

node_operator(("Board operator"))

node_operator -.->|"starts board"| node_entry
node_entry -->|"starts runtime"| node_threadx
node_entry -->|"initializes"| node_camera
node_entry -->|"initializes"| node_ai_app
node_entry -->|"initializes"| node_lcd_app
node_entry -->|"initializes"| node_netx
node_entry -.->|"configures"| node_usbx
node_camera -.->|"uses pipeline"| node_pipeline
node_pipeline -->|"configures capture"| node_camera_service
node_pipeline -.->|"uses crop"| node_crop
node_pipeline -->|"feeds NN input"| node_ai_app
node_ai_app -->|"runs inference"| node_stai
node_stai -.->|"executes network"| node_network_model
node_ai_app -.->|"returns detections"| node_operator
node_camera -.->|"displays camera"| node_lcd_app
node_lcd_app -.->|"draws display"| node_lcd_driver
node_netx -.->|"uses interface"| node_ethernet
node_entry -->|"initializes"| node_filex
node_entry -.->|"configures XSPI"| node_external_memory
node_entry -->|"uses HAL"| node_platform
node_platform -->|"targets device"| node_cmsis
node_entry -->|"uses board support"| node_bsp

click node_entry "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Core/Src/main.c"
click node_threadx "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/FSBL/Application/RTOS"
click node_platform "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Drivers/STM32N6xx_HAL_Driver/Inc"
click node_cmsis "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Drivers/CMSIS/Device/ST/STM32N6xx/Include"
click node_bsp "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Drivers/BSP/STM32N6570-DK/stm32n6570_discovery.h"
click node_camera "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/camera_app.c"
click node_pipeline "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/app_camerapipeline.c"
click node_camera_service "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Middlewares/ST/stm32-mw-camera"
click node_crop "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/crop_img.c"
click node_ai_app "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/AI/ai_app.c"
click node_network_model "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Model/STM32N6570-DK/network.c"
click node_stai "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Middlewares/ST/stedgeai-lib"
click node_lcd_app "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/LCD/lcd_app.c"
click node_lcd_driver "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Utilities/lcd/stm32_lcd.c"
click node_usbx "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/USBX/App/app_usbx.c"
click node_netx "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/NetXDuo/App/app_netxduo.c"
click node_ethernet "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/NetXDuo/Target/ethernet.c"
click node_filex "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/FileX/App/app_filex.c"
click node_external_memory "https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Drivers/BSP/STM32N6570-DK/stm32n6570_discovery_xspi.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_camera,node_pipeline,node_camera_service,node_crop,node_ai_app,node_network_model,node_stai toneBlue
class node_lcd_app,node_lcd_driver,node_usbx toneAmber
class node_entry,node_threadx,node_platform,node_cmsis,node_bsp,node_filex,node_external_memory toneMint
class node_netx,node_ethernet toneRose
class node_operator toneIndigo
```

## Components

### Vision and AI

- [Camera application](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/camera_app.c): `FSBL/Application/Camera/camera_app.c`
- [Camera pipeline](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/app_camerapipeline.c): `FSBL/Application/Camera/app_camerapipeline.c`
- [Camera DCMIPP](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Middlewares/ST/stm32-mw-camera): `Middlewares/ST/stm32-mw-camera`
- [Image crop](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Camera/crop_img.c): `FSBL/Application/Camera/crop_img.c`
- [AI application](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/AI/ai_app.c): `FSBL/Application/AI/ai_app.c`
- [Generated network](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Model/STM32N6570-DK/network.c): `Model/STM32N6570-DK/network.c`
- [STAI runtime](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Middlewares/ST/stedgeai-lib): `Middlewares/ST/stedgeai-lib`

### Board I/O

- [LCD application](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/LCD/lcd_app.c): `FSBL/Application/LCD/lcd_app.c`
- [LCD drawing](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Utilities/lcd/stm32_lcd.c): `Utilities/lcd/stm32_lcd.c`
- [USBX CDC](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/USBX/App/app_usbx.c): `FSBL/Application/USBX/App/app_usbx.c`

### Runtime and platform

- [Application entry](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/Core/Src/main.c): `FSBL/Application/Core/Src/main.c`
- [ThreadX runtime](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/FSBL/Application/RTOS): `FSBL/Application/RTOS`
- [STM32 platform](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Drivers/STM32N6xx_HAL_Driver/Inc): `Drivers/STM32N6xx_HAL_Driver/Inc`
- [CMSIS device](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/tree/main/Drivers/CMSIS/Device/ST/STM32N6xx/Include): `Drivers/CMSIS/Device/ST/STM32N6xx/Include`
- [Board support](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Drivers/BSP/STM32N6570-DK/stm32n6570_discovery.h): `Drivers/BSP/STM32N6570-DK/stm32n6570_discovery.h`
- [SD file storage](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/FileX/App/app_filex.c): `FSBL/Application/FileX/App/app_filex.c`
- [NOR and PSRAM](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/Drivers/BSP/STM32N6570-DK/stm32n6570_discovery_xspi.c): `Drivers/BSP/STM32N6570-DK/stm32n6570_discovery_xspi.c`

### Connectivity

- [NetX Duo](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/NetXDuo/App/app_netxduo.c): `FSBL/Application/NetXDuo/App/app_netxduo.c`
- [Ethernet interface](https://github.com/ckflight/stm32n6570-threadx-ethernet-usb-cdc-ai-face-detection/blob/main/FSBL/Application/NetXDuo/Target/ethernet.c): `FSBL/Application/NetXDuo/Target/ethernet.c`

### Other components

- **Board operator**

## Connections

- Board operator → Application entry: starts board
- Application entry → ThreadX runtime: starts runtime (evidence: `FSBL/Application/Core/Src/main.c`)
- Application entry → Camera application: initializes (evidence: `FSBL/Application/Core/Src/main.c`)
- Application entry → AI application: initializes (evidence: `FSBL/Application/Core/Src/main.c`)
- Application entry → LCD application: initializes (evidence: `FSBL/Application/Core/Src/main.c`)
- Application entry → NetX Duo: initializes (evidence: `FSBL/Application/Core/Src/main.c`)
- Application entry → USBX CDC: configures
- Camera application → Camera pipeline: uses pipeline
- Camera pipeline → Camera DCMIPP: configures capture (evidence: `FSBL/Application/Camera/app_camerapipeline.c`)
- Camera pipeline → Image crop: uses crop
- Camera pipeline → AI application: feeds NN input
- AI application → STAI runtime: runs inference
- STAI runtime → Generated network: executes network (evidence: `Model/STM32N6570-DK/network.c`)
- AI application → Board operator: returns detections
- Camera application → LCD application: displays camera
- LCD application → LCD drawing: draws display
- NetX Duo → Ethernet interface: uses interface
- Application entry → SD file storage: initializes (evidence: `FSBL/Application/Core/Src/main.c`)
- Application entry → NOR and PSRAM: configures XSPI
- Application entry → STM32 platform: uses HAL
- STM32 platform → CMSIS device: targets device (evidence: `Drivers/STM32N6xx_HAL_Driver/Inc/stm32n6xx_hal.h`)
- Application entry → Board support: uses board support (evidence: `FSBL/Application/Core/Src/main.c`)
