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?

12 REPLIES 12
OlivierK
ST Employee

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

Dat Tran
Senior II

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!

OlivierK
ST Employee

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.