8.2.4 Storage Area Flash (SAF) Lock Enable

The SAFLOCK Configuration bit allows for one-time programmability of the Storage Area Flash (SAF). This bit can only be enabled once. Once enabled, this bit cannot be disabled (even through a Bulk Erase operation) and locks the designated SAF area and the SAFSZ bits. When SAFSZ is enabled, the SAF locked area can only be increased in size by programming a SAFSZ bit to ‘0’. However, once programmed to ‘0’, either through ICSP or a self-write, the SAF locked area cannot be reduced in size since the bits can never be erased to a ‘1’, not even through a Bulk Erase. When SAFLOCK is enabled, the SAF area becomes write protected and an NVM write error is set during self-writes. Setting the SAFLOCK Configuration bit requires a specific unlock sequence that is described below, but is also covered in more detail in the Family Programming Specification document for the specific device.

CAUTION: Once SAFLOCK bit is enabled, it CANNOT be disabled. Bulk Erase and self-erase operations are not possible. Use extreme caution with the SAFLOCK bit.
Important:
  1. Setting the SAFLOCK Configuration bit through the ICSP interface requires the following sequence:
    1. Send Program Access Enable Command with appropriate payload. For more information on the Program Access Enable Command, refer to the PIC18-Q24 Family Programming Specification.
    2. Send Program Data Command to write to the SAFLOCK bit. For more information on the Program Data Command, refer to the PIC18-Q24 Family Programming Specification.