Skip to main content
Tiel
Associate III
August 7, 2026
Question

[Stm32 CubeIDE Debug Issue - Debug Start Success Rate Only 50% If SWBoot0=1(this is default option value)

  • August 7, 2026
  • 0 replies
  • 21 views

Hello,

I'm experiencing a strange debugging issue with an STM32L431 and would like to know whether anyone has seen a similar problem.

Environment

  • MCU: STM32L431

  • IDE: STM32CubeIDE v2.1.1

  • Debugger: ST-LINK/V2,  used SWD (SWJTAG)

  • Boot0 pin is connected and used for System Bootloader update.

Issue

When starting a debug session from STM32CubeIDE, the debugger connects successfully and downloads the binary to the target Flash. However, about 50% of the time, after entering the debug session, the program counter (PC) is set to an incorrect start address and the SRAM contents appear to be corrupted. As a result, debugging cannot proceed normally.

Typically:

  • 1 out of 2 debug-attempts works normally.

  • On the failed attempts, the target reset/debug state appears to be abnormal.

  • CubeIDE cannot start debugging correctly until I retry.

Observation

If I program the Option Bytes with:  ( uisng CubeProgrammer)

nSWBOOT0 = 0

the problem seems to completely disappear.

Debugging becomes stable and succeeds every time.

However, I cannot use the BOOT0 pin to enter the STM32 System Bootloader anymore, which is required for our firmware update method.

This symptom is not shown on IAR-embedded workbench.

 

Questions

  1. Has anyone experienced unstable debugging when nSWBOOT0 is enabled?

  2. Is there any known interaction between:

    • BOOT0 pin

    • nSWBOOT0 Option Byte

    • ST-LINK/V2

    • STM32CubeIDE

  3. Are there any recommended Option Byte settings for projects that require both:

    • reliable SWD debugging

    • BOOT0 pin based System Bootloader updates?

  4. Is this a known issue of STM32L431 or CubeIDE v2.1.1?

Additional Information

  • Hardware is custom-designed, and BOOT0 pin has a pull-down resistor and is LOW during normal operation.

  • NRST is connected to ST-LINK.

Any suggestions or troubleshooting ideas would be greatly appreciated.

Thank you.

Best Regards,
Tommy Lim