Unable to flash STM32F103RB (Nucleo) – ST-Link "Internal command error" / "Target DLL has been cancelled"
Hello everyone,
I am unable to program my STM32F103RB microcontroller. The project builds cleanly (0 Error(s), 0 Warning(s)), but flashing the target consistently fails.
Environment & Hardware:
-
MCU: STM32F103RB
-
OS: Windows
-
IDEs tested: Keil µVision 5.3 (ARM Compiler V6.14) and PlatformIO (
platform = ststm32,board = genericSTM32F103RB
Symptoms & Error messages:
-
In Keil µVision, clicking LOAD triggers
Debugger - Cortex-M Error: Internal command errorimmediately followed byError: Flash Download failed - Target DLL has been cancelled. After modifying debug settings, I also gotError while accessing a target resource. Resource perhaps not available or a wrong access was attempted.
-
In PlatformIO, uploading fails as well, confirming the issue is independent of Keil.
-
In Windows Device Manager, under Ports (COM & LPT), only a generic
USB Serial Device (COM5)(Périphérique série USB (COM5)) appears, with no dedicated STMicroelectronics STLink device visible.
Troubleshooting steps already tried:
-
Reconnected the USB cable and tested different USB ports.
-
Set the ST-Link connection mode to Connect: under Reset and lowered the SWD Max Clock in Keil.
-
Tried holding the hardware RESET button while initiating the flash download.
-
Verified the Flash Download algorithm (
STM32F10x Med-density Flash) and target memory layout (IROM1: 0x8000000,IRAM1: 0x20000000). -
Tested uploading through PlatformIO
What could cause this issue (missing ST-Link USB driver, corrupted ST-Link firmware, or a hardware lock on the STM32F103RB)? Any help would be greatly appreciated.
