Skip to main content
PawelM
Associate II
June 7, 2020
Solved

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

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

This topic has been closed for replies.
Remi QUINTIN
Remi QUINTINBest answer
ST Technical Moderator
June 8, 2022

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.

14 replies

Remi QUINTIN
Remi QUINTINBest answer
ST Technical Moderator
June 8, 2022

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.

AWild.3
Visitor II
June 15, 2022

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!

Remi QUINTIN
ST Technical Moderator
June 8, 2022

Additional questions:

Is it your custom board or an ST board?

What is the FUS version installed on that board?