cancel
Showing results for 
Search instead for 
Did you mean: 

How to program OTP on STM32MP1

Dat Tran
Senior II

I followed ST wiki, success to display OTP by the command:

STM32_Programmer_CLI.exe --connect port=usb1 -otp displ

Then I try to test writing a value to wordid 79 which currently is 0x00000000, and free for user.

STM32_Programmer_CLI -c port=usb1 -otp program wordID=0x4F value=0x12345678

No thing wrong, command return sucess:

0693W00000QMIZ2QAP.png 

I display cmd again, it is till 0x00000000, even reset the board.

0693W00000QMIYYQA5.png Any one know what I am missing, please?

1 ACCEPTED SOLUTION

Accepted Solutions
OlivierK
ST Employee

Nothing wrong on my side on windows 10

  79   |   0x00000000 | 0x00000000

 C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin> .\STM32_Programmer_CLI.exe -c port=usb1 -otp write word=79 value=0x12345678

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.11.0-B02

   -------------------------------------------------------------------

USB speed  : High Speed (480MBit/s)

Manuf. ID  : STMicroelectronics

Product ID : USB download gadget@Device ID /0x500, @Revision ID /0x2001, @Name /STM32MP157FAC Rev.Z,

SN     : 0034002A3438511836383238

DFU protocol: 1.1

Board    : --

Device ID  : 0x0500

Device name : STM32MP157FAC Rev.Z

Device type : MPU

Revision ID : --

Device CPU : Cortex-A7

UPLOADING OTP STRUCTURE ...

 Partition   : 0xF2

 Size     : 1024 Bytes

Uploading OTP data:

██████████████████████████████████████████████████ 100%

OTP Partition read successfully

OTP Write command:

You are trying to write on OTP partition with the following inputs :

--------------------------

 Word   | Value

--------------------------

 79    | 0x12345678

 Lock   | NO

--------------------------

Warning: This operation cannot be reverted and may brick your device.

Warning: Do you confirm ? [yes/no]

yes

The operation was confirmed...

WRITING TO OTP PARTITION ...

 Partition   : 0xF2

 Size     : 1024 Bytes

Downloading OTP data:

██████████████████████████████████████████████████ 100%

Uploading OTP data:

██████████████████████████████████████████████████ 100%

OTP Partition read successfully

OTP words programming done successfully

PS C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin> .\STM32_Programmer_CLI.exe -c port=usb1 -otp displ

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.11.0-B02

   -------------------------------------------------------------------

USB speed  : High Speed (480MBit/s)

Manuf. ID  : STMicroelectronics

Product ID : USB download gadget@Device ID /0x500, @Revision ID /0x2001, @Name /STM32MP157FAC Rev.Z,

SN     : 0034002A3438511836383238

DFU protocol: 1.1

Board    : --

Device ID  : 0x0500

Device name : STM32MP157FAC Rev.Z

Device type : MPU

Revision ID : --

Device CPU : Cortex-A7

UPLOADING OTP STRUCTURE ...

 Partition   : 0xF2

 Size     : 1024 Bytes

Uploading OTP data:

██████████████████████████████████████████████████ 100%

OTP Partition read successfully

OTP DATA WORDS :

Struct_version      :

             | none    : 0x00000002

BSEC_OTP_CONFIG     :

             |_ State      : Secure Open

             |_ Hardware Key Set : N

             |_ Encrypted data  : N

OTP REGISTERS:

---------------------------------------------------------------------------

  ID   |    value  |   status

---------------------------------------------------------------------------

...

  79   |   0x12345678 | 0x00000000

...

View solution in original post

12 REPLIES 12
OlivierK
ST Employee

Hi Dat Tran (Community Member)

https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_OTP_management#Examples_with_STM32Programmer

Do you use OpenSTLinux DV4.0.1 (header v2)?

With a minimal flashlayout + otp displ, it should work to write and readback OTPs, ex for a MP157 DK2 board.

./STM32_Programmer_CLI -c port=usb1 -w FlashLayout_stm32mp157c-dk2.tsv

./STM32_Programmer_CLI -c port=usb1 -otp displ

Dat Tran
Senior II

Hi @OlivierK​ 

I follow steps from here:

0693W00000QMNfPQAX.png 

The SDK I downloaded just last week.

The board is STM32MP157F-DK2 - Discovery kit with STM32MP157F MPU - STMicroelectronics

Dat Tran
Senior II

And I ran STM32CubeProgrammer on win10, does it make any different?

