Skip to main content
Associate II
August 11, 2026
Question

STM32N6 Hard Fault from FreeRTOS

  • August 11, 2026
  • 4 replies
  • 31 views

I am attempting to setup a new Hello World project on the STM32N6 using the following:

  1.  FreeRTOS running two tasks, a timer, and a semaphore
  2. A couple of hardware timers
  3. A USART
  4. The PSSI doing 16 bit bi-directional transfers
  5. The BSP package

Running the debugger I get

followed by a Hard Fault:

The code is running on a Nucleo-N657XO-Q development board.  My development tools are:

  1.  STMCube 6.18.1
  2. STM32Cube_FW_N6_V1.4.0
  3. IAR 9.60.4

Something not correctly setup or a bad board?

4 replies

Andrew Neil
Super User
August 11, 2026

IAR 9.60.4

You’d be better asking IAR for support with their IDE, and what to do about that particular IAR message.

Did you try Tools > Options, as it suggests ?

 

General tips on debugging Cortex-M Hard Faults.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate II
August 11, 2026

I have been doing the code construction in stages, prior to adding the timers, both soft and hard, the following code worked:

Perhaps this is indication of a memory access issue?

I see nothing obvious in tools-->options.

 

Andrew Neil
Super User
August 11, 2026

I see nothing obvious in tools-->options.

 

Again, that’s an IAR thing: best to ask them about that - it is their product, and you’ve paid for support as part of your licence.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
ST Technical Moderator
August 12, 2026

Hi ​@Neuraleanus 

I assume ​@Andrew Neil is pointing to this interesting article How to debug a HardFault on an Arm® Cortex®-M STM32 | Community

From the information provided, this does not look like a toolchain issue. I would recommend to comment out all printf() calls first to narrow down the issue stack / lib c / UART problem vs RTOS / peripheral / memory issue

BFAR 0xC usually means NULL pointer + offset.

The value of PC just before the exception has occurred shown in the debug window (can be found in the stack (Exception frame) points to the faulty instruction. 

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL