Skip to main content
Visitor II
July 27, 2022
Solved

How to program OTP on STM32MP1

  • July 27, 2022
  • 12 replies
  • 3184 views

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?

    This topic has been closed for replies.
    Best answer by OlivierK

    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

    ...

    12 replies

    Technical Moderator
    July 28, 2022

    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 TranAuthor
    Visitor II
    July 28, 2022

    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 TranAuthor
    Visitor II
    July 28, 2022

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

    Technical Moderator
    July 28, 2022

    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 TranAuthor
    Visitor II
    July 28, 2022

    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 ?

    Technical Moderator
    July 28, 2022

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

    Dat TranAuthor
    Visitor II
    July 28, 2022

    @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

    OlivierKAnswer
    Technical Moderator
    July 28, 2022

    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 TranAuthor
    Visitor II
    July 28, 2022

    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!

    Technical Moderator
    July 28, 2022

    Hi Dat Tran (Community Member)

    Good to hear that you are sorted out..

    Regarding the syntax I just followed the wiki. CubeProgrammer syntax sometimes change between version so it is important to align the wiki version to the DV version used. By default the wiki page points to the latest DV (which is here DV4.0.1)

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