If the device is unlocked, it is possible to write directly to the NVM Controller or the Flash
memory using the UPDI, which will lead to unpredictable code execution if the CPU is
active during the NVM programming. To avoid this, execute the following NVM programming
sequence:
- 1.Follow the chip erase procedure, as
described in the Chip Erase section. Skip this point if the part is already
unlocked.
- 2.Enter the NVMPROG key by using the
KEY
instruction. See Table 2 for the NVMPROG signature.
- 3.Optional: Read the NVM Programming Key Status (NVMPROG) bit from the ASI Key
Status (UPDI.KEY_STATUS) register to see if the key has been activated.
- 4.Write the signature to the Reset
Request (RSTREQ) bit in the ASI Reset Request (UPDI.ASI_RESET_REQ) register. This
will issue a System Reset.
- 5.Write
0x00
to the
ASI Reset Request (UPDI.ASI_RESET_REQ) register to clear the System Reset.
- 6.Read the NVM Programming Key Status
(NVMPROG) bit from the ASI System Status (UPDI.ASI_SYS_STATUS) register.
- 7.NVM programming can start when the
NVMPROG bit is ‘
1
’. If the NVMPROG bit is ‘0
’,
return to step 6.
- 8.Write data to NVM through the UPDI.
- 9.Write the signature to the Reset
Request (RSTREQ) bit in the ASI Reset Request (UPDI.ASI_RESET_REQ) register. This
will issue a System Reset.
- 10.Write
0x00
to the
ASI Reset Request (UPDI.ASI_RESET_REQ) register to clear the System Reset.
- 11.Programming is complete.