8.2.5.1 Software ICSP Enable
Once the Programming and Debugging Interface Disable (PDID) feature has been activated
(ICSPDIS = 0
), the device can never be
reprogrammed again using a physical programmer or debug tool through the ICSP programming
interface.
The ICSP interface can temporarily be re-enabled in a limited capacity by bootloader code stored in the device boot block that programs the correct unlock sequence to the ICSPLOCK register and then sets the EN bit of the ICSPEN register. Refer to Unlock Sequence in C for more information about the unlock sequence required to correctly set the EN bit of ICSPEN. Following this sequence of events and temporarily re-enabling the ICSP interface allows for limited Failure Analysis capabilities in devices that have had the PDID feature enabled, including the ability to perform ICSP read commands. Writing to Program Flash Memory, performing bulk erase or page erases commands, and reprogramming the device using the ICSP interface will still not be possible.
To ensure the highest level of security when using the PDID feature, the code protection setting should be enabled using the respective Configuration bits. When code protection is enabled, external reads over the ICSP interface will no longer be possible, regardless of the ICSPEN register.
The contents of the ICSPLOCK and ICSPEN registers will reset on a POR event, meaning that upon power-up these bits will be cleared and the ICSP interface will be disabled until re-activated by the bootloader.
Unlock Sequence in C
ICSPLOCK = 0x55; ICSPLOCK = 0xAA; ICSPENbits.EN = 1;