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

    Dat TranAuthor
    Visitor II
    July 28, 2022

    Hi @OlivierK​ 

    Sorry for bother you one more time, because we have only one board for testing so I have to very careful to program OTP or the board dead and it will delay our project.

    • when use display cmd, there are value and status column as picture, what is the register that show the status, please?

    I read BSEC_OTP_STATUS, BSEC_OTP_DISTURBED, BSEC_OTP_ERROR but I am not sure how they become 0x30000000 as picture below.

    0693W00000QMOXHQA5.png 

    • When I tried first time 0x12345678 then work. Second time I tried 0x12345670, word 79 become invalid, do you know why and how to clear the error?

    0693W00000QMOYoQAP.pngThank you for your help!

    Technical Moderator
    July 28, 2022

    Hi Dat Tran (Community Member)

    The upper OTPs have ECC, so as you can only write "1" to OTP words it is likely that the ECC value will not match if you write again to the same OTP word. so you will get an error.

    For the OTP status, this page will answer your questions

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

    For more on the subject, the product reference Manuel will help (BSEC section)

    3.3.5 OTP words status

    • BSEC_OTP_DISTURBEDx registers (x = 0...2) provide the disturbed status for each

    OTP word. Any bit set to 1 means that the last reading of the corresponding word has

    been disturbed. Abnormal reading conditions in circuitry decoding and voltages reading

    have been detected.

    • BSEC_OTP_ERRORx registers (x = 0...2) provide error status for each OTP word.

    Any bit set to 1 means that the last read operation of the word concerned revealed a

    redundancy or ECC check error.

    • BSEC_OTP_WRLOCKEDx registers (x = 0...2) provide a permanent write lock

    status for each OTP word. Any bit set to 1 means that the corresponding word is

    permanently locked for writing.