cancel
Showing results for 
Search instead for 
Did you mean: 

[BUG] STM32WLE4C STM32CubeProgrammer_CLI problem with set "Write Protection" flags

ami
Associate

Processor STM32WLE4C

The latest STM32CubeProgrammer_CLI is not working, and it's not setting:
WRP1A_STRT
WRP1A_END
WRP1B_STRT
WRP1B_END

It looks like an error.


The sequence of steps to reproduce the issue.

1) In the microcontroller's memory, I have code that has read and write protection enabled.

~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI -c port=SWD mode=UR -ob displ
-------------------------------------------------------------------
STM32CubeProgrammer v2.15.0
-------------------------------------------------------------------

ST-LINK SN : 56FF6C067870545131410967
ST-LINK FW : V2J29S7
Board : --
Voltage : 3.13V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x497
Revision ID : Rev Y
Device name : STM32WLxx
Flash size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0xC4


UPLOADING OPTION BYTES DATA ...

Bank : 0x00
Address : 0x58004020
Size : 96 Bytes

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

Bank : 0x01
Address : 0x58004080
Size : 8 Bytes

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


OPTION BYTES BANK: 0

Read Out Protection:

RDP : 0xBB (or any value other than 0xAA and 0xCC: Level 1, read protection)

BOR Level:

BOR_LEV : 0x0 (BOR Level 0 reset level threshold is around 1.7 V)

User Configuration:

nBOOT0 : 0x1 (nBOOT0=1)
nBOOT1 : 0x1 ()
nSWBOOT0 : 0x1 (BOOT0 taken from PH3/BOOT0 pin)
SRAM_RST : 0x1 (SRAM1 and SRAM2 are not erased when a system reset occurs)
SRAM2_PE : 0x1 (SRAM2 parity check disable)
nRST_STOP : 0x1 (No reset generated when entering the Stop mode)
nRST_STDBY : 0x1 (No reset generated when entering the Standby mode)
nRST_SHDW : 0x1 (No reset generated when entering the Shutdown mode)
WWDG_SW : 0x1 (Software window watchdog)
IWGD_STDBY : 0x1 (Independent watchdog counter running in Standby mode)
IWDG_STOP : 0x1 (Independent watchdog counter running in Stop mode)
IWDG_SW : 0x1 (Software independent watchdog)
BOOT_LOCK : 0x0 (CPU1 CM4 Boot lock disabled)

Security Configuration Option bytes ESE:

ESE : 0x0 (Security disabled)

PCROP Protection:

PCROP1A_STRT : 0xFF (0x803FC00)
PCROP1A_END : 0x0 (0x8000000)
PCROP_RDP : 0x0 (PCROP zone is kept when RDP is decreased)
PCROP1B_STRT : 0xFF (0x803FC00)
PCROP1B_END : 0x0 (0x8000000)

Write Protection:

WRP1A_STRT : 0x0 (0x8000000)
WRP1A_END : 0x1E (0x800F000)
WRP1B_STRT : 0x2 (0x8001000)
WRP1B_END : 0x1 (0x8000800)

 

2) I am trying to set the flags using STM32_Programmer_CLI from the command line:


/home/user/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI -c port=SWD mode=UR -rdu -hardRst -ob RDP=0xAA BOR_LEV=0x0 nBOOT0=0x1 nBOOT1=0x1 nSWBOOT0=0x1 SRAM_RST=0x1 SRAM2_PE=0x1 nRST_STOP=0x1 nRST_STDBY=0x1 nRST_SHDW=0x1 WWDG_SW=0x1 IWGD_STDBY=0x1 IWDG_STOP=0x1 IWDG_SW=0x1 BOOT_LOCK=0x0 ESE=0x0 PCROP1A_STRT=0xFF PCROP1A_END=0x0 PCROP_RDP=0x1 PCROP1B_STRT=0xFF PCROP1B_END=0x0 WRP1A_STRT=0x3 WRP1A_END=0x1 WRP1B_STRT=0x3 WRP1B_END=0x1
-------------------------------------------------------------------
STM32CubeProgrammer v2.15.0
-------------------------------------------------------------------

