cancel
Showing results for 
Search instead for 
Did you mean: 

Option Byte Programming failed

HSpre.1
Associate III

Good Day.

I have created a board and some program easily through SWD port and some struggle.

The error i am getting In STM32CubeProgrammer is:

---------------------------------------------

08:35:51:413 : Reconnected !

08:35:51:413 : Success with Time elapsed during Reconnect: 4314 ms

08:35:51:413 : UPLOADING OPTION BYTES DATA ...

08:35:51:414 : Bank : 0x00

08:35:51:414 : Address : 0x58004020

08:35:51:414 : Size : 104 Bytes

08:35:51:414 : Reading data...

08:35:51:414 : r ap 0 @0x58004020 0x00000068 bytes Data 0x000000AA

08:35:51:414 : OPTION BYTE PROGRAMMING VERIFICATION:

08:35:51:414 : Expected value for Option Byte "nSWboot0": 0x0, found: 0x1

08:35:51:414 : Option Byte Programming failed

08:35:51:415 : Failed to set nSWboot0=0 nboot1=1 nboot0=1

---------------------------------------------------------------------------------------------

I am trying to load

stm32wb5x_FUS_fw_1_0_2.bin

to start address 0x080EC000

on new stm32wb55RG

Even when trying to download a Hex file to program space 0x8000000

-----------------------

08:50:41:316 : Number of segments: 1

08:50:41:316 : segment[0]: address= 0x8000000, size= 0x8B3E

08:50:42:675 : Memory Programming ...

08:50:42:675 : Opening and parsing file: C-MX-WLB-AE-0013.hex

08:50:42:713 : File : C-MX-WLB-AE-0013.hex

08:50:42:714 : Size : 35646 Bytes

08:50:42:714 : Address : 0x08000000 

08:50:42:714 : Erasing Segment <0> Address <0x08000000> Size <35646>Bytes

08:50:42:714 : Erasing memory corresponding to segment 0:

08:50:42:714 : Memory erase...

08:50:42:717 : halt ap 0 

08:50:42:717 : w ap 0 reg 15 PC (0x20000000) 

08:50:42:717 : w ap 0 reg 17 MSP (0x20000500) 

08:50:42:718 : w ap 0 reg 16 xPSR (0x01000000) 

08:50:42:718 : w ap 0 @0x20001000 0x00000200 bytes Data 0x00000000

08:50:42:718 : w ap 0 @0x20000000 0x00000004 bytes Data 0x00000000

08:50:42:953 : w ap 0 @0x20000004 0x00000BC8 bytes Data 0xFFFFFF80

08:50:42:953 : Erasing internal memory sectors [0 8]

08:50:42:953 : Init flashloader...

08:50:42:953 : halt ap 0 

08:50:42:953 : w ap 0 reg 0 R0 0x00000001

08:50:42:953 : Loader sector erase...

08:50:42:954 : failed to erase memory

08:50:42:954 : failed to erase memory

---------------------------------------------------------------------------------------------------

17 REPLIES 17
Remi QUINTIN
ST Employee

Did you try with the CubeProgrammer tool alone? What is the version used? 2.6 or 2.7?

The option bytes nBOOT0 annd nBOOT1 should be set to 1.

When the nSWBOOT option byte is 0, the nBOOT0 is taken into consideration. If it is set to 0, then you have to set the PH3/BOOT0 pin to 1 as this pin is take into consideration in that case.

LucHardware
Associate III

The CubeProgrammer is 2.6.0.

I put nBoot0 to 1, there is no nBoot1 on STM32F767BI

11:27:07:841 : Loader mass erase...

 11:27:07:841 : w ap 0 reg 0 R0  0x00000002

 11:27:07:857 : w ap 0 reg 1 R1  0x00000000

 11:27:07:859 : w ap 0 reg 2 R2  0x00000000

 11:27:07:860 : w ap 0 reg 3 R3  0x00000000

 11:27:07:860 : w ap 0 reg 4 R4  0x00000000

 11:27:07:875 : w ap 0 reg 5 R5  0x00000000

 11:27:07:875 : w ap 0 reg 6 R6  0x00000000

 11:27:07:875 : w ap 0 reg 7 R7  0x00000000

 11:27:07:875 : w ap 0 reg 8 R8  0x00000000

 11:27:07:888 : w ap 0 reg 9 R9  0x00000000

 11:27:07:895 : w ap 0 reg 10 R10 0x00000000

 11:27:07:897 : w ap 0 reg 11 R11 0x00000000

 11:27:07:898 : w ap 0 reg 12 R12 0x00000000

 11:27:07:898 : w ap 0 reg 13 SP  0x00000000

 11:27:07:903 : w ap 0 reg 14 LR  0x20000001

 11:27:07:904 : w ap 0 reg 15 PC  0x2000026B

 11:27:07:904 : w ap 0 reg 16 xPSR 0x01000000

 11:27:07:905 : w ap 0 reg 17 MSP 0x200010D4

 11:27:07:907 : w ap 0 reg 18 PSP 0x00000000

 11:27:07:907 : run ap 0

 11:27:07:919 : halt ap 0

 11:27:07:925 : r ap 0 reg 0 R0  0x00000000

 11:27:07:925 : Error: Mass erase operation failed.Please verify flash protection

LucHardware
Associate III

The CubeIDE 1.6.1 gives me this error:

Error in final launch sequence:

Failed to execute MI command:

load /home/luc/ST_Dev/Clicker4_F767_Blinky/Debug/Clicker4_F767_Blinky.elf

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load /home/luc/ST_Dev/Clicker4_F767_Blinky/Debug/Clicker4_F767_Blinky.elf

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load /home/luc/ST_Dev/Clicker4_F767_Blinky/Debug/Clicker4_F767_Blinky.elf

Error message from debugger back end:

Error finishing flash operation

Error finishing flash operation

Just need to put me on tracks to be able program the chip

LucHardware
Associate III

The fresh install:  11:51:56 : STM32CubeProgrammer API v2.7.0 same error

HSpre.1
Associate III

Hi LucHardware

My problem is/was almost certainly linked to connector used on my product. I use an industrial circular connector. When I bypass circular connector by soldering programmer wires directly on pcb programming works much better and debugging works.

My solution is to simply set programming speed to 100khz and then I could program all my 270 production run.

4000khz simply cannot work on the industrial circular connector I used.

(pin5) PH3-BOOT0 is pulled low with 10k resistor on my pcb.

Remi QUINTIN
ST Employee

> put nBoot0 to 1, there is no nBoot1 on STM32F767BI

Sorry, I am supporting the WB. I won't be able to accurately answer you. regarding the F7. You should log your question on the F7 group.

Remi QUINTIN
ST Employee

Sorry, this is the WB group. I won’t be able to answer you accurately regarding the F7. You should log your post on the F7 group.

LucHardware
Associate III

OMG, problem solved,

Thanks HSpre.1 for this advice. The flat cable between ST-LINK and the board is only 8 cm long, but I have change the clock speed to 5 Khz. Maybe higher works also but for me it is fine after hours of trouble shooting. :)