2020-05-10 08:38 AM
When I tried to do it in STM32CubeProgrammer I receive the next error:
18:37:09 : OPTION BYTE PROGRAMMING VERIFICATION:
18:37:09 : Error: Expected value for Option Byte "SPRMOD": 0x0, found: 0x1
18:37:09 : Error: Option Byte Programming failed
Solved! Go to Solution.
2020-05-10 09:52 AM
From the reference manual:
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.
So set RDP level 1, then set RDP level 0 and clear SPRMOD at the same time.
2020-05-10 09:52 AM
From the reference manual:
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.
So set RDP level 1, then set RDP level 0 and clear SPRMOD at the same time.
2020-05-10 08:46 PM
Thanks for your reply but result is the same I can not set RDP equal to 1 and SPRMOD=0. Here is detailed log:
06:43:07:929 : Option byte command : -ob RDP=187 SPRMOD=0
06:43:07:935 : PROGRAMMING OPTION BYTES AREA ...
06:43:07:948 : Reading data...
06:43:07:948 : r ap 0 @0x40023C14 0x00000004 bytes
06:43:07:949 : Reading data...
06:43:07:951 : r ap 0 @0x40023C14 0x00000004 bytes
06:43:07:951 : Database: Config 1 is active.
06:43:07:951 : Bank : 0x00
06:43:07:951 : Address : 0x40023c14
06:43:07:951 : Size : 4 Bytes
06:43:07:951 : OB buffer: ��?��������5
06:43:07:951 : Buffer program...
06:43:07:998 : halt ap 0
06:43:07:998 : w ap 0 reg 15 PC (0x20000000)
06:43:08:000 : w ap 0 reg 17 MSP (0x20000500)
06:43:08:000 : w ap 0 reg 16 xPSR (0x01000000)
06:43:08:003 : w ap 0 @0x20000C00 0x00000200 bytes
06:43:08:003 : w ap 0 @0x20000000 0x00000004 bytes
06:43:08:017 : w ap 0 @0x20000004 0x000007DC bytes
06:43:08:017 : w ap 0 @0x20000C00 0x00000004 bytes
06:43:08:017 : Loader write option bytes...
06:43:08:018 : Init flashloader...
06:43:08:018 : halt ap 0
06:43:08:019 : w ap 0 reg 0 R0 0x00000001
06:43:08:020 : w ap 0 reg 1 R1 0x00000000
06:43:08:020 : w ap 0 reg 2 R2 0x00000000
06:43:08:020 : w ap 0 reg 3 R3 0x00000000
06:43:08:020 : w ap 0 reg 4 R4 0x00000000
06:43:08:020 : w ap 0 reg 5 R5 0x00000000
06:43:08:020 : w ap 0 reg 6 R6 0x00000000
06:43:08:021 : w ap 0 reg 7 R7 0x00000000
06:43:08:021 : w ap 0 reg 8 R8 0x00000000
06:43:08:025 : w ap 0 reg 9 R9 0x00000000
06:43:08:026 : w ap 0 reg 10 R10 0x00000000
06:43:08:026 : w ap 0 reg 11 R11 0x00000000
06:43:08:026 : w ap 0 reg 12 R12 0x00000000
06:43:08:028 : w ap 0 reg 13 SP 0x00000000
06:43:08:028 : w ap 0 reg 14 LR 0x20000001
06:43:08:028 : w ap 0 reg 15 PC 0x20000005
06:43:08:028 : w ap 0 reg 16 xPSR 0x01000000
06:43:08:028 : w ap 0 reg 17 MSP 0x20000BDC
06:43:08:029 : w ap 0 reg 18 PSP 0x00000000
06:43:08:029 : run ap 0
06:43:08:029 : halt ap 0
06:43:08:029 : r ap 0 reg 0 R0 0x00000001
06:43:08:029 : w ap 0 reg 0 R0 0x40023C14
06:43:08:029 : w ap 0 reg 1 R1 0x00000004
06:43:08:030 : w ap 0 reg 2 R2 0x20000C00
06:43:08:030 : w ap 0 reg 3 R3 0x00000002
06:43:08:030 : w ap 0 reg 4 R4 0x00000000
06:43:08:030 : w ap 0 reg 5 R5 0x00000000
06:43:08:030 : w ap 0 reg 6 R6 0x00000000
06:43:08:032 : w ap 0 reg 7 R7 0x00000000
06:43:08:032 : w ap 0 reg 8 R8 0x00000000
06:43:08:033 : w ap 0 reg 9 R9 0x00000000
06:43:08:033 : w ap 0 reg 10 R10 0x00000000
06:43:08:034 : w ap 0 reg 11 R11 0x00000000
06:43:08:034 : w ap 0 reg 12 R12 0x00000000
06:43:08:038 : w ap 0 reg 13 SP 0x00000000
06:43:08:041 : w ap 0 reg 14 LR 0x20000001
06:43:08:045 : w ap 0 reg 15 PC 0x200000AB
06:43:08:045 : w ap 0 reg 16 xPSR 0x01000000
06:43:08:045 : w ap 0 reg 17 MSP 0x20000BDC
06:43:08:047 : w ap 0 reg 18 PSP 0x00000000
06:43:08:048 : run ap 0
06:43:08:050 : UPLOADING OPTION BYTES DATA ...
06:43:08:050 : Bank : 0x00
06:43:08:050 : Address : 0x40023c14
06:43:08:050 : Size : 4 Bytes
06:43:08:050 : Reading data...
06:43:08:050 : r ap 0 @0x40023C14 0x00000004 bytes
06:43:08:051 : OPTION BYTE PROGRAMMING VERIFICATION:
06:43:08:051 : Error: Expected value for Option Byte "RDP": 0xBB, found: 0xAA
06:43:08:057 : Error: Expected value for Option Byte "SPRMOD": 0x0, found: 0x1
06:43:08:064 : Error: Option Byte Programming failed
06:43:08:069 : Reading data...
06:43:08:069 : r ap 0 @0x40023C14 0x00000004 bytes
06:43:08:069 : Reading data...
06:43:08:069 : r ap 0 @0x40023C14 0x00000004 bytes
06:43:08:069 : Database: Config 1 is active.
06:43:08:210 : UPLOADING OPTION BYTES DATA ...
06:43:08:211 : Bank : 0x00
06:43:08:211 : Address : 0x40023c14
06:43:08:211 : Size : 4 Bytes
06:43:08:211 : Reading data...
06:43:08:211 : r ap 0 @0x40023C14 0x00000004 bytes
Errors look as it looks before:
06:43:08:051 : OPTION BYTE PROGRAMMING VERIFICATION:
06:43:08:051 : Error: Expected value for Option Byte "RDP": 0xBB, found: 0xAA
06:43:08:057 : Error: Expected value for Option Byte "SPRMOD": 0x0, found: 0x1
06:43:08:064 : Error: Option Byte Programming failed
2020-05-10 09:44 PM
Looks like it help. I should do steps separately:
Thanks a lot