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

14 REPLIES 14

hi

My MCU has FUS version the chip is V0.0.0,  how clearig flash memory in this wersion ?

AWild.3
Associate

Same thing. I tried to change watchdog option bytes and mcu somehow set SFSA as 0x0 and blocked the flash completely.:pouting_face:

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.

Remi QUINTIN
ST Employee

Additional questions:

Is it your custom board or an ST board?

What is the FUS version installed on that board?

Thank you for quick reply! Fortunatelly I had FUS v1.2.0, so this command helped me. However i didn't get how to use this command, because I never worked with cubeCLI, but I've read FUS manual again and found same instruction in Q&A and tried it in cubeprogrammer with GUI. So it worked. MCU has been unbricked. Thanks again!