cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect option bytes setting has blocked FLASH, how to unlock FLASH

PawelM
Associate III

HI all,

I tried change option bytes for STM32WB55 in code, and probably something went wrong when I did this. After programming MCU I found that my flash was probably be blocked:

0693W000001qBkIQAU.jpg

How can I unblock FLASH? I tried change security config options in STM32CubeProgrammer, used CLI, used DFU mode but It didn not help. In all the time I have error:

STM32_Programmer_CLI -c port=swd -ob SFSA=0xcb
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.4.0
      -------------------------------------------------------------------
 
ST-LINK SN  : 066FFF393738425043065240
ST-LINK FW  : V2J35M26
Voltage     : 3.27V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x495
Device name : STM32WB55xx
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M0+/M4
 
 
UPLOADING OPTION BYTES DATA ...
 
  Bank          : 0x00
  Address       : 0x58004020
  Size          : 104 Bytes
 
██████████████████████████████████████████████████ 100%
 
 
PROGRAMMING OPTION BYTES AREA ...
 
  Bank          : 0x00
  Address       : 0x58004020
  Size          : 104 Bytes
 
██████████████████████████████████████████████████ 100%
 
Reconnecting...
Reconnected !
 
 
UPLOADING OPTION BYTES DATA ...
 
  Bank          : 0x00
  Address       : 0x58004020
  Size          : 104 Bytes
 
██████████████████████████████████████████████████ 100%
 
OPTION BYTE PROGRAMMING VERIFICATION:
 
Error: Expected value for Option Byte "sfsa": 0xCB, found: 0x0
Error: Option Byte Programming failed

Greetings

1 ACCEPTED SOLUTION

Accepted Solutions
Remi QUINTIN
ST Employee

Can you still access the option byte ad dtry to set the watchdog option back to its original value.

Then try

  1. STM32_Programmer_CLI -c port=swd -w32 0x5800040c 0x00008000

The SFSA value should revert to 0xF4 with all the user memory erased of any previous FW.

View solution in original post

14 REPLIES 14
Remi QUINTIN
ST Employee

SFSA cannot be modified by the application being a code running on the M4 core or a command sent from the CubeProgrammer tool.

This is a secure option byte. Any trial to modify it triggers a safeguard action blocking all accesses to the flash memory and protecting the complete flash area by setting the SFSA option byte to 0.

The only way to recover (if and only if the FUS version the chip is V1.1.0) is to write the value 0x00008000 (instead of 0) at the address 0x5800040c. This will reset the device to its manufactory state: A clear flash memory.

Remi QUINTIN
ST Employee

Trying to modify any of the secure option byte will end with the same result: a completely protected flash memory.

PawelM
Associate III

Thanks for answer

I treied change this bit after flash was blocked, before I didnot change any security/protect bit.

My MCU has FUS version the chip is V1.2.0 - how clearig flash memory in this wersion ?

STM32_Programmer_CLI -c port=swd -w32 0x5800040c 0x00008000

Remi QUINTIN
ST Employee

Unfortunately, this does not work with V1.0.2. V1.1.0 was released to support this roll back to the manufactory state.

I am afraid there is no way to unblock your board.

PawelM
Associate III

"Unfortunately, this does not work with V1.0.2."

I have FUS in V1.2.0, in this versiuon it is support ?

Remi QUINTIN
ST Employee

FUS V1.2.0 does not exist. The most recent FUS version is the V1.1.0.

PawelM
Associate III

Oh my mistake. I have folder STM32Cube_FW_WB_V1.2.0, You are right there is version v1.0.2 :(

Remi QUINTIN
ST Employee

I am afraid there is no way to unblock your board. You may try to load FUS V1.1.0 but it is not expected to be possible.

PawelM
Associate III

In code I tried change OPTR register (change watchdog function) and after that it happened :\ I checked all bits in this register and I don't know which bit can block flash