Unable to burn bootloader with Atmel-ICE in Arduino IDE 1.8.13

I'm trying to burn an Arduino bootloader on an Arduino UNO board with the Atmel-ICE probe. Unfortunately, avrdude throws an error message when verifying the bytes.

1. Hardware setup

I'm working on a 64-bit Windows 10 PC. The Atmel-ICE is connected to my USB port and to the Arduino UNO board:

2. Atmel-ICE driver

At first I thought that the Atmel-ICE doesn't require installation, because Windows recognizes it as an HID-device. However, I quickly learned that avrdude - launched by the Arduino IDE - needs another driver to interact with the Atmel-ICE. Therefore, I installed the libusb-win32 driver with Zadig (just as suggested on the GitHub thread Unable to program AVR chips via Atmel ICE with IDE 1.6.7 · Issue #4368 · arduino/Arduino · GitHub):

The driver installation succeeded, and I observe a change in the Windows Device Manager. The Atmel-ICE probe no longer appears as an HID-device but as a libusb-win32 device instead:

I believe the Atmel-ICE is now ready to be used with avrdude.

3. Software setup

I'm running a fresh-installed Arduino IDE (version 1.8.13) on a Windows 10 PC. First I activate maximal verbosity for the console output (File > Preferences > Show verbose output). Next, I select the probe: Tools > Programmer > Atmel-ICE (AVR)

Next I select my board: Tools > Board > Arduino AVR Boards > Arduino UNO

Finally, I burn the bootloader: Tools > Burn Bootloader

In the console output, I can see two avrdude commands being launched.

3.1 First avrdude command

The first avrdude command looks like this:

avrdude -CC:\Program Files (x86)\.../avrdude.conf
        -v
        -patmega328p
        -catmelice_isp
        -Pusb
        -e
        -Ulock:w:0x3F:m
        -Uefuse:w:0xFD:m
        -Uhfuse:w:0xDE:m
        -Ulfuse:w:0xFF:m

I can't enter all the output here, because the forum doesn't accept more than 9000 characters per post. For the complete output, please check Unable to burn bootloader with Atmel-ICE in Arduino IDE 1.8.13 · Issue #11107 · arduino/Arduino · GitHub

3.2 Second avrdude command

The second avrdude command is:

avrdude -CC:\Program Files (x86)\.../avrdude.conf
        -v
        -patmega328p
        -catmelice_isp
        -Pusb
        -Uflash:w:C:\Program Files (x86)\.../optiboot_atmega328.hex:i
        -Ulock:w:0x0F:m

I can't enter the complete output here (see note from previous paragraph)

3.3 The error message

avrdude throws this error message:

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x0f
avrdude: verification error; content mismatch

What should I do to solve this?

hi kristof_mulier,

You may refer to this Youtube tutorial video, where I successfully burned my Nano V3 clone with latest Bootloader using using C:\arduino-1.8.13\hardware\arduino\avr\bootloaders\optiboot\optiboot_atmega328.hex with the use of AVRISP MKII via Atmel Studio 7, after that under Arduino IDE, I can select "Processor: ATmega328P", no longer need to select the "ATmega328P (Old Bootloader) anymore.

Since you are using the latest Atmel ICE Programmer, you may try to burn using Atmel Studio 7.

I don't have Atmel-ICE device, so can't advise further.

Hopes this helps.