Keil Logo

µVISION DEBUGGER: ST-Link: internal command error

Information in this knowledgebase article applies to:

  • MDK-ARM V5
  • STM32 project with ST-Link selected as target debugger


I have selected the ST-Link target debugger in my project, but when I flash my application or when I start the debugger an "Internal command error" comes up.

How can I overcome this error?


There are two solutions, as mentioned below:

1. Connect the target device under Reset as shown below in Debug Settings

2. To upgrade the ST-Link firmware.

Use the ST-Link Upgrader to proceed.

This tool is stored at:

[MDK install path]\ARM\STLink\ST-LinkUpgrade.exe

Note: If:

  • The connection is lost after several seconds with the message:
        Cannot access target. Shutting down debug session.


  • The message "Internal command error" is briefly displayed in command window, before debug session exits,

Then investigate the following causes:

  • HAL_GPIO_DeInit() was used on debug pins. Check SWDIO/TMS and SWDIO/TCK pins in software layer.
  • The device somehow enters low power mode and disables debug pins.


Last Reviewed: Tuesday, November 20, 2018

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.