30.5.3.7.1 Writing a New Packet from the User Interface

To write a new packet from the User Interface, follow the steps below:

  1. Write OTPC_MR.NPCKT to ‘0’ if it is set at ‘1’.
  2. Write OTPC_MR.ADDR to its maximum value.
  3. Write a ‘1’ to OTPC_CR.READ and wait for the read completion (OTPC_ISR.EOR=‘1’ when the read is completed).
  4. Check there is no bit already set to ‘1’ in the OTPC_HR and OTPC_DR. The check for the data registers can be replaced by reading OTPC_SR.ONEF (if ONEF is set, at least one bit of the data registers is set to ‘1’).


    If the header or the payload of the packet already contains a 1, the new packet may need to be adapted.

  5. Write OTPC_MR.ADDR to ‘0’ and set NPCKT.


    Depending on the contents of the temporary registers, an automatic flush can be triggered. If an automatic flush is started, OTPC_SR.FLUSH is set and OTPC_ISR.EOF is raised at the completion of the flush. It is mandatory to wait for the end of the flush.

  6. Write the header value in OTPC_HR. The value of PACKET must not be the same as KEY.
  7. Set DADDR to ‘0’.
  8. Write the first data in the OTPC_DR register. To update the 32-bit data later (using the packet update), the OTPC_DR register must be set to 0.
  9. Increment the DADDR field and write the next data in the OTPC_DR. Repeat this operation until all the data has been written.


    Skip the increment of DADDR if INCRT is set to AFTER_WRITE.

  10. Write USER_KEY in the OTPC_CR.KEY field and ‘1’ to OTPC_CR.PGM.

Before the write operation in the OTP memory, the OTPC checks the consistency of the packet and that the packet does not overlap on any existing packet. In case of error, OTPC_ISR.WERR is set and the write operation is cancelled.

The end of the programming operation is indicated by OTPC_ISR.EOP=’1’ and/or OTPC_SR.PGM=’0’. At the end of the programming, the address of the header is available in OTPC_MR.ADDR and the OTPC_MR.NPCKT must be cleared.

The payload can be read back before programming. After read back, it is possible to update PACKET value to KEY before programming.

If the new written packet is the User Hardware Configuration special packet, its payload is ignored until the next reset or the next refresh. The OTPC_UHCxR registers will be updated after the reset or the refresh following programming.