Flashing with Microchip MPLAB IPE

Microchip devices can be programmed (flashed) using the MPLAB Integrated Programming Environment (IPE). MPLAB IPE is a standalone programming tool that supports Microchip debug probes and on-board debuggers. It can be used from the command line via the ipecmd utility, which integrates with Zephyr’s west flash command through the MPLAB IPE runner.

This section describes how to install and configure MPLAB IPE for flashing Zephyr applications onto Microchip target boards.

Overview

MPLAB IPE provides a production-ready programming interface for Microchip microcontrollers. When used with Zephyr, the ipecmd command-line tool is invoked by the west flash command to program the target device with the built firmware image.

The flash process uses the Intel HEX file generated by the Zephyr build system:

build/zephyr/zephyr.hex

Supported Debug Tools

MPLAB IPE supports the following debug/programming tools:

  • MPLAB PICkit™ debuggers/programmers

  • MPLAB SNAP debuggers/programmers

  • MPLAB ICD debuggers

  • On-board debuggers (PKoB, PKoB4, EDBG) available on Microchip development boards

The exact list of supported tools depends on the installed MPLAB IPE version and the target device family.

Requirements

Before flashing with MPLAB IPE, install and configure the following:

  • MPLAB X IDE (which includes MPLAB IPE)

  • Required Microchip device packs (installed automatically or via MPLAB IPE Pack Manager)

  • A supported Microchip debug probe or on-board debugger

  • A Zephyr firmware image built for the target board

Installing MPLAB IPE

MPLAB IPE is included as part of the MPLAB X IDE installer. To install:

  1. Download the MPLAB X IDE installer from the Microchip Technology website.

  2. Extract the downloaded package and run the installer.

    On Linux:

    chmod +x MPLABX-vX.XX-linux-installer.sh
    sudo ./MPLABX-vX.XX-linux-installer.sh
    

    On Windows, run the .exe installer.

  3. During installation, ensure that MPLAB IPE is selected from the available components.

  4. After installation, verify that the ipecmd executable is accessible.

    On Linux, ipecmd is typically located at:

    /opt/microchip/mplabx/vX.XX/mplab_platform/bin/ipecmd.sh
    

    On Windows:

    C:\Program Files\Microchip\MPLABX\vX.XX\mplab_platform\bin\ipecmd.exe
    
  5. Add the directory containing ipecmd to your system PATH.

Verifying the Installation

To verify that MPLAB IPE is correctly installed run the following. The help menu will be displayed.

On Linux:

ipecmd.sh -?

On Windows:

ipecmd.exe -?

Building a Zephyr Application

Build the Zephyr application before flashing. For example, to build the Blinky sample:

# From the root of the zephyr repository
west build -b <board> samples/basic/blinky

After a successful build, the HEX file is available at:

build/zephyr/zephyr.hex

Connecting the Board

Connect the debug/programming interface on the target board to your host machine:

  1. Connect the board’s debug USB port to your host machine using a USB cable.

  2. This connection typically powers the board and provides access to the on-board debugger (e.g., PKoB or PKoB4).

  3. If using an external debug probe (e.g., PICkit, SNAP, ICD), connect the probe to the board’s debug header and connect the probe to your host machine via USB.

  4. Ensure the board is powered. Some boards require a separate power connection in addition to the debug USB.

Note

The specific debug USB port and connector name varies by board. Refer to your board’s documentation page for the exact connection details.

Flashing with west flash

Once the application is built and the board is connected, flash the device using:

west flash

The Zephyr build system invokes ipecmd with the appropriate parameters for the target device and connected tool.

If you need to specify the runner explicitly:

west flash -r mplab_ipe

Troubleshooting

ipecmd Is Not Found

If west flash reports that ipecmd is not found:

  • Verify that MPLAB X IDE / MPLAB IPE is installed.

  • Ensure that the directory containing ipecmd is in your system PATH.

Tool Is Not Detected

If the programming tool is not detected:

  • Check the USB connection between the probe/board and the host machine.

  • Ensure no other application (e.g., MPLAB X IDE, MPLAB IPE GUI) is currently using the debug tool.

  • Verify that the probe firmware is up to date. Use MPLAB IPE GUI to update the firmware if needed.

  • Disconnect and reconnect the probe.

  • On Linux, ensure that appropriate udev rules are installed for Microchip tools.

Device Is Not Recognized

If the target device is not recognized:

  • Verify that the correct device pack is installed in MPLAB IPE.

  • Open MPLAB IPE GUI and use the Pack Manager to install or update packs.

  • Ensure the target board is powered and the debug connection is secure.

  • Confirm that the target device matches the device configured in the Zephyr board definition.

Additional Resources

For more information, see: