9.4.1 Code-Protect

Code-protect is a device locking option that prevents external readout and modification of the user program. Code-protect is enabled with a Configuration bit, CP (FCP[0]), in the UCA configuration area. The effects of enabling Code-protect are described in Table 9-3.

Table 9-3. Effects of Code Protect
FeatureCode-Protect ONCode-Protect OFFNotes
DebuggingDisabledEnabled
UCA Write PermissionsDisabledAllowedUCA can be write-protected via the FCP.WPUCA config bit.
Program memory access in ICSP modeDisabledAllowedExecute, read and write permissions are disabled.
ECC error reporting in ICSP modeRestricted To prevent access to protected spaces using ECC error injection and reporting, ECC error reporting data is restricted to address only for user program in ICSP Programming mode when code-protect is enabled.
NVM Controller CRC accessDepends on FCP.CRC and Flash protection regionsDepends on Flash protection regionsIf code-protect is enabled with CRC allowed, the ICSP Programming mode may calculate the CRC over user program Flash pages.
Chip Erase
  • Program memory is erased.
  • OTP and IRT regions are not erased
  • Program memory is erased.
  • OTP and IRT regions are not erased.
  • Code-protect is disabled after chip erase.
  • Entire Flash OTP by ICSP Write Inhibit may be enabled to prevent external tools from performing a chip erase.
ICSP Programming ModeAllowedAllowed
  • External tools may erase and reprogram the part, depending on Entire Flash OTP by ICSP Write Inhibit settings.
  • This allows for a device to be reprogrammed without revealing the original user program or Flash contents.