cancel
Showing results for 
Search instead for 
Did you mean: 

When we enter commands , we observe Error: ST-LINK error (DEV_TARGET_CMD_ERR) for the first time and when we enter the same command again (second try) it is executed.

PS.7
Associate

We are facing this error when entering every commands. Second attempt of the command is passed while in first attempt we get ST Link error.

Please find the commands executed and error faced:

C:\Users\irgpsj>"C:/Program Files (x86)/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI" -c port=SWD --erase all

-------------------------------------------------------------------

STM32CubeProgrammer v2.4.0

-------------------------------------------------------------------

ST-LINK SN : 34FF6D064D4E353842310643

ST-LINK FW : V2J31S7

Voltage : 3.20V

Error: ST-LINK error (DEV_TARGET_CMD_ERR)

C:\Users\irgpsj>"C:/Program Files (x86)/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI" -c port=SWD --erase all

-------------------------------------------------------------------

STM32CubeProgrammer v2.4.0

-------------------------------------------------------------------

ST-LINK SN : 34FF6D064D4E353842310643

ST-LINK FW : V2J31S7

Voltage : 3.20V

SWD freq : 4000 KHz

Connect mode: Normal

Reset mode : Software reset

Device ID : 0x450

Device name : STM32H7xx

Flash size : 2 MBytes

Device type : MCU

Device CPU : Cortex-M7

Mass erase ...

Mass erase successfully achieved

C:\Users\irgpsj>"C:/Program Files (x86)/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI" -c port=SWD --erase all

-------------------------------------------------------------------

STM32CubeProgrammer v2.4.0

-------------------------------------------------------------------

ST-LINK SN : 34FF6D064D4E353842310643

ST-LINK FW : V2J31S7

Voltage : 3.20V

Error: ST-LINK error (DEV_TARGET_CMD_ERR)

3 REPLIES 3
Houda GHABRI
ST Employee

Hi PS.7 ,

Can you please try ton connect under reset and with mower frequency?

Also I recommend you to switch to last CubeRogrammer version 2.7.O, available inst.com, please uninstall the old one or install it in new folder.

Hope this helps you.

Houda

PS.7
Associate

Hi Houda, Thank you for the response, I tried the steps you shared yet facing the same issue.

RMali.2
Associate

Hello,

thank you for sharing. I could not connect my device to the STM32CubeProgrammer and only got the following error message:

Error: ST-LINK error (DEV_TARGET_CMD_ERR)

It seems that in the past it was possible to erase the chip without establishing a connection (ST-Link Utility). However, when using the STM32CubeProgrammer, a connection is required to be able to erase it.

The solution is to use the client and erase the chip while reset button is pressed. Here's how I proceed:

  1. connect device while reset button is pressed
  2. execute the command as given in this question:
  3. "C:/Program Files (x86)/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI" -c port=SWD --erase all
  4. immediately after entering the command the button needs to be released.