cancel
Showing results for 
Search instead for 
Did you mean: 

How to allow debugger to attach on STM32N6 when booting from FLASH

AMurz.1
Associate II

Hi,

I've flashed an application in the STM32N6570-DK board using a FSBL and Appli projects. The application boots fine.

But when the application is running, I can't attach to it using the debugger and ST-Link.

I've tried to open the debug port of the STM32N6 by writing 0xB4 to the BSEC_AP_UNLOCK register, but it still fails.

The error I get is:

STMicroelectronics ST-LINK GDB server. Version 7.11.0
Copyright (c) 2025, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled

Target unknown error 32

Error in initializing ST-LINK device.
Reason: Unknown. Please check power and cabling to target.

Using STM32CubeProgrammer, I get this error on Access Port 1 with Hot Plug mode:

AMurz1_0-1754215464319.png

But I've not configured anything: I've not blown any OTP fuse, nor changed any Option bytes. And I'm not using a secure bootloader, I have just the generated FSBL from STM32CubeMX which loads the application from flash to RAM using ExtMemManager.

I'm assuming the DEV_MODE is doing something to open the debug access before doing it's busy loop waiting for a debugger to attach. 

 

As a workaround, I can get the debugger to work if I do this:

  • Switch to DEV_MODE
  • Power-up the board
  • Switch to FLASH boot mode without power-cycling
  • Press the reset button

Then the application will start from flash and I can attach the debugger.

 

How to open the debug access from the application even without using DEV_MODE ?

 

0 REPLIES 0