2.3.2 Programming a Production Image for Testing Purposes

The MDB can be used to program a production image for testing purposes.

Note: The MDB should be used only for debugging purposes. For programming devices, use the IPECMD tool or the IPECMDBoost (for improved speed). Refer to the Release Notes for IPE Command Line Interface (Readme for IPECMD) located in the MPLABX install folder, for example, \Microchip\MPLABX\vx.xx\docs, where vx.xx represents the version of MPLAB X IDE.
Note: When programming a device, you must select a device first.

The file or hardware tool you need to use for MDB cannot be active or open simultaneously in the MPLAB X IDE, IPE, or a third party program. Make sure you close (or make inactive) the file or hardware tool before you attempt to use it with the MDB.

  1. Select the device by entering the command:

    Device [device name]

    For example: Device PIC18F66K22

  2. Use the set command to select any options you want to use (see Table 3-7 or Table 3-8).
  3. Select the hardware tool. To verify the supported tools, type:

    Hwtool Supported

    The MPLAB ICD 3/4, MPLAB REAL ICE, PICkit 3/4 and Simulator are for programming and debugging, while the MPLAB PM3 is for programming only. To select the hardware tool, type the command:

    Hwtool [tool name]

    For example: Hwtool SIM

  4. If the project was already built, an elf file was generated. To program the device with the elf or hex file, enter the command:

    Program “[location of the elf or hex file]”

    For example:

    Program "C:\MDBTestExample\Build\test\preprocess\files\dist\test_IO_Button.elf"

    If you are using SIM (Simulator) as the hardware tool and the project needs an scl file, it can be set up by using the command:

    Stim “[location of the scl file]”

    For more information, use the command Help Stim. You can use Stimulus to set pin injection and/or register injection.

A “Program succeeded” message displays after programming is complete. A verify is automatically performed during a programming sequence.