cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with programming STM32L mcu with stm32cubeIDE (failed to erase memory)

Iman Hosseinzadeh
Associate III

Hi All,

I am trying to program a STM32L152R8 MCU with stm32cubeIDE v1.4. The MCU is not brand-new and is soldered on a board. I want to change its firmware.

While debugging with ST-Link Debugger I encounter the following error:

-------

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_a07132.srec

 File         : ST-LINK_GDB_server_a07132.srec

 Size         : 9052 Bytes

 Address      : 0x08000000

Erasing memory corresponding to segment 0:

Error: Flash loader cannot be loaded

Error: failed to erase memory

Encountered Error when opening E:\ST\STM32CubeIDE_1.4.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.4.0.202002181050\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer

Debugger connection lost.

Shutting down...

------

Notes:

  1. The reset pin is connected,
  2. I've tried to mass erase the chip using st-link utility,
  3. OpenOCD works but the live expression is disabled,
  4. Keil uVision and ST-Link Utility work fine without any problems

Any ideas?

6 REPLIES 6
KnarfB
Principal III

You say that you are working with STM32CubeIDE 1.4 but the error messages says that the programming (flash) tool cannot be found in E:\ST\STM32CubeIDE_1.3.0.

It could help if you uninstall all old versions and make a clean install of 1.4 version to solve the issue.

Iman Hosseinzadeh
Associate III

Thanks. I copied the error message wrongly. I used both 1.3 and 1.4 versions after clean reinstall. None of them worked.

EJOHA
Senior

Please try to use STM32CubeProgrammer GUI and erase STM32L152R8 flash with it. Does it work? (The complete STM32CubeProgrammer with GUI needs to be downloaded from ST site if you do not have it installed earlier. STM32CubeIDE only installs the client version without GUI)

Another question. Did it work to erase flash using st-link utility?

com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.4.0.202002181050 (form your above path) is not shipped with the latest STM32CubeIDE (1.4.2. after in-eclipse update). Uninstall & delete all files of 1.3 and 1.4. Then, try re-installing 1.4 from scratch and check again.

hth

KnarfB

Iman Hosseinzadeh
Associate III

Yes I erased it completely.

I will check Programmer. Thanks.

Thanks. I will try this.