16.5.9 Usage of Boot ROM Interactive Mode

As mentioned earlier in this chapter, the Boot ROM entry to Interactive Mode (IMODE) may be voluntarily or involuntarily. Involuntary entry to IMODE signals that the Boot ROM experienced error and/or fault during the boot operation. On the other hand, voluntary entry to IMODE means users have connected a debugger to the device and request for IMODE.

Involuntary entry to IMODE – In this operating scenario, the user is required to connect a debugger to the device in order to make use of the supported IMODE commands.

Voluntary entry to IMODE – In this operating scenario, the user connected a debugger device and the device is ready to accept one of the supported Interactive Mode commands. Voluntary entry to IMODE is typically done during product development or debugging post-product released related issues.

Once the device is in IMODE, the following Interactive Mode commands are supported for the device. The user needs to use one of the supported programmer/debuggers to communicate with Boot ROM over Interactive Mode.

A Cold Plugging sequence is mandatory to enter the Interactive Mode. The device is designed to accept cold plugging requests from the SWD Host at any time during its operation.

The following debuggers support Interactive Modes:

Note: For additional information, contact a local Microchip sales team or contact www.microchip.com/support to obtain design information about Boot ROM Interactive Modes communication.
Table 16-2. IMODE Commands
Sr. NoIMODE Command NameIMODE Command Purpose
1CMD_IMODEDebugger requests the device to enter Interactive Mode (IMODE)
2CMD_EXITDebugger requests the device to reset and begin executing the first mutable executable code or device enters into Park Mode when the DSU_STATUSA.BREXT0 bit is set
3CMD_SDAL0Sets the Device Access Level (DAL) to 0(locked state)
4CMD_HOST_DALELEVElevates the Device Access Level to DAL 2(access as per BOOTCFG1/1A and ROMCFG fuse values)
5CMD_CE_ALLPerforms a full device erase, restoring factory default. Refer to table 12-3 to know more about factory default state.
6CMD_READCFMReads Configuration Fuse Memory (CFM) contents
7CMD_CRCPerforms CRC check on a specified memory region
Note:

IMODE commands 6 and 7 are considered advanced debugging features of the PIC32CM devices.

These commands are typically not required during standard product development and are not intended for post-production use. As such, support for these commands is optional in host debugger implementations.

To use these commands, the debugger must explicitly support the corresponding IMODE command protocol.

Once the user has connected one of the supported debuggers to the device, the user can use one of the following interactive mode commands mentioned in the following sections.

CMD_IMODE and CMD_EXIT

The Boot ROM supports two key commands to manage interactions between device and external debugger. These commands are typically issued by the SWD host debugger and are not directly invoked by the end user.

CMD_IMODE

  • After performing a Cold-Plugging sequence, this command is issued by the debugger to request the device to enter Interactive Mode.
  • No manual intervention is required from the user.
  • The debugger handles all necessary communication with the device to initiate this mode.
  • IMODE is typically used for advanced debugging, fuse programming, or device inspection operations.

CMD_EXIT

  • Upon receiving CMD_EXIT, the Boot ROM resumes the normal boot flow and transfers control to the first mutable application executable code.
  • The application execution begins at BFM address 0x0800_0000.

CMD_SDAL0 – Set Device Access Level to DAL0

The CMD_SDAL0 command allows the user to permanently set the device’s Device Access Level (DAL) to DAL0.

Once the device is in DAL0, the only ways to restore it to DAL2 are as follows:

  • Issuing a chip erase using CMD_CE_ALL (provided this command is not locked) or
  • Using the CMD_HOST_DALELEV command if the CMD_HOST_DALELEV is not locked
  • Write ROMCFG DAL from user code to revert to DAL2

Users must ensure they have access to the necessary recovery mechanisms before executing CMD_SDAL0, especially in production environments.

CMD_HOST_DALELEV - Elevates the Device Access Level to DAL 2

The CMD_HOST_DALELEV command allows the debugger to temporarily elevate the device’s Device Access Level (DAL) to DAL2, provided this command has not been locked by the user.

Behavior and Scope

  • When executed, the device transitions to DAL2 access level.
  • This elevated access level is temporary and remains valid only until the device undergoes a Brown-out Reset (BOR) or Power-on Reset (POR).
  • The elevated DAL2 level becomes effective after a reset (excluding BOR or POR) and is applied only when the device begins executing the first mutable application code.
  • While the device remains in Interactive Mode, the DAL remains at DAL0, regardless of any command execution

This command is useful for temporarily unlocking access to protected features during development or pre-production, but it does not persist across full power cycles or brown-out events.

CMD_CE_ALL - Performs a Full Device Erase

The CMD_CE_ALL command performs a full chip erase, restoring the device to its factory default state. This operation erases all major memory regions and resets configuration fuses to their default values.

Table 16-3. Memory Types
Sr. NoMemory TypeERASED?
1BFMYES
2PFMYES
3BOOTCFG1(1)YES
4BOOTCFG1A(1)YES
5ROMCFG(2)YES
6SRAMYES
Note:
  1. Firmware Metadata (FWMD) is stored within BOOTCFG1/1A and is erased as part of this operation.
  2. After erase operation, the DAL fuse is reset to its default value: DAL2.
  3. Erased contents of memory is 0xFFFFFFFF except for SRAM erased value is 0x00000000.
  4. If the user programs an application in FME without programming USERCFGx in BOOTCFGx, the BootROM uses a default set of values. Refer to the section 12.7 to know more about the default values.
CAUTION: Users must exercise extreme caution when locking the CMD_CE_ALL (Chip Erase All) IMODE command. It is strongly recommended that users apply prudent attention before disabling or restricting access to this command through fuse settings. Locking CMD_CE_ALL may permanently prevent the device erasure, which can lead to irreversible loss of reprogramming capability, especially in conjunction with restrictive DAL and KEYVAL_CE_ALLx fuse configuration.