OlivierK
ST Employee

Hi Dat Tran (Community Member)

Then you choose a TSV for MP157F-DK2 (not MP157C-DK2).

CubeProgrammer should work fine on both Win10 and Linux.

SDK should match your DV package you've downloaded (DV3.1 or DV4.01), but that's irrelevant here.

Dat Tran
Senior II

Hi @OlivierK​ 

Hi, the screenshot I capture from wiki that why it is MP157C.

I ran on my PC it was MP157F-DK2 already. I just installed everything from last week. Should are they up to date?

Note here is, all messages are returned sucesful, no error as you see on my first post. Just value at id 79th is not updated. I selected 79 because I see all lock value is zero, that make me think is it OK to read or write.

Is 0x12345678 has any special bit that prevent to update the word id 79th ?

OlivierK
ST Employee

Sorry, no I don't see anything wrong. I will double check

Dat Tran
Senior II

@OlivierK​ 

I tried the command line as your suggest, instead of GUI application, then I got this error, hopefully you will see something wrong in my side.

0693W00000QMNwzQAH.png

OlivierK
ST Employee

Nothing wrong on my side on windows 10

  79   |   0x00000000 | 0x00000000

 C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin> .\STM32_Programmer_CLI.exe -c port=usb1 -otp write word=79 value=0x12345678

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.11.0-B02

   -------------------------------------------------------------------

USB speed  : High Speed (480MBit/s)

Manuf. ID  : STMicroelectronics

Product ID : USB download gadget@Device ID /0x500, @Revision ID /0x2001, @Name /STM32MP157FAC Rev.Z,

SN     : 0034002A3438511836383238

DFU protocol: 1.1

Board    : --

Device ID  : 0x0500

Device name : STM32MP157FAC Rev.Z

Device type : MPU

Revision ID : --

Device CPU : Cortex-A7

UPLOADING OTP STRUCTURE ...

 Partition   : 0xF2

 Size     : 1024 Bytes

Uploading OTP data:

██████████████████████████████████████████████████ 100%

OTP Partition read successfully

OTP Write command:

You are trying to write on OTP partition with the following inputs :

--------------------------

 Word   | Value

--------------------------

 79    | 0x12345678

 Lock   | NO

--------------------------

Warning: This operation cannot be reverted and may brick your device.

Warning: Do you confirm ? [yes/no]

yes

The operation was confirmed...

WRITING TO OTP PARTITION ...

 Partition   : 0xF2

 Size     : 1024 Bytes

Downloading OTP data:

██████████████████████████████████████████████████ 100%

Uploading OTP data:

██████████████████████████████████████████████████ 100%

OTP Partition read successfully

OTP words programming done successfully

PS C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin> .\STM32_Programmer_CLI.exe -c port=usb1 -otp displ

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.11.0-B02

   -------------------------------------------------------------------

USB speed  : High Speed (480MBit/s)

Manuf. ID  : STMicroelectronics

Product ID : USB download gadget@Device ID /0x500, @Revision ID /0x2001, @Name /STM32MP157FAC Rev.Z,

SN     : 0034002A3438511836383238

DFU protocol: 1.1

Board    : --

Device ID  : 0x0500

Device name : STM32MP157FAC Rev.Z

Device type : MPU

Revision ID : --

Device CPU : Cortex-A7

UPLOADING OTP STRUCTURE ...

 Partition   : 0xF2

 Size     : 1024 Bytes

Uploading OTP data:

██████████████████████████████████████████████████ 100%

OTP Partition read successfully

OTP DATA WORDS :

Struct_version      :

             | none    : 0x00000002

BSEC_OTP_CONFIG     :

             |_ State      : Secure Open

             |_ Hardware Key Set : N

             |_ Encrypted data  : N

OTP REGISTERS:

---------------------------------------------------------------------------

  ID   |    value  |   status

---------------------------------------------------------------------------

...

  79   |   0x12345678 | 0x00000000

...

Dat Tran
Senior II

Hi @OlivierK

I got it working. From your answer, I found the problems on my side.

The latest STM32CubePro I installed last week is v2.11.0 and located on "C:\Program Files"

The earlier version 2.5 located on "C:\Program Files (86)".

Default system point me to 2.5. I uninstalled 2.5 and point to 2.11 and now working and output same as yours

Second is, seem "word=79" works, but "wordID=79" doesn't work, (says no error).

what is different word and wordID?

Anyway, got it working, thank you so much!