cancel
Showing results for 
Search instead for 
Did you mean: 

Option Byte Programming failed upon trying to modify option bytes

breynard
Associate II

Hello! I'm new to STM32 hardware, and I'm having some difficulties getting it running on my Black Pill board with an STM32F411CEU6. It has both Read and Write Protection enabled, and I am trying to disable them using STM32CubeProgrammer through an STLINK V2. However, upon trying change option bytes, it gives me a weird error.

For attempting to change read protection from value 0xFF to 0xAA it gives me this:

16:24:25:038 : Error: Expected value for Option Byte "RDP": 0xAA, found: 0xFF
16:24:25:044 : Error: Option Byte Programming failed Or modified by application after OB_LAUNCH

 

And similar story for trying to change the write protection values from true to false for all flash sectors:

  16:26:41:386 : Error: Expected value for Option Byte "WRP0": 0x0, found: 0x1
  16:26:41:391 : Error: Expected value for Option Byte "WRP1": 0x0, found: 0x1
  16:26:41:395 : Error: Expected value for Option Byte "WRP2": 0x0, found: 0x1
  16:26:41:399 : Error: Expected value for Option Byte "WRP3": 0x0, found: 0x1
  16:26:41:408 : Error: Expected value for Option Byte "WRP4": 0x0, found: 0x1
  16:26:41:416 : Error: Expected value for Option Byte "WRP5": 0x0, found: 0x1
  16:26:41:428 : Error: Expected value for Option Byte "WRP6": 0x0, found: 0x1
  16:26:41:436 : Error: Expected value for Option Byte "WRP7": 0x0, found: 0x1
  16:26:41:441 : Error: Option Byte Programming failed Or modified by application after OB_LAUNCH

I am on Linux, and the software recognizes the MCU type and ID, so I believe the connection is good. Any help would be appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
breynard
Associate II

Hello everyone,

I ended up ordering two Nucleo L432KC boards and one new Black Pill board from Digikey. Given that Digikey's quality standards are higher than Amazon's, I figured it was a safe bet to order another one.

I've had a chance to mess around with the new Black Pill and one of the Nucleo boards and they're both working perfectly with my old programmer (or a USB cable in the case of the Nucleo board). I don't believe the old Black Pill had a counterfeit chip, but it does seem to be bricked somehow.

Thank you to @Issamos and @MikaelM for your help! I suppose the moral of the story is to order electronics off of a reputable seller rather than some random person on Amazon. I believe I will mark this as the solution, unless others have something to add.

Many thanks,

breynard

View solution in original post

18 REPLIES 18
Issamos
Lead II

Hello @breynard 

This problem depends on different conditions (level of read protection,Proprietary code readout protection,...) that's why I suggest you to take a look at the parts 3.6.5, 3.6.4 et 3.6.3 of the RM0383. That will give you all details you need to now. I'm suspecting that the read protection is in level 2 and that's going to be impossible to change. 

Best regards.

II

Thank you for the prompt reply. I don't think it's in level 2 read protection, as the value reads 0xFF, not 0xCC. I remember seeing somewhere that anything but 0xAA and 0xCC is level 1 protection. Also, I don't think that will affect the ability to write to option bytes, but I could be mistaken. PCROP is enabled, and upon trying to disable it, I get the same error.

  17:40:06 : Error: Expected value for Option Byte "SPRMOD": 0x0, found: 0x1
  17:40:06 : Error: Option Byte Programming failed Or modified by application after OB_LAUNCH

You know far more than I do though, and if it is truly unrecoverable (either on part of the MCU or the STLINK), I can still return either or both of them.

Than, this post may be helpful for you.

Best regards.

II

MikaelM
ST Employee

hello @breynard ,

as suggested, you could read reference manual RM0383.
You will find page 57/844 :
"The deactivation of the SPRMOD and/or the unprotection of PCROPed user sectors can
only occur when, at the same time, the RDP level changes from 1 to 0. If this condition is not
respected, the user option byte modification is cancelled and the write error WRPERR flag
is set. The modification of the users option bytes (BOR_LEV, RST_STDBY, ..) is allowed
since none of the active nWRPi bits is reset and SPRMOD is kept active."

Best regards

Mikael

If you feel a post has answered your question, please click Accept as Solution.

Hello @MikaelM 

I interpret that to mean that I can only change protection option bytes at the same time I change RDP from Level 1 (which I think it is at right now with value FF) to Level 0. Upon changing this, the same error as before manifested itself:

  22:47:38 : Error: Expected value for Option Byte "RDP": 0xAA, found: 0xFF
  22:47:38 : Error: Expected value for Option Byte "SPRMOD": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP0": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP1": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP2": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP3": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP4": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP5": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP6": 0x0, found: 0x1
  22:47:38 : Error: Expected value for Option Byte "WRP7": 0x0, found: 0x1
  22:47:38 : Error: Option Byte Programming failed Or modified by application after OB_LAUNCH

Am I misinterpreting, or is my device bricked? Thank you so much for your time, both of you!

hello @breynard 

could you just connect, dump option bytes and send me the log file caontaining all option bytes values ?

thanks

Mikael

If you feel a post has answered your question, please click Accept as Solution.

Hello @MikaelM,

Here is the dump:

 

 

      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.14.0                  
      -------------------------------------------------------------------

ST-LINK SN  : B55B5A1A0000000053E8EE01
ST-LINK FW  : V2J39S7
Board       : --
Voltage     : 3.27V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x431
Revision ID : Rev A
Device name : STM32F411xC/E
Flash size  : 512 KBytes (default)
Device type : MCU
Device CPU  : Cortex-M4
BL Version  : 0x0


UPLOADING OPTION BYTES DATA ...

  Bank          : 0x00
  Address       : 0x40023c14
  Size          : 8 Bytes

[==================================================] 100% 



OPTION BYTES BANK: 0

   Read Out Protection:

     RDP          : 0xFF (Level 1, read protection of memories) 

   PCROP Protection:

     SPRMOD       : 0x1 (PCROP enabled. nWPRi bits used for PCROP protection on sector i) 

   BOR Level:

     BOR_LEV      : 0x3 (BOR  OFF    reset threshold level from 1.80 to 2.10 V) 

   User Configuration:

     WDG_SW       : 0x1 (Software watchdog) 
     nRST_STOP    : 0x1 (No reset generated) 
     nRST_STDBY   : 0x1 (No reset generated) 

   Write Protection:

     WRP0         : 0x1 (PCROP protection active on sector i) 
     WRP1         : 0x1 (PCROP protection active on sector i) 
     WRP2         : 0x1 (PCROP protection active on sector i) 
     WRP3         : 0x1 (PCROP protection active on sector i) 
     WRP4         : 0x1 (PCROP protection active on sector i) 
     WRP5         : 0x1 (PCROP protection active on sector i) 
     WRP6         : 0x1 (PCROP protection active on sector i) 
     WRP7         : 0x1 (PCROP protection active on sector i) 

 

 

- breynard

 

Hello, @breynard ,

thank you. I will come back to you as soon as possible on this subject.

Best regards

Mikael

If you feel a post has answered your question, please click Accept as Solution.

Hi @MikaelM,

Thank you for your continued aid in this topic! If there are any issues with the hardware, I can return and buy a new board.

Best regards,

breynard