Code Protection

Program memory code protection is controlled using the CP bit while data EEPROM memory code protection is controlled using the CPD bit. When code protection is enabled, all program memory and Data EEPROM locations read as ‘0’. Further programming is disabled for the program memory and Data EEPROM until a Bulk Erase operation is performed on the configuration memory region. Program memory and Data EEPROM can still be programmed and read during program execution.

The User ID locations and Configuration Bytes can be programmed and read out regardless of the code protection settings.

The only way to disable code protection is to use the Bulk Erase Program Memory command with bit 4 of the payload set to ‘1’. This will disable code protection and also erase all the memory locations.