5.1 OTP Emulation Mode
The OTP Emulation mode can be used to test boot configuration options, including the Secure Boot mode, without permanently programming the real OTP memory. When the OTPC is switched into this mode, the internal SRAM1 memory is used instead of the real OTP memory to store packets. In this scenario, the size of the OTP user area is limited to 4 Kbytes of data.
OTPC can be switched to Emulation mode using SAM-BA® tools.
To switch to OTPC Emulation mode:
- Set the Emulation mode enable bit in
the BSCR register. At reset, the ROM code will check this bit and switch OTPC to
Emulation mode if set. Out of reset, OTPC starts in Real
mode.
sam-ba --device sam9x60:0:1 –a bootconfig –c writecfg:bscr:EMULATION_ENABLED - Clear the internal SRAM1 content and
fill it with zeros. As part of the reset or refresh command, OTPC scans the OTP
memory (real or emulated, depending on the previous selection). If an error is
found, OTPC stops scanning and reports the error. The ROM code checks for errors
reported by OTPC and locks the device if any are
found.
sam-ba --device sam9x60:0:1 –a bootconfig –c resetemul - Force an OTPC refresh, so OTPC will
scan the memory and load the boot configuration and secure configuration packet, if
any:
sam-ba --device sam9x60:0:1 -a bootconfig -c refreshcfg:emulor
sam-ba --device sam9x60:0:1 -bootconfig -c refreshotp
Warning: During every power-off/power-on cycle, all data
written to the internal SRAM1 as part of the OTP user area in Emulation mode is lost.
Ensure that the internal SRAM1 is not used for other purposes if OTPC is switched to
Emulation mode.
