6.1.2 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.
- Read the DSUEXT.STATUB (@0x41000102) (DSU_STATUSB register).
- Check the PROT[bit 0] bit set for code protection enabled.
- Read the DSUEXT.SECCFG (@0x41000148) (DSU_SECCFG register).
- 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-BZ6 and
PIC32WM-BZ6 Family Data Sheet.
The programming flow for PFM and BFM varies based on DEBUG_LCK bit. For more details, refer the section “Flash Memory Programming”.
- 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’hF0may 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.
| Steps | mem_ap primitive |
|---|---|
Read DSU STATUSB register | ReadD32(DSUEXT.STATUSB) |
| Read DSU SECCFG register | ReadD32(DSUEXT.SECCFG) |
