cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the OTP bits?

Ronte.1
Associate II

I have a custom STM32MP157c board. I try to set fuse bits (3 0x23000000). It worked on the basic boot system but not on the TF-A boot system.

I mean by example the boot command : fuse prog 0 3 0x23000000.

7 REPLIES 7
OlivierK
ST Employee

Hi Ronte.1 (Community Member)

Fuse cmd only works at U-boot stage, basic boot refers to U-boot SPL.

When TF-A is used as the First Stage Boot loader it needs U-boot as SSBL, as recommended for product development, then fuse command will work.

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

https://wiki.st.com/stm32mpu/wiki/U-Boot_overview#U-Boot_overview

https://wiki.st.com/stm32mpu/wiki/How_to_update_OTP_with_U-Boot

Regards,

Olivier

Ronte.1
Associate II

I have the recommended setup for TF-A. Fuse command works indeed, with read and sense, but the prog command fails.

Regards,

Raimo

OlivierK
ST Employee

Is the OTP lock bit set? Did you reboot?

otherwise I tried on my board:

at U-boot prompt, for ex write in OTP57:MAC address "12:34:56:78:9a:bc"

STM32MP> fuse sense 0 0x10000039 2                                                 

Sensing bank 0:                                                           

                                                                  

Word 0x10000039: 00000000 00000000 

STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a                                          

Programming bank 0 word 0x00000039 to 0x78563412...                                         

Programming bank 0 word 0x0000003a to 0x0000bc9a...                                         

STM32MP> fuse sense 0 57 2                                                     

Sensing bank 0:                                                           

                                                                  

Word 0x00000039: 78563412 0000bc9a       

reboot...

STM32MP> env print ethaddr                                                     

ethaddr=12:34:56:78:9a:bc   

STM32MP> fuse prog 0 3 0x23000000                                                  

Programming bank 0 word 0x00000003 to 0x23000000...                                         

Warning: Programming fuses is an irreversible operation!                                      

     This may brick your system.                                                

     Use this command only if you are sure of what you are doing!                                

                                                                  

Really perform this fuse programming? <y/N>  

Regards,

Olivier

  

Yes, it goes just like in your log but when I answer "y" in the last "Really perform this fuse programming?" the programming procedure fails.

Regards,

Raimo

What is OTP lock bit ?

Regards Raimo

OlivierK
ST Employee

Hi Ronte.1  (Community Member)

This is used to permanently write lock one OTP word and therefore once the lock is set the OTP word is no more programmable, specially designed for upper OTPs that are word accessed and builtin with ECC, so when one upper OTP word is written, it should be write lock protected to prevent any further writes on the same OTP word.

Regards

Olivier

Ronte.1
Associate II

So I'm trying to set OTP bank 0 word 3 to 0x23000000 to set the boot order of the device.

The programming command fails as described above. The error follows:

stm32_smc: Failed to exec svc=82001003 op=2 in secure mode (err = -2)

ERROR

Is there some way to make it work ?

Regards Raimo