cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE not flashing MCU

arthur_lnf
Associate

Hi! I'm trying to flash a STM32L422KBT6 with STM32CubeIDE 1.13.2 and ST-LINK V2 and I keep getting this error:

 

Error: failed to erase memory

Encountered Error when opening C:\ST\STM32CubeIDE_1.13.2\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.0.202305091550\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer

Shutting down...

Exit.

 

How can I solve it?

6 REPLIES 6
Pavel A.
Evangelist III

Delete your debug and run configurations (note any non default settings if made) and create new one.

ramprakash08
Associate III

Based on the error message you're seeing, it seems like there might be an issue with the STM32CubeProgrammer. Here are a few steps you can try to resolve this:

  1. Check your proxy settings. You can do this in STM32CubeIDE by going to Window -> Preferences -> Network Connections and activating the Native provider. Then, go to Window -> Preferences -> Firmware Updater and click on Check Connection. Don't forget to Apply and Close if the connection works.
  2. Try resetting your target board and ST-LINK V2. Power off the target board, disconnect the ST-LINK JTAG USB cable, reconnect it, and then power on the target board.
  3. Check your debug configuration settings, such as the SWD/JTAG interface.
  4. Try starting the GDB server with a different port number.

If you're still encountering issues, it might be helpful to enable verbose logging in STM32CubeProgrammer to get more detailed error messages. This can be done by activating verbose 3 in the settings.

Remember to check the path to your STM32_Programmer_CLI.exe file. The error message indicates that there might be an issue opening this file, so make sure the path is correct and the file is accessible.

Lastly, ensure that your STM32L422KBT6 MCU is compatible with the version of STM32CubeIDE you're using. You can check this in the MCU/MPU Selector on the STMicroelectronics website.

TDK
Guru

Genuine programmer or a fake one? There should be more to the log above the "Error: failed to erase memory" line which would indicate where exactly in the process it is failing.

If you feel a post has answered your question, please click "Accept as Solution".
iforce2d
Associate III

I'm getting the same problem, although on Linux, trying to flash a STM32H743VIT6

 

      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.14.0                  
      -------------------------------------------------------------------
Log output file:   /tmp/STM32CubeProgrammer_pqbbR9.log
ST-LINK SN  : 54FF6D064982515710391287
ST-LINK FW  : V2J42S7
Board       : --
Voltage     : 3.22V
Error: ST-LINK error (DEV_TARGET_RESET_ERR)
Encountered Error when opening /opt/st/stm32cubeide_1.13.2/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_2.1.0.202305091550/tools/bin/STM32_Programmer_CLI
Error in STM32CubeProgrammer
Shutting down...
Exit.

 

I would show you the content of /tmp/STM32CubeProgrammer_pqbbR9.log but it does not exist !!

The file metioned as causing the error (STM32_Programmer_CLI) does exist and is readable by my user account.

I was using this ST-Link just fine with CubeIDE 1.12.1 until a few minutes ago, when the IDE forced me to update the firmware after installing CubeIDE 1.13.1

iforce2d
Associate III

The problem was SystemClock_Config() not working properly above certain clock speeds, causing the ST-Link to lose connection when the debug port didn't respond. I'll start a different thread for that. Almost a whole day spent and I'm only just getting an LED to blink.... ugh.

The problem was SystemClock_Config() not working properly above certain clock speeds, causing the ST-Link to lose connection 

TL;DR always use "connect under reset" mode, unless you know what you're doing.