Adding MPLABX IPECMD as a Programming Tool to the IDE

You can add external custom programming tools to the Swordfish IDE so that you can program your device directly from within the IDE. This tutorial will show how to create a custom programmer entry using MPLABX and the PICkit4.

MPLABX includes a commandline program (ipecmd.exe) that can be used with many of the Microchip ICSP programmers, including the PICkit3/4, ICD3/4, SNAP, and Curiosity PKOB.

To install a custom tool into the IDE, first select the down arrow to the right of the Build button on the IDE main menu bar. From the Build menu dropdown select Options and Install New Programmer...

Select Create a custom programmer entry and click Next (you can also get to this point using the main menu View | Compile and Program Options... | Programmer tab)

In the Display Name: textbox type the name for your new tool. I've named the tool 'PICkit4'. Click Next

Enter the name of the programmer executable file. Here we're using mplabx ipecmd.exe. Click Next

Now you need to enter the path to the executable file entered above. You can have the wizard search automatically for the program or just enter the path manually. Here I've selected to go the manual route... Click Next

If you've selected Find Manually... then use the selection window to browse to the folder containing ipecmd.exe. Locate the folder where you installed mplabx, and ipecmd.exe should be found in '<install-path>Microchip\MPLABX\v5.35\mplab_platform\mplab_ipe', depending on your installation.

Once you've entered the path click Next

You now need to enter the commandline parameters. This varies with the tool and program. For ipecmd, see the html readme file found in 'Microchip/MPLABX/v5.35/docs/Readme for IPECMD.htm' for a list of all the options available.

At a minimum you want to specify the tool, target device, and hex filename...
-TPPK4 -P$target-device$ -F$hex-filename$

You may also want to power the target from the tool, so add -W, -W3.3, or -W5.0 as appropriate. -M specifies to program the entire chip, and -OL releases the MCLR reset when done so the target runs, so here are the parameters I've been using:
-TPPK4 -W -M -OL -P$target-device$ -F$hex-filename$

Select Finished and your tool should now be installed.

After compiling your program select Project | Program (F11) in the IDE and a command window should open as ipecmd runs and the device is programmed. It may take a few moments for ipecmd to initialize (it's a java program, so be patient).

Note: In the screenshot below I have used the -OB parameter to put it into batch mode so that the window stays open. Normally the window will close automatically.

That's all there is to it!

If desired, you can change the operation of the Build button from Compile Only to Compile and Program so that when you build it will automatically program the device.

Once you have an entry defined you can modify its settings using the main menu View | Compile and Program Options... | Programmer tab and select the Edit button.

While this tutorial focuses on using the tools from MPLABX, this method can also be used with older MPLAB and other tools.