Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE debugger not working on STM32U5A9J-DK

Associate III

Hi everybody

I'm unable to start my project within the STM32CubeIDE on a STM32U5A9J-DK with the debugger. I would like to use the Segger J-Link as we will use it in our custom design. But i also have problems using the ST-Link V3.

The project was generated with TouchGFX Designer.

My Setup:

  • TouchGFX Designer V4.21.4
  • STM32CubeIDE V1.12.1

I have tested it with the onboard ST-Link V3 and with a Segger J-Link.

ST-Link V3 Setup:

  • Use default Jumper settings of Dev Kit
  • Connect Board on CN5 (ST-Link) to PC
  • First time start debugging in STM32CubeIDE it works out of the Box.
  • On second time, the debugger is stuck in the Reset_Handler:

  • _legacyfs_online_stmicro_images_0693W00000bkvUSQAY.png
  • obviously always restart the IDE before debugging is not a valid option.

Segger J-Link Setup:

  • Move Jumper JP5 to JP6 to keep ST-Link in reset
  • Move Jumper JP4 to USBC to power device over USB-C
  • Connect Segger J-Link on MIPI-10 connector (CN11)
  • Connect Power to USB-C Port (CN4)
  • Change Run configuration to use the J-Link
  • Press Debug button in CubeIDE
    • Flash is programmed
    • Application hangs in HardFault_Handler

    • _legacyfs_online_stmicro_images_0693W00000bkvW4QAI.png
  • Press Run button in the CubeIDE
    • Flash is programmed
    • Application hangs
    • After pressing the reset button the application boots correctly.

In both cases, sometimes i was able to bring the debugger up, when pressing the Reset button on the Dev Kit. I would suggest, that the Reset of the MCU is not correctly handled.

On the J-Link i always have to press the Reset Button so it might be a configuration issue or Bug of Reset/Startup behavior.

Do you have any suggestion, how i can bring up a reliable setup?

ST Employee

Hi @MMess.1​

Can you try this test "Connect with cubeProgrammer" ?



Associate III

Hi Diane

Maybe i do not get you, but what do you mean with "Connect with cubeProgrammer"?

Flashing the MCU is not the problem. This always works. It only happens when try to use the Debugger.



Chief II

just..onboard stlink not working for debug is rather unlikely, ...

in your program, SWD or trace sw debug is enabled ?

and the pins not used in any other way?

or access/modify the option bytes ?


just i seen: on first try after start ide its always working fine ?

-- then i have no good idea..

and if you disconn./USB to board, wait some minute and reconnect and try debug then ?

If you feel a post has answered your question, please click "Accept as Solution".
Associate III

Hi AScha.3

I also wondering, why a new received ST Development Kit is not working out of the box with the CubeIDE.

I have used TouchGFX Designer to create thy project, so i'm not 100% sure, what is already used.

But the Debug and Trace ports are not enabled in the *.ioc file.

The prints are sill in default state, i haven't modified or connected anything else.

Option Bytes are also not modified so far.

I just found out, that the CubeIDE starts the Debug perspective where it look's like it is in break state somewhere in the startup file. But in the Console, i see that the ST-LINK is still programming the memory:


So i guess, this is a bug of the CubeIDE which should wait for Flash programming before starting the Debugging perspective.

Still sometimes i have to reset the board manually by pressing the reset button first.

This is just a thought and your experience may vary.

In the debug configuration, I chose to NOT launch the debugger in the background.
Doing so seemed to resolve this annoying GUI state that would indicate that the memory download is completed but is in fact still ongoing.

I have also noticed a significant latency  in the operation of the GDB or OpenOCD communication framework with the target. In my opinion this is more due to the design of the communication channels (TCP/IO, client server, etc. - you get the idea) more than a limitation of the debug hardware itself. I say this because direct connections to STM32 MCUs using an off-board stlink hardware works fine in most cases.

Do you need SWO for the JLink to work?  I noticed that the SWO pin is not connected by default (solder bridge removed) and the pin is connected to something else.  It's on page 39 in um2967-discovery-kit-with-stm32u5a9nj-mcu-stmicroelectronics.pdf