cancel
Showing results for 
Search instead for 
Did you mean: 

How to use STM32CubeProgrammer to program OTP data

Jzhua
Associate III

I see that the MAC address of the Ethernet is stored in the OTP memory, how to program the OTP data, and whether there are relevant instructions. Is there an editing tool for OTP data?

9 REPLIES 9
Olivier GALLIEN
ST Employee

Hi @Jzhua​ 

A small procedure has been recently documented here :

https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer#How_to_fuse_STM32MP15x_OTP

Let us know if it's answer your need.

BR,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Jzhua
Associate III

I tried to program OTP, and the chip can no longer boot, the serial port displays these contents

PANIC at PC : 0x2fff5c6b

Exception mode=0x00000016 at: 0xfffffffc

USB boot can connect to the computer, but can not flash any firmware.

Is the chip dead ?

Can it still be saved ?

Olivier GALLIEN
ST Employee

​Hi @Jzhua​ 

Please could you precise which OTP you tried to program ?

Thx

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Jzhua
Associate III

i run this cmd to program the otp

STM32_Programmer_CLI -c port=usb1 -otp program wordID=0x39 value=0x42e18000

STM32_Programmer_CLI not successful, it stuck, I'm forced to shut down the program,That's it

Jzhua
Associate III

Today I found that the mpu cannot be booted with a trusted image, but it can be booted with a basic image

Olivier GALLIEN
ST Employee

​Hi @Jzhua​ 

This confirm you proceed to forbiden change of MAC address on ST board.

You may have miss the warning banner :

MAC address / board Id OTP write should not be performed on ST boards ! They are written and protected by ECC during factory production. Any further write will break the board with no way to recover if these OTP are not locked

This OTP can no more be recovered, but you can still work with the board either using non secure boot as you mention in your last post, or by removing mac reference in &bsec node of the TF-A DTS.

Hope it help,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

​As a complement.

Once  remove bsec mac_address node, the board is boot normally with the right mac address

- the mac address was stored in u-boot env:

 STM32MP> env print ethaddr

 ethaddr=00:80:e1:42:45:20

- So if you reflash your board, you will need to reinitialse the mac address:

 STM32MP> env set ethaddr 00:80:e1:42:45:20

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Jzhua
Associate III

I am using a custom board, not an ST board. Does this mean that I cannot set a MAC address?

How do I set the MAC address by programming OTP during mass production,or do you have other suggestions

Hi @Jzhua​ 

Sorry to miss you last comment.

Indeed MAC address can be set on STM32MP1 sample not previously programmed. That might be the case for the one on you custom board.

Do you finally succeed ?

Thanks

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.