6.3 Get Device Protection State

As described in Code Protection and Secured Device, if the device is code protected or a secured device or both, there is a limitation to programming and debugging functionality and accessing the memory.
  1. Read the DSUEXT.STATUB (@0x41000102) (DSU_STATUSB register).
  2. Check the PROT[bit 0] bit set for code protection enabled.
  3. Read the DSUEXT.SECCFG (@0x4100012C) (DSU_SECCFG register).
  4. Check for DEBUG_LCK [7:6] bits for a non-zero value if set for secured device.
Note: Similarly, some of the eFuse content as listed below are also mapped to DSU registers to be accessible when the device is a secured device. For more details on address mapping, refer to the DSU section in the PIC32CX-BZ3/PIC32CX-BZ36 and WBZ35x Module Family Data Sheet (DS70005541).
  • Unique identifier: 128 bits. Unique identifier of the device.
  • Secure configuration bits: 32 bits. All the security related configurations are a part of this register.
  • Roll back counter: 8 bits. Roll back counter associated with the current firmware image.
  • Boot status: 8 bits. This indicates the status of the previous boot. Firmware dictates the codes and their corresponding status message. An example can be value 8’hF0 may indicate authentication failure during the previous boot.
  • Life cycle counter: 5 bits. Current stage of the device in its life cycle.
  • Boot key: 384 bits. Public boot or OTA authentication key.
Table 6-2. Reference
Stepsmem_ap primitive

Read DSU STATUSB register

ReadD32(DSUEXT.STATUSB)
Read DSU SECCFG registerReadD32(DSUEXT.SECCFG)