Lora W5 DEV Board Erasing& Downloading

Hi, I have connected ST LINK to Lora successfully, but whenever I try to flash anything or erase or interact with anything in the board, it does not want to erase or download.

I have set the option bytes read out protection to AA, it was set to AA beforehand, does any body know what the solution might be?

Are the ST-Link and target board properly connected?
Below is the log file of ST-Link. Compare it with your log file.
You may find out something.

  08:06:58 : UR connection mode is defined with the HWrst reset mode
  08:06:58 : ST-LINK SN  : 112D060032124353354B4E00
  08:06:58 : ST-LINK FW  : V2J37S7
  08:06:58 : Board       : --
  08:06:58 : Voltage     : 3.13V
  08:06:58 : SWD freq    : 4000 KHz
  08:06:58 : Connect mode: Under Reset
  08:06:58 : Reset mode  : Hardware reset
  08:06:58 : Device ID   : 0x497
  08:06:58 : Revision ID : Rev Y
  08:06:58 : Debug in Low Power mode is not supported for this device.
  08:06:59 : UPLOADING OPTION BYTES DATA ...
  08:06:59 :   Bank          : 0x00
  08:06:59 :   Address       : 0x58004020
  08:06:59 :   Size          : 96 Bytes
  08:06:59 :   Bank          : 0x01
  08:06:59 :   Address       : 0x58004080
  08:06:59 :   Size          : 8 Bytes
  08:06:59 : UPLOADING ...
  08:06:59 :   Size          : 1024 Bytes
  08:06:59 :   Address       : 0x8000000
  08:06:59 : Read progress:
  08:06:59 : Data read successfully
  08:06:59 : Time elapsed during the read operation is: 00:00:00.007
  08:07:06 : Memory Programming ...
  08:07:06 : Opening and parsing file: STM32WL_Blink.ino.hex
  08:07:06 :   File          : STM32WL_Blink.ino.hex
  08:07:06 :   Size          : 16.82 KB 
  08:07:06 :   Address       : 0x08000000 
  08:07:06 : Erasing memory corresponding to segment 0:
  08:07:06 : Erasing internal memory sectors [0 8]
  08:07:06 : Download in Progress:
  08:07:07 : File download complete
  08:07:07 : Time elapsed during download operation: 00:00:00.614
  08:07:07 : Verifying ...
  08:07:07 : Read progress:
  08:07:07 : Download verified successfully 
  08:07:07 : RUNNING Program ... 
  08:07:07 :   Address:      : 0x08000000
  08:07:07 : Application is running, Please Hold on...
  08:07:07 : Start operation achieved successfully

They are, I have GND, CLK and SWDIO connected between ST LINK v2 and the board and both connected to the PC.

Below are the logs with a verbosity of 1

21:35:37 : STM32CubeProgrammer API v2.17.0 | Windows-64Bits
21:35:41 : UR connection mode is defined with the HWrst reset mode
21:35:44 : ST-LINK SN : B55B5A1A000000006B93F001
21:35:44 : ST-LINK FW : V2J45S7
21:35:44 : Board : –
21:35:44 : Voltage : 3.25V
21:35:44 : SWD freq : 4000 KHz
21:35:44 : Connect mode: Normal
21:35:44 : Reset mode : Hardware reset
21:35:44 : Device ID : 0x497
21:35:44 : Revision ID : Rev Y
21:35:44 : Debug in Low Power mode is not supported for this device.
21:35:44 : UPLOADING OPTION BYTES DATA …
21:35:44 : Bank : 0x00
21:35:44 : Address : 0x58004020
21:35:44 : Size : 96 Bytes
21:35:44 : Bank : 0x01
21:35:44 : Address : 0x58004080
21:35:44 : Size : 8 Bytes
21:35:44 : UPLOADING …
21:35:44 : Size : 1024 Bytes
21:35:44 : Address : 0x8000000
21:35:44 : Read progress:
21:35:44 : Data read successfully
21:35:44 : Time elapsed during the read operation is: 00:00:00.006
21:36:22 : MASS ERASE …
21:36:22 : Error: Mass erase operation failed.Please verify flash protection
21:37:15 : Read File: C:\Users\ksedr\OneDrive\Desktop\Blink.hex
21:37:15 : Number of segments: 1
21:37:15 : segment[0]: address= 0x8000000, size= 0x1C08
21:37:27 : Memory Programming …
21:37:27 : Opening and parsing file: Blink.hex
21:37:27 : File : Blink.hex
21:37:27 : Size : 7.01 KB
21:37:27 : Address : 0x08000000
21:37:27 : Erasing memory corresponding to segment 0:
21:37:27 : Erasing internal memory sectors [0 3]
21:37:27 : Error: failed to erase memory
21:37:27 : Error: failed to erase memory

Why does your Programmer “MASS ERASE”? Do you have any options set?
Have you tried “Apply” RDP=AA again?

Yes, I have tried setting RDP to AA and applying the changes.
I have also tried to press on reset while trying to download and then to set RDP to AA again.
However, I am concerned by the fact that I can’t also change RDP to BB, it cannot be changed from AA.

Regarding the MASS ERASE, I was trying on my own to erase either part or all of the memory to try any interaction with it.

Regarding the MASS ERASE, I was trying on my own to erase either part or all of the memory to try any interaction with it.

  1. Have you tried writing without MASS ERASE?
  2. Are you trying to write a hex file for the first time? Or were you able to write them before without any problems?
  3. Is the connection between ST-Link and the target board correct?
ST-Link       Target Board
SWCLK   <---->   CLK
SWDIO   <---->   DIO
GND     <---->   GND

Please refer to the following connection.
Programming LoRa-E5 with Arduino, LoRa-E5 mini Point to Point Comminucation over 24 km - #8 by msfujino

HI there,
FWIW,
I see the Firmware for the STLinks are different… just saying?
Seams to me it should work?
GL :slight_smile: PJ :v:

I was wondering about that, but you are right.
My ST-Link is a clone so I cannot update the firmware any further. His ST-Link seems to have a newer firmware.
But I think it should work.

1 Like

1- Initially I have tried downloading without mass erase, I only started attempting erase when I lost hope of any interaction with the board
2- Yes this is my first hex to try
3- Yes this is identical to my connection, as any deviation from this setting would cause the ST Link not to connect in the cube

  1. Select BB from the RDP pull-down menu (do not click Apply)
  2. Click Read
  3. RDP returns to AA?

Yes it does!! and when trying apply its reverted back to AA as well

I am trying with Wio-E5 mini and Grove-Wio-E5, but I don’t have the Wio-E5 Development Kit, so I don’t have any more information.
If you can post some screenshots(e.g. the Registors tab), I can compare my programmer.

Pardon me, what does the registors tab mean or where can it be found?

Click Help for detailed documentation.
I was curious about 2.2.4.

Hi Karl, using your cloned st-vlink2 debugger try connecting with mode: under reset and hold reset before connect, then right after clicking connect release the reset button. Missing of timing will not connect your stlink with stm32cubeprogrammer in under reset mode. Because using the cloned stvlink2 debugger in normal mode it did not get connected, no matter what, but it wasn’t the case when I tried with my onboard debugger in Nucleo 446RE where it got connected, and even data read was successful but couldn’t load my hex file onto the flash.