cancel
Showing results for 
Search instead for 
Did you mean: 

Why failed to erase memory

IReta.1
Associate II

Hi all,

I am new at STM32 world, however I had a 1-2 days long meeting with Bluepill board about two years ago. That time I used succesfully Atollic studio to do my first steps with Bluepill and ST-LINK clone bought on ebay.

Now I want to re-start with some led-blinking program. I use the devices successfully used before. The difference is that I have just-installed STM32CubeIde and STSW-LINK004.

There is an error I cannot overcome. The programming device is recognised but the connection lost soon.

Than I guessed the ST-LINK clone is not supported any more. So I tryed programming part of 32F072BDISCOVERY board. I made a successful version upgrad but the error is the same.

However the command line st-flask erase is working.

I found same issues but the answer - if was there any - did not help.

Please help to solve this phenomena.

Istvan

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

STMicroelectronics ST-LINK GDB server. Version 5.5.0

Copyright (c) 2019, STMicroelectronics. All rights reserved.

Starting server with the following options:

       Persistent Mode           : Disabled

       Logging Level             : 1

       Listen Port Number        : 61234

       Status Refresh Delay      : 15s

       Verbose Mode              : Disabled

       SWD Debug                 : Enabled

Waiting for debugger connection...

Debugger connected

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

                       STM32CubeProgrammer v2.4.0                 

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

ST-LINK SN : 56FF68064966485644190167

ST-LINK FW : V2J37S7

Voltage    : 3,26V

SWD freq   : 1800 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x410

Device name : STM32F101/F102/F103 Medium-density

Flash size : 128 KBytes (default)

Device type : MCU

Device CPU : Cortex-M3

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_gb8sTl.srec

 File         : ST-LINK_GDB_server_gb8sTl.srec

 Size         : 23120 Bytes

 Address      : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 22]

Error: failed to erase memory

Error: failed to erase memory

Encountered Error when opening /opt/st/stm32cubeide_1.3.0/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_1.3.0.202002181050/tools/bin/STM32_Programmer_CLI

Error in STM32CubeProgrammer

Debugger connection lost.

Shutting down...

3 REPLIES 3
Andreas Bolsch
Lead II

Don't know about STM32CubeProgrammer, but regarding STM32CubeIde: This one apparently uses OpenOCD (build on 2020-02-20) internally, which might clash with your ST-Link firmware version "ST-LINK FW : V2J37S7", see http://openocd.zylin.com/#/c/5691/.

Don't worry about an ST-Link clone, they use the original firmware and hence work (or don't work) in the same way as the original as long as the missing NRST and SWO connections are not used.

IReta.1
Associate II

Thank you for your answer. Now I tried several settings and changing the components. I used STLINK from ebay, then changed to STLINK of 32F072BDISCOVERY board vice-versa, changed BluePill copies, modified forth and back STM32CubeIDE debug options. Unfortunately I am not familiar what is behind these options. The actual error message is below.

Anybody can suggest a detailed describtion abot setting these options?

Thanks forward

Istvan

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

Starting server with the following options:

       Persistent Mode           : Disabled

       Logging Level             : 1

       Listen Port Number        : 61234

       Status Refresh Delay      : 15s

       Verbose Mode              : Disabled

       SWD Debug                 : Enabled

Target no device found

Error in initializing ST-LINK device.

Reason: No device found on target.

Ihawk.1
Associate II

FWIW I found that loading the stmcubeprogrammer program , going to option bytes and unchecking the 'read protection option byte' cured the

"Erasing internal memory sectors [0 39] Error: failed to erase memory"

issue on my stm32f103c8t6 blue pill; presumably it was pre programmed this way because of its anticipated use as an Arduino.

Perhaps it is the same for other Arduino orientated stm32 dev boards.