Home Getting Started Download Discussions Source Report An Issue

Enabling "AVR/EDBG mode" on the MPLAB Snap & PICkit 4 on GNU/Linux

The MPLAB Snap and PICkit 4 are hybrid devices - that is, they can present themselves as two different USB devices, depending on the configured firmware mode. When configured, these devices can present themselves as EDBG (Embedded Debugger) devices. They are known to be in "AVR mode" when configured in this way.

When in AVR mode, both devices will use different USB vendor and product IDs.

Firmware mode Device USB vendor ID USB product ID
EDBG (AVR) Mode MPLAB Snap 1003 (0x03eb) 8576 (0x2180)
MPLAB PICkit 4 1003 (0x03eb) 8567 (0x2177)
Non-EDBG Mode MPLAB Snap 1240 (0x04d8) 36888 (0x9018)
MPLAB PICkit 4 1240 (0x04d8) 36882 (0x9012)

Both devices can be configured to operate in one of these two firmware modes, via Microchip software (MPLAB IDE and IPE).

In order to use the MPLAB Snap or PICkit 4 to program and debug AVR microcontrollers, AVR mode must be enabled.

The configured firmware mode is persisted through power cycles. Users are not required to enable AVR mode before each instance of use - enabling it on a single occasion should suffice.

Bloom will fail to recognise the device until AVR mode has been enabled.


Confirm the device is not already in AVR/EDBG mode

Upon connecting the device via USB, run one of the following commands:

For the MPLAB SNAP:

$ lsusb -d 04d8:9018;

For the MPLAB PICkit 4:

$ lsusb -d 04d8:9012;

If the device is not in AVR mode, the following string should be output:

Bus XXX Device XXX: ID 04d8:XXXX Microchip Technology, Inc.

If no such string is output, the device is likely already in AVR mode. Skip to the Confirmation section to confirm this.

Installing MPLAB IPE

Bloom cannot enable AVR mode on the device - it must be done via Microchip's MPLAB IPE software. This can be installed via the MPLAB IDE installer. Download the installer from the Microchip website, select the MPLAB IPE option and proceed with the installation.

Selecting MPLAB IPE within MPLAB IDE installer

Enabling AVR mode via MPLAB IPE

MPLAB IPE may fail to enable AVR mode, if this is the first instance of use, for the particular device.


If the device is brand new or this is the first instance of use, since purchase, a firmware upgrade may be required before AVR mode can be enabled. The MPLAB IPE software can automatically upgrade the firmware, but will only do so when attempting to connect to the device via its other (non-EDBG) interface.

Essentially, this means you must first follow the instructions in the Disabling AVR mode section, before attempting to enable AVR mode. Following those instructions will result in MPLAB IPE attempting to connect to the device via its non-EDBG interface. This connection attempt will trigger an automatic firmware upgrade. Once the firmware upgrade is complete, restart MPLAB IPE and proceed with the enabling of AVR mode.

Open MPLAB IPE, select any target from the AVR 8-bit family and ensure that the device (Snap or PICkit 4) is selected in the 'Tool' input.

The device does not need to be connected to the selected target. It can remain disconnected from any target throughout this process.


Enabling AVR mode on the MPLAB Snap and PICkit 4, via the Microchip MPLAB IPE software

Select the 'Read' function. MPLAB IPE will now attempt to connect to the device. Ignore any errors relating to target connection. Upon connecting, it will automatically enable the EDBG (AVR) firmware mode. Once AVR mode has been enabled, the device will perform a hard USB reset.

Confirmation

As mentioned above, the device will use a different vendor and product ID when in AVR mode. To confirm the operation was successful, run one of the following commands with the device connected:

For the MPLAB Snap:

$ lsusb -d 03eb:2180;

For the MPLAB PICkit 4:

$ lsusb -d 03eb:2177;

If the device is in AVR mode, the following string should be output:

Bus XXX Device XXX: ID 03eb:XXXX Atmel Corp.

Disabling AVR mode via MPLAB IPE

Upon enabling AVR mode, the device will no longer be able to perform programming and debugging operations with any non-AVR target (such as any target from the PIC family), until AVR mode has been disabled.

The process of disabling AVR mode is similar to that of enabling AVR mode. MPLAB IPE will automatically disable AVR mode when attempting to use the device to connect to a non-AVR target, such as one from the PIC family.

Switching target families (AVR -> PIC) in the same MPALB IPE session can result in MPLAB IPE crashing or hanging indefinitely. Restart MPLAB IPE before switching target families.

Open MPLAB IPE and select any target from the PIC family. Click 'Apply', then 'Connect'.


Disabling AVR mode on the MPLAB Snap and PICkit 4, via the Microchip MPLAB IPE software

MPLAB IPE will now attempt to connect to the device. Upon connecting, it will automatically disable AVR mode. Once AVR mode has been disabled, the device will perform a hard USB reset. Ignore any errors relating to target connection or invalid target/device ID.

Debugging AVR targets with the MPLAB Snap and PICkit 4

Once AVR mode has been enabled, the device can be used in conjunction with Bloom, to perform debugging operations on over 200 AVR 8-bit targets.

Bloom exposes an interface to the connected target by means of a GDB server. Any IDE with remote GDB capabilities can interface with Bloom, in order to perform debugging operations on the target.

Bloom also exposes the target's GPIO pin states, register values and memories, via the Bloom Insight window. Users can manipulate GPIO output pins and register values, as well as inspect target RAM and EEPROM, whilst execution on the target is halted.

Bloom Insight

To begin debugging with the MPLAB Snap or PICkit 4, on GNU/Linux, follow the instructions at Getting Started with Bloom.