cancel
Showing results for 
Search instead for 
Did you mean: 

Error during flashing STM32WB5MMGH6U with cubeProgrammer.

zax
Associate II

Hi,
I tried to flash stm32wb5mm-dk board with cubeProgrammer with image of 900kB. I am getting error message " Sector Erase operation has failed at least for one of the specified existing sectors"

zax_0-1728661689906.png

These are my settings of memory protection:

zax_1-1728661757435.pngzax_2-1728661828640.png

When I try some options to apply I get this:

zax_3-1728661897234.png

I tried to change RDP level from 1 to 0 but nothing changed. I also tried with st-utilty but nothing again. 
In one moment I lost connection between MCU and ST-link(The interface firmware FAILED to reset/halt the target MCU) but I managed to fix it with connecting BOOT0 and VDD. After that I couldn't even read memory:

zax_4-1728662174140.png

This happens when I try mass erase:

zax_5-1728662206748.png

I tried with updating st-link firmware, different versions of cubeProgrammer and st-utilty, different cables, additional power supply but still nothing. 
These are some messages when I try to flash:

zax_6-1728662689291.pngzax_7-1728662700117.png

I am not even able to download image from cubeIDE anymore.
After all these attempts, I ordered one more DK, and I Immediately tried to flash board with cubeProgrammer but It failed again! I tried mass erase with that new board and it was successful, but again failed to flash image. In one moment durring trying to flash and settings changing I lost connection with MCU but this time BOOT0 and VDD doesn't help. Is there any chance to make it work again?
For both boards I for sure know that I didn't change RDP level to 3.
Only one thing has left, and that one is J-LINK and tag-connect connector (I don't have it still) ... 
I really can't believe that new boards can't be flashed.

 

IS THERE ANY CHANCE TO FIX THIS?

1 ACCEPTED SOLUTION

Accepted Solutions
Amine_Jridi
ST Employee

Hello @zax 

After investigation, the Errors when trying to flash the image are normal behavior since you are trying to use almost all of the memory, and in STM32WB5 not all the flash memory is accessible by the user, it contains both User application + FUS & Stack.

Amine_Jridi_0-1729084624538.png

To determine the limit of the flash memory available for your application, you can check the SFSA option byte, which refers to the start address of the installed stack, or by clicking the "Read All" (under read) using GUI.

For more information you can refer to the application note AN5185 & the reference manual RM0434.

 

Thanks,

Amine.

 

 


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.

View solution in original post

7 REPLIES 7
Amine_Jridi
ST Employee

Hello @zax,

Regarding the programming Issue, it appears to be related to sectors when flashing large images. I have raised this issue internally for resolution.

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

As for the option bytes error, I am unable to reproduce the issue. Are you trying to uncheck the PCROP_RDP OB?

 

Thanks,

Amine. 

 


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.
EXUE.2
ST Employee

it looks like onboard STlink MCU has some problem, if you can't changed onboard stlink MCU(STM32F103 or STM32F723) by new one, the only way is to use external debugger to connect by onboard tag-connect connector.

Hi,

With older version of stm32CubeProgrammer (2.10.0) I am able to set option bytes, but other problems are still present.

zax
Associate II

Hi,

I can't change onboard st-link because it's official development kit, but I will try with J-link debugger when I get tag-connect connector.

Thanks

Amine_Jridi
ST Employee

Hello @zax 

After investigation, the Errors when trying to flash the image are normal behavior since you are trying to use almost all of the memory, and in STM32WB5 not all the flash memory is accessible by the user, it contains both User application + FUS & Stack.

Amine_Jridi_0-1729084624538.png

To determine the limit of the flash memory available for your application, you can check the SFSA option byte, which refers to the start address of the installed stack, or by clicking the "Read All" (under read) using GUI.

For more information you can refer to the application note AN5185 & the reference manual RM0434.

 

Thanks,

Amine.

 

 


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.

Thanks for clarification.

When I try reading of sfsa it is set to 0x00.
Can you try to set SFSA byte to 0xE2 on your side. When I try, I get error: Option byte programming failed:

zax_0-1729092603683.png

Do I need to set some other option so this one can be set?
These are my default settings:

zax_1-1729092710710.png

 


Thanks.

 

Hello @zax 

If  SFSA=0x00 that means Safeboot has been triggered.Safeboot is triggered due to a corruption on the FUS operation or memory.The corruption might be on Flash memory or on the process.
On the process means FUS was interrupted by forced Reset or Power off.
On the memory means secure memory flash has been corrupted physically (it can be due to forced reset/power off during operations or due to CM4 interference on Flash while FUs is using it or due to other factors related to physical flash (flash failure, voltage instability...)). The Safeboot is triggered by HW. Safeboot mission is to fix the error if possible and perform a factory reset to the chip (erase any Wireless stack present, reset FUS state to default and reset Option bytes values to default). If the issue is related to flash ECC error (double ECC error) in the secure memory area, then Safeboot is not able to fix it and the chip is blocked forever (no recovery is possible).

Best Regards.

STTwo-32

 

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.