Skip to main content
Associate II
February 24, 2026
Question

STM32N6 – HardFault (INVPC) when calling tx_thread_schedule() in Non-Secure

  • February 24, 2026
  • 1 reply
  • 170 views

Hi everyone,

I’m working on an STM32N6 project configured with:

  • ThreadX running in Non-Secure

  • SAU configured

  • RISAF configured

  • External Memory Manager enabled(Load and Run mode)

The project is very simple. However, when debugging the Non-Secure application, as soon as tx_thread_schedule() is called, execution jumps to HardFault.
The Fault Analyzer reports: “Attempt to do exception with bad value in EXEC_RETURN number (INVPC)”.

The code is loaded in external flash memory using Load and Run mode, the signed bin files are uploaded in the external flash using STM32CubeProg and then debugged using STM32CubeIDE.
Has anyone experienced INVPC errors on STM32N6 with ThreadX in Non-Secure?
Any suggestions would be greatly appreciated.

1 reply

Technical Moderator
March 24, 2026

Hello @LisaB 

Please refer to the article below to debug your HardFauld.

How to debug a HardFault on an Arm® Cortex®-M STM3... - STMicroelectronics Community

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"