2025-11-22 5:11 AM - last edited on 2025-11-22 5:42 AM by Andrew Neil
On STM32N6570-DK, enabling ANY peripheral together with ThreadX or FreeRTOS causes an immediate HardFault, even in a minimal CubeMX-generated project with no user code.
This includes peripherals such as:
DCMIPP
LTDC
SDMMC
USB
UART
I2C
SPI
GPIO with interrupts
DMA
Anything beyond simple GPIO output
The issue is NOT limited to the camera/display pipeline.
Board: STM32N6570-DK
IDE: STM32CubeIDE (latest)
CubeMX: latest version
Firmware: STM32N6 HAL/BSP (latest)
Security Modes Tested:
FSBL + Application (secure/non-secure)
Non-secure Application only (no FSBL)
Both show the same problem.
✔ RTOS disabled → All peripherals work
✔ Camera + display pipeline works bare-metal
✔ GPIO output works with RTOS (LED blink, simple logic)
:cross_mark:ThreadX + ANY peripheral init → HardFault
:cross_mark:FreeRTOS + ANY peripheral init → HardFault
:cross_mark:Even minimal projects with zero user code crash before scheduler start
:cross_mark:Commenting a peripheral moves the crash to the next peripheral init call
This happens even if RTOS is never started.
Example minimal code that crashes:
int main(void)
{
HAL_Init();
SystemClock_Config(); // OK
MX_GPIO_Init(); // OK
MX_USART1_UART_Init(); // HardFault here
MX_FREERTOS_Init(); // never reached
vTaskStartScheduler(); // never reached }Replacing UART with LTDC, DCMIPP, SDMMC, USB, SPI, etc. produces the same HardFault.
Fresh CubeMX project → STM32N6570-DK → Non-secure application only
Enable:
FreeRTOS OR ThreadX
ONE peripheral (any peripheral except simple GPIO output)
Compile → Run → HardFault before entering user code.
HardFault occurs inside HAL init for the first peripheral that uses:
DMA
Interrupts
Clocks beyond basic GPIO
NVIC
Cache-sensitive memory
Peripheral register access
If DCMIPP is commented → LTDC crashes
If LTDC is commented → SDMMC crashes
If SDMMC is commented → UART crashes
This makes it clear that the RTOS + STM32N6 low-level HAL interaction is broken.
Verified with both ThreadX and FreeRTOS
Repeated under FSBL+Application and standalone Application
Removed all user code
Removed all camera/display code
Moved buffers to different RAM regions
Disabled MPU
Disabled ICACHE/DCACHE
Disabled SysTick
Increased stacks and heaps
Checked TrustZone/NSC configuration
Checked RIF/Security attributes
Confirmed same behavior on multiple freshly created projects
This appears to be a system-level issue in STM32N6 RTOS integration.
CubeMX-generated startup, memory layout, low-level drivers, or TrustZone/RIF configuration may not be correctly handling RTOS environments.
The critical point is:
Any RTOS + any peripheral (beyond GPIO) = HardFault, even before scheduler start.
This is not normal, and seems like a HAL, BSP, or CubeMX integration bug specific to STM32N6.
Confirm whether ThreadX and FreeRTOS are currently supported for STM32N6570 peripherals in CubeMX.
Provide a working minimal example (blinky + UART) using RTOS on N6.
Clarify:
Required MPU configuration
Required security / RIF / TrustZone setup
Required memory placement
Required cache settings
Identify whether this is a known issue on STM32N6 with RTOS.
Provide workaround or patch if available.
Solved! Go to Solution.
2025-11-24 1:07 AM
Hello @JaiGanesh
Please refer to the examples ThreadX and FreeRTOS below:
STM32CubeN6/Projects/NUCLEO-N657X0-Q/Applications/ThreadX at main · STMicroelectronics/STM32CubeN6
x-cube-freertos/Projects/NUCLEO-N657X0-Q/Applications at main · STMicroelectronics/x-cube-freertos
2025-11-22 7:10 AM - edited 2025-11-22 8:56 AM
I went in a similar problem with ThreadX.
After some debugging, I found that relates to global variables and relative initialzation not fitting correctly in assigned space.
Check sections and partitions in .ld file toward actual addresses, could be that some is overlapping and overwrite happens at start; if it is the case, change sizes to fit everything.
Some more suggestion:
check RCC register for corruption;
check stack allocation.
2025-11-24 1:07 AM
Hello @JaiGanesh
Please refer to the examples ThreadX and FreeRTOS below:
STM32CubeN6/Projects/NUCLEO-N657X0-Q/Applications/ThreadX at main · STMicroelectronics/STM32CubeN6
x-cube-freertos/Projects/NUCLEO-N657X0-Q/Applications at main · STMicroelectronics/x-cube-freertos