ST-LINK SN : 56FF6C067870545131410967
ST-LINK FW : V2J29S7
Board : --
Voltage : 3.13V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x497
Revision ID : Rev Y
Device name : STM32WLxx
Flash size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0xC4


Disabling memory Read Protection...
Warning: Option Byte: rdp, value: 0xAA, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
Time elapsed during option Bytes configuration: 00:00:00.001

Memory Read Protection disabled successfully

Hard reset is performed

UPLOADING OPTION BYTES DATA ...

Bank : 0x00
Address : 0x58004020
Size : 96 Bytes

 

Bank : 0x01
Address : 0x58004080
Size : 8 Bytes

 


PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: boot_lock, value: 0x0, was not modified.
Warning: Option Byte: bor_lev, value: 0x0, was not modified.
Warning: Option Byte: ese, value: 0x0, was not modified.
Warning: Option Byte: pcrop1a_end, value: 0x0, was not modified.
Warning: Option Byte: pcrop1b_end, value: 0x0, was not modified.

Bank : 0x00
Address : 0x58004020
Size : 96 Bytes


Error: Downloading Option Bytes Data failed

Time elapsed during option Bytes configuration: 00:00:00.003


Program display error :(

3) I am reading the processor flags again.

$ ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI -c port=SWD mode=UR -ob displ
-------------------------------------------------------------------
STM32CubeProgrammer v2.15.0
-------------------------------------------------------------------

ST-LINK SN : 56FF6C067870545131410967
ST-LINK FW : V2J29S7
Board : --
Voltage : 3.13V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x497
Revision ID : Rev Y
Device name : STM32WLxx
Flash size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0xC4


UPLOADING OPTION BYTES DATA ...

Bank : 0x00
Address : 0x58004020
Size : 96 Bytes

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

Bank : 0x01
Address : 0x58004080
Size : 8 Bytes

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


OPTION BYTES BANK: 0

Read Out Protection:

RDP : 0xAA (Level 0, no protection)

BOR Level:

BOR_LEV : 0x0 (BOR Level 0 reset level threshold is around 1.7 V)

User Configuration:

nBOOT0 : 0x1 (nBOOT0=1)
nBOOT1 : 0x1 ()
nSWBOOT0 : 0x1 (BOOT0 taken from PH3/BOOT0 pin)
SRAM_RST : 0x1 (SRAM1 and SRAM2 are not erased when a system reset occurs)
SRAM2_PE : 0x1 (SRAM2 parity check disable)
nRST_STOP : 0x1 (No reset generated when entering the Stop mode)
nRST_STDBY : 0x1 (No reset generated when entering the Standby mode)
nRST_SHDW : 0x1 (No reset generated when entering the Shutdown mode)
WWDG_SW : 0x1 (Software window watchdog)
IWGD_STDBY : 0x1 (Independent watchdog counter running in Standby mode)
IWDG_STOP : 0x1 (Independent watchdog counter running in Stop mode)
IWDG_SW : 0x1 (Software independent watchdog)
BOOT_LOCK : 0x0 (CPU1 CM4 Boot lock disabled)

Security Configuration Option bytes ESE:

ESE : 0x0 (Security disabled)

PCROP Protection:

PCROP1A_STRT : 0xFF (0x803FC00)
PCROP1A_END : 0x0 (0x8000000)
PCROP_RDP : 0x0 (PCROP zone is kept when RDP is decreased)
PCROP1B_STRT : 0xFF (0x803FC00)
PCROP1B_END : 0x0 (0x8000000)

Write Protection:

WRP1A_STRT : 0x0 (0x8000000)
WRP1A_END : 0x1E (0x800F000)
WRP1B_STRT : 0x2 (0x8001000)
WRP1B_END : 0x1 (0x8000800)


The "Write Protection" flags have not been changed.
What am I doing wrong?

1 REPLY 1
Aziz BRIGUI
ST Employee

Hello @ami,

I apologize for the late reply, could you please try reproducing with CubeProgrammer v2.16 ? Is this a CLI only behavior or are you able to reproduce with CubeProgrammer GUI ?

To check if this is related to programming multiple option bytes at a time or is specific to WRP option bytes, could you share a trace where you only change the WRP values ?

Thanks in advance,

Aziz


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.