Keil Logo

µVISION DEBUGGER: ST-LINK USB Communication Error


Information in this knowledgebase article applies to:

  • MDK-ARM Version 5
  • ST-LINK with firmware

QUESTION

Using a ST-Link with MDK, when starting a debug session or a flash downloading, µVision issues the following error:

ST-Link Error: USB communication error

What's the reason for this error and how do you troubleshoot it?

ANSWER

If you are using a recent version of MDK...

download, install, and open the ST-Link Utility. Configure it and program the device.

If unsuccessful, this test shows that either the board, the jumper configuration, the windows drivers, the board firmware or the USB interface has an issue.

CHECK THE WINDOWS DEVICE MANAGER

Windows device manager should show under the Universal Serial Bus devices section a STM32 STLINK.

There is a low level issue if, this entry is missing, there is a "caution" symbol on the USB icon, or there is an entry under the Universal Serial Bus controllers section labeled USB Composite device with a "caution" icon.

CHECK THE USB SETTINGS

  • Verify that only one application is connected to the ST-Link at a time (ex. if both µVision and the ST-Link Utility try to use the ST-Link at the same time, this can cause connection issues).
  • Try using another USB port on the PC. If using a Hub, try connecting directly to the PC.
  • Try using another USB cable.
  • Make sure that the Microsoft Windows Device Manager recognizes the ST-Link. If it is having issues, check the power settings as described in their help article Error: “USB Device not recognized” when you try to access a USB external hard drive.

CHECK THE ST-LINK DRIVERS AND FIRMWARE

  • Upgrade to the latest version of MDK. New releases contain a more recent version of the ST-Link drivers. Improvements and fixes are added over time to stabilize debug connections.
  • In other cases, upgrading the ST-Link firmware is the correct approach. On some ST-Link versions, multiple drivers are loaded, from the debug unit itself, when the ST-Link is first connected to a PC. Try the latest firmware and drivers from ST's website, instead.
  • Uninstall and reinstall the ST Link driver on the PC, using Windows Device Manager. See the steps in the article µVision DEBUGGER: ST-Link Does Not Connect to STM32F4 Discovery Board

CHECK THE BOARD SETTINGS

  • If this is a board provided by STMicroelectronics, check the Boot jumpers on the board to make sure you are booting to the correct memory. Pull the BOOT (sometimes labeled BOOT0) pin high by jumpering it to the VDD pin, and restart the board. At reset, since BOOT is pulled high with 3V the device boots up in a different memory location. Perform a flash full chip flash erase.
  • If there is also the error message "Internal command error" a previous program running on the board is locking up.

    In the Keil IDE, under Project-> Options for Target -> on the "Debug" tab, on the top right of the dialog, next the "USE: ST-Link Debugger, click the "Settings" button - the "Cortex-M Target Driver Setup" dialog appears. Try using "connect under reset", close the dialogs and then perform a flash erase.

FOR SYSTEMS RUNNIING OLDER VERISONS OF MDK

These are items that have already been fixed in modern versions of MDK.

  • For MDK 5.15 or older...

    If there is also the error message "Internal DLL Error" follow the steps in µVision DEBUGGER: Internal DLL Error Debugging with ST-Link Driver.

  • For MDK 5.11a or older...

    There was an incompatibility between ST-Link Firmware versionV2.J21.S0 and the µVision ST-Link Debugger driver(ST-LINKIII-KEIL_SWO.dll) version 2.0.6.0 which is part of MDK-ARM 5.11a. There are two ways to solve this problem:

    1. Update the µVision ST-Link Debug driver (recommended way):
      Download the ZIP file attached to this knowledgebase article and unzip it to the folder
      [MDK-ARM install path]\ARM\ST-LINK
    2. Downgrade the firmware of the ST-LINK debug adapter:
      Start the tool [MDK install path]\ARM\STLINK\ST-LinkUpgrade.exe to downgrade the ST-LINK firmware to V2.J20.S0
  • MDK V4.62a and older...
    If there is also the error message "Internal Command Error" follow the steps in µVision DEBUGGER: ST-Link Does Not Connect to STM32F4 Discovery Board.
  • For MDK 4.14 or older...
    If there is also the error message "memory verification error" follow the steps in µVision DEBUGGER: DEBUGGING WITH ST-LINK THROUGH A USB HUB.

MORE INFORMATION

SEE ALSO

ATTACHED FILES

Request the files attached to this knowledgebase article.

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, July 17, 2018


Did this article provide the answer you needed?
 
Yes
No
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.