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

​Regarding the nSWboot0 remaining at 1, I am quite puzzled.

Could you download all the option bytes?

Do you use the CubeProgrammer tool in GUI mode or via the command line interface (CLI mode)?

Are setting the reset mode to Hardware reset?

I assume the HEX file is the application file already built for 0x08000000 as start address.

HSpre.1
Associate III

Hi there

Could you download all the option bytes? How do I check that?

Do you use the CubeProgrammer tool in GUI mode or via the command line interface (CLI mode)? I am using Cubeprogrammer in GUI mode.

I have Boot0 pulled LOW with 10k resistor.

I have only SWDIO / SWDclk and GND connected from a nucleo board.

I cannot program FUS or BLE stack.

Full chip erase also fails:

11:15:11 : Mass erase operation failed.Please verify flash protection

HSpre.1
Associate III

When i set verbosity level to 3 i can see option bytes:

11:23:25:530 : UPLOADING OPTION BYTES DATA ...

11:23:25:530 : Bank : 0x00

11:23:25:531 : Address : 0x58004020

11:23:25:531 : Size : 104 Bytes

11:23:25:531 : Reading data...

11:23:25:531 : r ap 0 @0x58004020 0x00000068 bytes Data 0x000000AA

Remi QUINTIN
ST Employee

​For the option bytes, send a screen shot of the CubeProgrammer tool once in the OB section.

> have only SWDIO / SWDclk and GND connected from a nucleo board. => I your board a Nucleo board or yur own custom board? I dont understand this sentence.

Mass erase fails because it encounters the memory blocks protected by the SFSA limit. But all blocks under SFSA location should be correclty erased.

HSpre.1
Associate III

Hi I am using my own board. I have produced 18 boards.

I am connected to this board using a nucleo as programmer (nucleo-f072RB). I am only connecting SWDIO / SWDclk and GND from the nucleo board to my stm32wb55 board. the STM32WB55 board is powered with a battery.

see below scren grab , not certain which part you want to see of option bytes?

0693W000004IvcOQAS.jpg

HSpre.1
Associate III

I just dropped my Frequency to 100khz ( from standard 4000) and then my programming worked. I am a bit stumped as to why communication can be this bad?

Remi QUINTIN
ST Employee

Few remarks

SFSA = 0xF6 means that the FUS version is still v0.5.3. So you should try to upgrade the FUS version to V1.0.2 and then to v1.1.0.

Regarding the frequency, a lower programming speed could increase the reliability of the write accesses. But I must admit that the 4000Khz frequency I am using to program the WB Nucleo board is working well with the USB interface; with the SWD too though with more error. I don’t know if there is a link with the programming frequency.

HSpre.1
Associate III

Thank for your inputs

one more question.

Is it an issue that i used PB4 as an COMP2_INP since this is shared with SYS_JTRST.

I have COMP2_INP connected to opamp output. which will pull it low on powerup but SYS_JTRST has pull-up?

Because 3 new boards in a row 4000khz is NO go and as soon as i set to 100khz it works.

FUS updates fine now. at 100khz.

I use the same nucleo-F072RB board with a special connector to program multiple other stm32l476 and stm32h750 cpus i have on other boards. only on my stm32wb55 board I struggle at 4000khz.

What is even more puzzling is some of the identical stm32wb55 boards works fine at 4000khz and i can debug etc on them using this programmer.

LucHardware
Associate III

Hi, I have the same problem. Must Boot0 be high or low? I also remove the IDE and install the latest version but when I want to programm or erase it gives:

Error: failed to erase memory

Encountered Error when opening /opt/st/stm32cubeide_1.6.1/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_1.6.0.202101291314/tools/bin/STM32_Programmer_CLI

Error in STM32CubeProgrammer

Debugger connection lost.

Shutting down...

Thanks for help a newby