cancel
Showing results for 
Search instead for 
Did you mean: 

Write OTP lock bytes using ST-LINK/V2

YWilk.1
Associate II

Hi,

i try to write the OTP area lock bytes using the ST-LINK/V2 programmer with the ST STM_Programmer_CLI tool included in the STM32CubeProgrammer software package.

I can successfully write to the OTP area blocks using the -w32 command but if i try to also write the according Lock byte it will fail with the following error message:

Command: STM32_Programmer_CLI.exe -c port=SWD -w32 0x1FFF7AC 0xFFFFFF00

Error: Failed to download data!If it's a Flash memory, it may be not erased or protected

Any idea why the write fails for the Lock bytes while OTP blocks are successfully written ?

1 ACCEPTED SOLUTION

Accepted Solutions

I can confirm CubeProgrammer v2.11.0 has finally bug fixed this (writing to OTP lock area for device ID 0x413).

Regards,

Peter

View solution in original post

17 REPLIES 17
Houda GHABRI
ST Employee

Hi @YWilk.1​ ,

Can you please tell me the MCU and CubeProgrammer version are you using ?

Houda

YWilk.1
Associate II

Hi @Houda GHABRI​ 

I use the STM32F407ZG MCU.

The CubeProgrammer version is v2.5.0

Best

Yannic

Houda GHABRI
ST Employee

Hi @YWilk.1​,

For STM32F407ZG MCU the correct address of last lock block is 0x1FFF 7A0C not 0x1FFF 7AC as mentioned in your command Line.

Can you please test with this adress and tell me if it works ?

Houda.

YWilk.1
Associate II

Hi @Houda GHABRI​ 

I think it was just a copy paste error while writing the question.

I repeated the test with the correct address 0x1FFF 7A0C and the result is the same as last time.

I have attached two screenshots.

The first one shows the write of 0x00000000 to lock block 0x1FFF 7A0C using the ST Link CLI programmer:

0693W000006GuVuQAK.pngThe second one shows the readout of the flash memory address 0x1FFF 7A0C after the failed write attempt:

0693W000006GuVzQAK.png 

Best

Yannic

GBouc.1
Associate

Hi @YWilk.1​ ,

I am having the same issue: I can write the OTP area, but I get that same error when it comes to write the LOCK bytes. Did you find a way to get it to work?

Best regards,

Guillaume

GBouc.1
Associate

For the record, I found out that it works OK with STM32 ST-LINK Utility / ST-LINK_CLI.exe.

Houda GHABRI
ST Employee

Hi @GBouc.1​ ,@YWilk.1​ ,

Thanks for bringing this issue to our attention.

The point is raised internally to CubeProgrammer development team and will be fixed as soon as possible.

Hope this can helps you.

Houda

STM32CubeProgrammer v2.8.0 (and patch 2.8.1) has still this problem. Where to look to know this problem is solved?

I can confirm STM32 ST-LINK CLI v3.6.0.0 works correct (as GBouc.1 noted) - on an STM32F407.

Regards, Peter

Any chance this will be solved in the near future?

Regards, Peter