2022-12-11 09:30 AM
I have a board NUCLEO-WB55RG and STM32CubeProgrammer v2.12.0, I'm trying to write OTP area to address 0x1FFF7000, but I got errors.
I edit with GUI and I got error message: "Memory edition verification failed", with CLI I have this error:
./STM32_Programmer_CLI -c port=swd -w32 0x1FFF7000 0xAAAAAAAA
-------------------------------------------------------------------
STM32CubeProgrammer v2.12.0
-------------------------------------------------------------------
ST-LINK SN : 066BFF5XXXXXXXXXXXXXX
ST-LINK FW : V2J40M27
Board : NUCLEO-WB55RG
Voltage : 3.26V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x495
Revision ID : Rev X
Device name : STM32WB5x/35xx
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0xD5
Debug in Low Power mode enabled
Write 32-bit data
w @0x1fff7000: 0xaaaaaaaa
Downloading...
[==================================================] 100%
Error: Failed to download data! If it's a Flash memory, it may be not erased or protected
I also tried to update firmware of st-link but I got always the same errors.
2022-12-11 09:35 AM
Output with verbose log 3
./STM32_Programmer_CLI -c port=swd -vb 3 -w32 0x1FFF7000 0xAAAAAAAA
-------------------------------------------------------------------
STM32CubeProgrammer v2.12.0
-------------------------------------------------------------------
ST-LINK SN : 066BXXXXXXXXXXXXXXXXX
ST-LINK FW : V2J40M27
Board : NUCLEO-WB55RG
Voltage : 3.26V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x495
Revision ID : Rev X
flash loader /home/user/stm32cubeprg/bin/FlashLoader/0x495.stldr is loaded
r ap 0 @0xE0042008 0x00000004 bytes Data 0x00000000
w ap 0 @0xE0042008 0x00000004 bytes Data 0x00001800
r ap 0 @0xE0042004 0x00000004 bytes Data 0x00000007
w ap 0 @0xE0042004 0x00000004 bytes Data 0x00000007
Device name : STM32WB5x/35xx
Reading data...
r ap 0 @0x1FFF75E0 0x00000004 bytes Data 0xFFFF0400
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M4
r ap 0 @0x1FFF6FFE 0x00000004 bytes Data 0x135500D5
BL Version : 0xD5
Debug in Low Power mode enabled
Write 32-bit data
w @0x1fff7000: 0xaaaaaaaa
Downloading...
Buffer program...
halt ap 0
w ap 0 reg 15 PC (0x20000000)
w ap 0 reg 17 MSP (0x20000500)
w ap 0 reg 16 xPSR (0x01000000)
w ap 0 @0x20000C40 : 0x00000200 bytes, Data 0x00000000...
w ap 0 @0x20000000 : 0x00000004 bytes, Data 0x0000BE00...
w ap 0 @0x20000004 : 0x0000081C bytes, Data 0xB672B580...
Loader write range...
w ap 0 @0x20000C40 : 0x00000008 bytes, Data 0xAAAAAAAA...
W B1 in RAM @0x20000C40 size 0x00000008 : 0001ms
Init flashloader...
halt ap 0
w ap 0 reg 0 R0 0x00000001
w ap 0 reg 1 R1 0x00000000
w ap 0 reg 2 R2 0x00000000
w ap 0 reg 3 R3 0x00000000
w ap 0 reg 4 R4 0x00000000
w ap 0 reg 5 R5 0x00000000
w ap 0 reg 6 R6 0x00000000
w ap 0 reg 7 R7 0x00000000
w ap 0 reg 8 R8 0x00000000
w ap 0 reg 9 R9 0x00000000
w ap 0 reg 10 R10 0x00000000
w ap 0 reg 11 R11 0x00000000
w ap 0 reg 12 R12 0x00000000
w ap 0 reg 13 SP 0x00000000
w ap 0 reg 14 LR 0x20000001
w ap 0 reg 15 PC 0x20000005
w ap 0 reg 16 xPSR 0x01000000
w ap 0 reg 17 MSP 0x20000C1C
w ap 0 reg 18 PSP 0x00000000
run ap 0
halt ap 0
r ap 0 reg 0 R0 0x00000001
w ap 0 reg 0 R0 0x1FFF7000
w ap 0 reg 1 R1 0x00000008
w ap 0 reg 2 R2 0x20000C40
w ap 0 reg 3 R3 0x00000002
w ap 0 reg 4 R4 0x00000000
w ap 0 reg 5 R5 0x00000000
w ap 0 reg 6 R6 0x00000000
w ap 0 reg 7 R7 0x00000000
w ap 0 reg 8 R8 0x00000000
w ap 0 reg 9 R9 0x00000000
w ap 0 reg 10 R10 0x00000000
w ap 0 reg 11 R11 0x00000000
w ap 0 reg 12 R12 0x00000000
w ap 0 reg 13 SP 0x00000000
w ap 0 reg 14 LR 0x20000001
w ap 0 reg 15 PC 0x20000059
w ap 0 reg 16 xPSR 0x01000000
w ap 0 reg 17 MSP 0x20000C1C
w ap 0 reg 18 PSP 0x00000000
run ap 0
r ap 0 reg 0 R0 0x00000001
Write elapsed time: 0024ms
Reading data...
r ap 0 @0x1FFF7000 0x00000004 bytes Data 0xE1051355
Error: Failed to download data! If it's a Flash memory, it may be not erased or protected
2022-12-12 05:01 AM
Hello @juvann,
Thank you for posting ;),
From the verbose 3 log, it seems that the value of the first 4 bytes of OTP memory is 0xE1051355, you can verify this by reading the first 4 bytes starting from 0x1FFF7000 via STM32CubeProgrammer CLI or GUI.
If this is the case than this is expected, since OTP is by definition one-time programmable memory.
Also, when it comes to programming OTP area on an STM32WB55, I suggest programming 8 bytes at a time (-w64). The reason behind this is that if you set only one bit to 0, the entire double word (64 bits) cannot be written anymore. For further details, please refer to RM0434 page 76.
I hope you find this helpful.
Aziz
2022-12-12 09:58 AM
Hello Aziz BRIGUI,
I tested another address where is empty all 0xFFFFFFFF and I got always error:
./STM32_Programmer_CLI -c port=swd -w64 0x1FFF73F0 0x0000000000000000
-------------------------------------------------------------------
STM32CubeProgrammer v2.12.0
-------------------------------------------------------------------
ST-LINK SN : 066BXXXXXXXXXXXXXXX
ST-LINK FW : V2J40M27
Board : NUCLEO-WB55RG
Voltage : 3.26V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x495
Revision ID : Rev X
Device name : STM32WB5x/35xx
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0xD5
Debug in Low Power mode enabled
Downloading 64-bit data...
Error: Downloading 64-bit data failed...
If it's a Flash memory, it may be not erased or protected
-----------------------------------------------------------------------------------------
./STM32_Programmer_CLI -c port=swd -w32 0x1FFF73F0 0x00000000
-------------------------------------------------------------------
STM32CubeProgrammer v2.12.0
-------------------------------------------------------------------
ST-LINK SN : 066BXXXXXXXXXXXXXXXXXXXX
ST-LINK FW : V2J40M27
Board : NUCLEO-WB55RG
Voltage : 3.26V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x495
Revision ID : Rev X
Device name : STM32WB5x/35xx
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0xD5
Debug in Low Power mode enabled
Write 32-bit data
w @0x1fff73f0: 0x00000000
Downloading...
[==================================================] 100%
Error: Failed to download data! If it's a Flash memory, it may be not erased or protected
I tried also with --skipErase same errors.
My board NUCLEO-WB55RG is new, bought from mouser a week ago, why the first 64 bit are already programmed? Is it correct? If yes I don't like it. I'd like flash my board as I like it.
2022-12-15 12:06 AM
Hello @juvann,
Below is the verbose 3 log of the CLI command you mentioned :
C:\Users\briguiah>STM32_Programmer_CLI -c port=swd -w64 0x1FFF73F0 0x0000000000000000 -vb 3
-------------------------------------------------------------------
STM32CubeProgrammer v2.12.0
-------------------------------------------------------------------
ST-LINK SN : 066CFF555755846687084249
ST-LINK FW : V2J37M26
Board : NUCLEO-WB55RG
Voltage : 3.27V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x495
Revision ID : Rev Y
flash loader C:/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer 2.12.0/bin/FlashLoader/0x495.stldr is loaded
r ap 0 @0xE0042008 0x00000004 bytes Data 0x00000000
w ap 0 @0xE0042008 0x00000004 bytes Data 0x00001800
r ap 0 @0xE0042004 0x00000004 bytes Data 0x00000007
w ap 0 @0xE0042004 0x00000004 bytes Data 0x00000007
Device name : STM32WB5x/35xx
Reading data...
r ap 0 @0x1FFF75E0 0x00000004 bytes Data 0xFFFF0400
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M4
r ap 0 @0x1FFF6FFE 0x00000004 bytes Data 0x135500D5
BL Version : 0xD5
Debug in Low Power mode enabled
Downloading 64-bit data...
Buffer program...
halt ap 0
w ap 0 reg 15 PC (0x20000000)
w ap 0 reg 17 MSP (0x20000500)
w ap 0 reg 16 xPSR (0x01000000)
w ap 0 @0x20000C40 : 0x00000200 bytes, Data 0x00000000...
w ap 0 @0x20000000 : 0x00000004 bytes, Data 0x0000BE00...
w ap 0 @0x20000004 : 0x0000081C bytes, Data 0xB672B580...
Loader write range...
w ap 0 @0x20000C40 : 0x00000008 bytes, Data 0x00000000...
W B1 in RAM @0x20000C40 size 0x00000008 : 0001ms
Init flashloader...
halt ap 0
w ap 0 reg 0 R0 0x00000001
w ap 0 reg 1 R1 0x00000000
w ap 0 reg 2 R2 0x00000000
w ap 0 reg 3 R3 0x00000000
w ap 0 reg 4 R4 0x00000000
w ap 0 reg 5 R5 0x00000000
w ap 0 reg 6 R6 0x00000000
w ap 0 reg 7 R7 0x00000000
w ap 0 reg 8 R8 0x00000000
w ap 0 reg 9 R9 0x00000000
w ap 0 reg 10 R10 0x00000000
w ap 0 reg 11 R11 0x00000000
w ap 0 reg 12 R12 0x00000000
w ap 0 reg 13 SP 0x00000000
w ap 0 reg 14 LR 0x20000001
w ap 0 reg 15 PC 0x20000005
w ap 0 reg 16 xPSR 0x01000000
w ap 0 reg 17 MSP 0x20000C1C
w ap 0 reg 18 PSP 0x00000000
run ap 0
halt ap 0
r ap 0 reg 0 R0 0x00000001
w ap 0 reg 0 R0 0x1FFF73F0
w ap 0 reg 1 R1 0x00000008
w ap 0 reg 2 R2 0x20000C40
w ap 0 reg 3 R3 0x00000002
w ap 0 reg 4 R4 0x00000000
w ap 0 reg 5 R5 0x00000000
w ap 0 reg 6 R6 0x00000000
w ap 0 reg 7 R7 0x00000000
w ap 0 reg 8 R8 0x00000000
w ap 0 reg 9 R9 0x00000000
w ap 0 reg 10 R10 0x00000000
w ap 0 reg 11 R11 0x00000000
w ap 0 reg 12 R12 0x00000000
w ap 0 reg 13 SP 0x00000000
w ap 0 reg 14 LR 0x20000001
w ap 0 reg 15 PC 0x20000059
w ap 0 reg 16 xPSR 0x01000000
w ap 0 reg 17 MSP 0x20000C1C
w ap 0 reg 18 PSP 0x00000000
run ap 0
r ap 0 reg 0 R0 0x00000001
Write elapsed time: 0026ms
Reading data...
r ap 0 @0x1FFF73F0 0x00000008 bytes Data 0x00000000
Downloading 64-bit data done successfully
Disconnected
As you can see, the write is successful on my side. This has been tested on multiple NUCLEO-WB55RG boards, no fail has been detected.
I will keep trying to reproduce your issue and will get back to you if there's an update.
Aziz
2022-12-15 11:38 PM
Hello @juvann,
>> Why the first 64 bit are already programmed? Is it correct?
Yes this is correct and has to do with saving HSE clock tuning parameters (for calibration purposes). For further details, refer to AN5042.
Aziz