cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in CLI v2.21.0 using -w commands

blast3r
Associate II

Hi all,

I've searched for similar post but solutions provided did not work for my case.

For compatibility reasons I needed to upgrade from ST-Link to Cube programmer CLI but I've encountered roadblocks while using the -w commands with the Cube CLI.

If I write directly with the CubeProgrammer UI, no issue at all, but if i try using CLI below error pops-up:

 

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=SWD mode=UR -w8 0x08080000 0x02 -v -hardRst
-------------------------------------------------------------------
STM32CubeProgrammer v2.21.0
-------------------------------------------------------------------

ST-LINK SN : 54FF6C066685495431141687
ST-LINK FW : V2J46S7
Board : --
Voltage : 2.71V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x482
Revision ID : Rev X
Device name : STM32U575/STM32U585
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M33
BL Version : 0x92
Debug in Low Power mode enabled


Downloading 8-bit data...

██████████████████████████████████████████████████Error:
Downloading 8-bit data failed...
If it's a Flash memory, it may be not erased or protected

Some details about:

  • If I try to write the same data that is already stored, it works (maybe cause it verifies and succeed for this reason - eventhought the "Downloading 8-bit data done successfully" string appears)
  • already tried -w32 an -w64 option with no success but same behaviour as per previous point

 

Thanks all for your help and support with this.

 

Regards

G

 

5 REPLIES 5
Kouthair
ST Employee

Hello Blast3r and welcome to the community!


According to UM2237, downloading using -w<8,16,32> requires the flash memory to be erased since it doesn't erase it in order to write.

STM32CubeProgrammer GUI does it for you automatically when you edit.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
blast3r
Associate II

Hi @Kouthair, thanks for your fast reply.

I've double check  the documentation and saw the note about this. I need to say sorry  but I thought the principle was like the previous CLI, where there was no need to erase prior sending -w8/16/32 commands.

The problem at this point is that the sector in question contains data from a previous process and cannot be lost.
What approach do you recommend?

From the documentation I see that dump command, as per privious CLI, is not more available.

 

Thanks for your help.

 

Regards

G.

Kouthair
ST Employee

Hello again @blast3r,


At the moment there is not a way to do this, the STM32CubeProgrammer GUI version also does this: It has to erase the entire sector and program the updated content.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Pavel A.
Super User

@blast3r Note that not only the target memory should be erased: different STM32 MCUs have different limitations on programming of the internal flash. For example on some STM32 you can only write in multiples of 32 bytes, aligned on 32 bytes. The details are in the Data sheet (DS) or Reference Manual (RM) for your model.

Well, I guess I need to use the --read command, store the entire sector into a separate file, erase it and then --download the file after manipulated it with the bites to be updated...

Not so user-friendly unfortunateely, but to date is the only option I assume.

I whish I could return to the V2 CLI  blast3r_0-1770981029315.png