Skip to main content
YWilk.1
Associate
December 13, 2020
Solved

Write OTP lock bytes using ST-LINK/V2

  • December 13, 2020
  • 11 replies
  • 5580 views

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 ?

This topic has been closed for replies.
Best answer by PZuid.1

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

Regards,

Peter

11 replies

Houda GHABRI
ST Employee
December 24, 2020

Hi @YWilk.1​ ,

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

Houda

YWilk.1
YWilk.1Author
Associate
December 24, 2020

Hi @Houda GHABRI​ 

I use the STM32F407ZG MCU.

The CubeProgrammer version is v2.5.0

Best

Yannic

Houda GHABRI
ST Employee
December 24, 2020

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
YWilk.1Author
Associate
December 26, 2020

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
Visitor II
June 1, 2021

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
Visitor II
June 1, 2021

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

Houda GHABRI
ST Employee
June 2, 2021

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

PZuid.1
Visitor II
September 13, 2021

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

PZuid.1
Visitor II
March 3, 2022

Any chance this will be solved in the near future?

Regards, Peter

Houda GHABRI
ST Employee
March 3, 2022

Hi @PZuid.1​ ,

this issue is fixed in last CubeProgrammer version 2.9.0, can you please try?

To be sure that the correct address is used , according to RM0401 Table12.OTP area organization, the lock byte address(for NucleoF410RB) is 0x1FFF 7A00 so the Command line should be :

STM32_Programmer_CLI.exe -c port=SWD -w32 0x1FFF7A00 0xFFFFFF00

Hope this helps you.

Houda

Internal ticket number: 108076 (PS: This is an internal tracking number and is not accessible or usable by customers).  

PZuid.1
Visitor II
March 4, 2022

I tested it, but it still doesn't work.

0693W00000KbQNPQA3.pngSTM32F407IG and ST-LINK V2. Verified by reading the lock bytes afterwards - nothing changed.

Kind regards,

Peter

Houda GHABRI
ST Employee
March 4, 2022

Hello @PZuid.1​ ,

Ok, I'll check again and come back with updates.

Houda

Houda GHABRI
ST Employee
March 6, 2022

Hello @PZuid.1​ ,

You are right ! the issue is fixed in 2.9.0 only for F4 0x458 device ID.

Issue still exist for 0x413 and will be fixed in future release.

Meanwhile I will send you the patch via private message.

Hope this helps you.

Houda

PZuid.1
Visitor II
March 7, 2022

I can confirm the lock bytes can now be written in the OTP area of the STM32F407IG (0x413).

Bugfix/change in STM32_Prog_DB_0x413.xml:

<Parameters address="0x1FFF7800" name=" 512 Bytes Data OTP" size="0x210"/>

Regards,

Peter

PZuid.1
Visitor II
March 15, 2022

This issue is still not fixed in STM32 CubeProgrammer v2.10.0 (tested the 64-bit version).

Quick fix is to change "Data_Base\STM32_Prog_DB_0x413.xml" manually. But for deployment within our company this is sub-optimal...