Skip to main content
FBran.2
Associate
February 15, 2022
Solved

Are the erase commands in STM3CubeProgrammer broken? The transmitted commands on the UART do not match the requested functions

  • February 15, 2022
  • 5 replies
  • 2876 views

I currently implement my booloader (bases on the OpenBootloader) and test it against the STM32CubeProgrammer. I use v2.9.0 on Linux. Unfortunately when erasing sectors it does not send the expected command sequences. The behaviour is identical on CLI and GUI.

Two examples:

I want to erase sectors 15 to 18

Command line: ./STM32_Programmer.sh -c port=/dev/ttyUSB1 br=19200 -vb 3 -e 15 16 17 18

Output:

[...]

data sent successfully to target:  

0002000f001000110c

[...]

Sector 18 is missing in the list

Even worse, only wanting to erase one single sector

Command line: ./STM32_Programmer.sh -c port=/dev/ttyUSB1 br=19200 -vb 3 -e 42

Output:

[...]

data sent successfully to target: 0xffff00

[...]

0xffff is a full chip erase?!

Can someone tell me whats going wrong there? Do I miss something?

Addendum:

These errors only occur when conencted to the Bootloader with UART. With a direct swd connection everything works perfectly

This topic has been closed for replies.
Best answer by Houda GHABRI

Hi @FBran.2 ,

I confirm the mass erase is not well managed when connecting via UART.

This issue is already detected and fixed in next CubeProgrammer release which it will be published soon.

If it is an urgent matter I can send you a patch in private message but please note that it is not an official release .

Internal ticket number 120709 : (PS: This is an internal tracking number and is not accessible or usable by customers). 

Hope this helps you.

Houda

5 replies

TDK
Super User
February 15, 2022

Does the [start end] syntax work? Does it work if you add commas as in the example usage?

 -e, --erase : Erase memory pages/sectors devices:
 Not supported for STM32MP
 [all] : Erase all sectors
 [<sectorsCodes>] : Erase the specified sectors identified by sectors
 codes. ex: 0, 1, 2 to erase sectors 0, 1 and 2
 for EEPROM : ed1 & ed2
 [<[start end]>] : Erase the specified sectors starting from
 start code to end code, ex: -e [5 10]

"If you feel a post has answered your question, please click ""Accept as Solution""."
FBran.2
FBran.2Author
Associate
February 16, 2022

Thanks for the answer. When using commas I get a error from the Programmer:

Error: The erase command you trying to perform is missing some arguments. Please refer to the Help to see how to use it.

When using [42 45] the behaviour is identical, sector 45 is missing in the command sequence send to the STM.

When using the GUI the last checked sector is also missing. When checking just one sector and click on 'sector erase', the command for mass erase is send to the STM

TDK
Super User
February 16, 2022

It looks like the tool flat out doesn't work for what you want. Unfortunate. Seems like a parsing bug that they clearly never tested.

Unfortunately, it seems like using less commonly used features with ST tools is prone to issues across a number of different products.

"If you feel a post has answered your question, please click ""Accept as Solution""."
MFuch.3
Associate II
February 22, 2022

Damn, we ran into the same issue. Wanted to use STM32 cube programmer in CLI mode to erase/update single sectors.

SWD ist fine, but UART is not.

Hopefully this gets fixed soon!

Cheers M.

David Littell
Senior II
February 22, 2022

Yeah, but increasingly buggy tools are the spice of life, right? Oh, wait... :tired_face:

Houda GHABRI
Houda GHABRIBest answer
ST Employee
March 2, 2022

Hi @FBran.2 ,

I confirm the mass erase is not well managed when connecting via UART.

This issue is already detected and fixed in next CubeProgrammer release which it will be published soon.

If it is an urgent matter I can send you a patch in private message but please note that it is not an official release .

Internal ticket number 120709 : (PS: This is an internal tracking number and is not accessible or usable by customers). 

Hope this helps you.

Houda

FBran.2
FBran.2Author
Associate
March 3, 2022

Thanks for the reply. It is not really urgent, in the current dev stage we can live with our workarounds and will then test the new CubeProgrammer as soon as it is released.

Houda GHABRI
ST Employee
March 7, 2022

Hi @FBran.2​ ,

STM32CubeProgrammer 2.10.0 is released , you can download it from st.com and check again.

Houda

FBran.2
FBran.2Author
Associate
March 8, 2022

Hello Houda

I can confirm the bug is fixed in the new version and erase and mass erase is send to the device as expected

Thank you!