cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer not clearing the Option Bytes on STM32H7B3i-DK. I can not load any code and stuck. Is it possible to clear these bytes with STM32CubeProgrammer and if so how?

onio
Senior

STM32CubeProgrammer not clearing the Option Bytes on STM32H7B3i-DK. I can not load any code.

Is it possible to clear these bytes with STM32CubeProgrammer and if so how? 

Below is the error that I am getting.

13:58:53 : Time elapsed during the read operation is: 00:00:00.002
13:59:39 : Option byte command : -ob PROT_AREA_START1=0xff DMEP1=0 DMEP2=0 PROT_AREA_START2=0xff SEC_AREA_START1=0xff DMES1=0 SEC_AREA_START2=0xff DMES2=0
13:59:39 : PROGRAMMING OPTION BYTES AREA ...
13:59:39 : Bank : 0x00
13:59:39 : Address : 0x5200201c
13:59:39 : Size : 308 Bytes
13:59:39 : UPLOADING OPTION BYTES DATA ...
13:59:39 : Bank : 0x00
13:59:39 : Address : 0x5200201c
13:59:39 : Size : 308 Bytes
13:59:39 : OPTION BYTE PROGRAMMING VERIFICATION:
13:59:39 : Error: Expected value for Option Byte "DMEP1": 0x0, found: 0x1
13:59:39 : Error: Expected value for Option Byte "DMEP2": 0x0, found: 0x1
13:59:39 : Error: Expected value for Option Byte "DMES1": 0x0, found: 0x1
13:59:39 : Error: Expected value for Option Byte "DMES2": 0x0, found: 0x1
13:59:39 : Error: Expected value for Option Byte "PROT_AREA_START1": 0xFF, found: 0x0
13:59:39 : Error: Expected value for Option Byte "PROT_AREA_START2": 0xFF, found: 0x0
13:59:39 : Error: Expected value for Option Byte "SEC_AREA_START1": 0xFF, found: 0x0
13:59:39 : Error: Expected value for Option Byte "SEC_AREA_START2": 0xFF, found: 0x0
13:59:39 : Error: Option Byte Programming failed
14:02:54 : Warning: Connection to device 0x480 is lost
14:02:54 : Disconnected from device.

2 REPLIES 2
TDK
Guru

Looks like the first time the option bytes are programmed, it works. And later attempts fail. Disconnect and re-connect to work around the issue.

This is with an STM32H7B3 eval board.

18:50:15 : ST-LINK SN : 005100433038511234333935
18:50:15 : ST-LINK FW : V3J5M2
18:50:15 : Voltage : 3.30V
18:50:15 : SWD freq : 24000 KHz
18:50:15 : Connect mode: Normal
18:50:15 : Reset mode : Software reset
18:50:15 : Device ID : 0x480
18:50:15 : UPLOADING OPTION BYTES DATA ...
18:50:15 : Bank : 0x00
18:50:15 : Address : 0x5200201c
18:50:15 : Size : 308 Bytes
18:50:15 : UPLOADING ...
18:50:15 : Size : 1024 Bytes
18:50:15 : Address : 0x8000000
18:50:15 : Read progress:
18:50:15 : Data read successfully
18:50:15 : Time elapsed during the read operation is: 00:00:00.001
18:50:19 : Option byte command : -ob PROT_AREA_START1=0xee
18:50:19 : PROGRAMMING OPTION BYTES AREA ...
18:50:19 : Bank : 0x00
18:50:19 : Address : 0x5200201c
18:50:19 : Size : 308 Bytes
18:50:19 : UPLOADING OPTION BYTES DATA ...
18:50:19 : Bank : 0x00
18:50:19 : Address : 0x5200201c
18:50:19 : Size : 308 Bytes
18:50:19 : OPTION BYTE PROGRAMMING VERIFICATION:
18:50:19 : Option Bytes successfully programmed
18:50:26 : Option byte command : -ob PROT_AREA_START1=0xff
18:50:26 : PROGRAMMING OPTION BYTES AREA ...
18:50:27 : Bank : 0x00
18:50:27 : Address : 0x5200201c
18:50:27 : Size : 308 Bytes
18:50:32 : UPLOADING OPTION BYTES DATA ...
18:50:32 : Bank : 0x00
18:50:32 : Address : 0x5200201c
18:50:32 : Size : 308 Bytes
18:50:32 : OPTION BYTE PROGRAMMING VERIFICATION:
18:50:32 : Error: Expected value for Option Byte "PROT_AREA_START1": 0xFF, found: 0xEE
18:50:32 : Error: Option Byte Programming failed
18:50:37 : Disconnected from device.

It then works after reconnecting.

18:50:45 : ST-LINK SN : 005100433038511234333935
18:50:45 : ST-LINK FW : V3J5M2
18:50:45 : Voltage : 3.30V
18:50:45 : SWD freq : 24000 KHz
18:50:45 : Connect mode: Normal
18:50:45 : Reset mode : Software reset
18:50:45 : Device ID : 0x480
18:50:45 : UPLOADING OPTION BYTES DATA ...
18:50:45 : Bank : 0x00
18:50:45 : Address : 0x5200201c
18:50:45 : Size : 308 Bytes
18:50:45 : UPLOADING ...
18:50:45 : Size : 1024 Bytes
18:50:45 : Address : 0x8000000
18:50:45 : Read progress:
18:50:45 : Data read successfully
18:50:45 : Time elapsed during the read operation is: 00:00:00.001
18:50:49 : Option byte command : -ob PROT_AREA_START1=0xff
18:50:49 : PROGRAMMING OPTION BYTES AREA ...
18:50:49 : Bank : 0x00
18:50:49 : Address : 0x5200201c
18:50:49 : Size : 308 Bytes
18:50:49 : UPLOADING OPTION BYTES DATA ...
18:50:49 : Bank : 0x00
18:50:49 : Address : 0x5200201c
18:50:49 : Size : 308 Bytes
18:50:49 : OPTION BYTE PROGRAMMING VERIFICATION:
18:50:49 : Option Bytes successfully programmed
18:50:52 : Option byte command : -ob PROT_AREA_START1=0xee
18:50:52 : PROGRAMMING OPTION BYTES AREA ...
18:50:52 : Bank : 0x00
18:50:52 : Address : 0x5200201c
18:50:52 : Size : 308 Bytes
18:50:58 : UPLOADING OPTION BYTES DATA ...
18:50:58 : Bank : 0x00
18:50:58 : Address : 0x5200201c
18:50:58 : Size : 308 Bytes
18:50:58 : OPTION BYTE PROGRAMMING VERIFICATION:
18:50:58 : Error: Expected value for Option Byte "PROT_AREA_START1": 0xEE, found: 0xFF
18:50:58 : Error: Option Byte Programming failed

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

TDK I have actually been using board for a couple of weeks now.

​I am running SBSFU (Secure Boot Secure Firmware Update) example program which automatically enable these protection when run the firmware. In other for me to continue developing I then use the STM32CubeProgrammer to disable the Option Bytes only this time has failed to work regardless what I do. Power cycle, connect/disconnect etc.