# Trouble with the bootloader

**URL:** <https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438>\
**Category:** Uploading\
**Created:** [February 24, 2023, 6:35pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438 "2023-02-24T18:35:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jborja21](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jborja21/32/913893_2.png) [@jborja21](https://forum.arduino.cc/u/jborja21)\
**Post date:** [February 24, 2023, 6:35pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/1 "2023-02-24T18:35:36Z")

</div>

Hello,  
I keep getting an issue when I tried to upload code to my Arduino ATMEGA2560. I uploaded a .hex file to it earlier using an ATMEL-ICE through the ICSP on microchip studio. I think this might have messed this up? I tried uploaded a file via USB with Arduino IDE, but I would get timeout issues. I thought maybe burning the bootloader might resolve this issue, but I would get errors. I tried to burn the bootloader via USB and ATMEL-ICE. I attached the verbose output during **upload**. Any suggestions are appreciated.

Thank you!

```cpp
"C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -catmelice_isp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.0 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xff instead of 0x3f (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD8:
avrdude: load data hfuse data from input file 0xD8:
avrdude: input file 0xD8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

"C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -catmelice_isp -Pusb "-Uflash:w:C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:i" -Ulock:w:0x0F:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.0 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex"
avrdude: writing flash (261406 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 261406 bytes of flash written
avrdude: verifying flash memory against C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: load data flash data from input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex contains 261406 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% -0.00s

avrdude: verifying ...
avrdude: 261406 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

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

avrdude done. Thank you.

Failed to burn bootloader: uploading error: exit status 1

```

---

<div class="post-metadata">

**Author:** ![johnwasser](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnwasser/32/214270_2.png) [@johnwasser](https://forum.arduino.cc/u/johnwasser)\
**Post date:** [February 24, 2023, 6:39pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/2 "2023-02-24T18:39:39Z")

</div>

> [@jborja21](#):
>
> I uploaded a .hex file to it earlier using an ATMEL-ICE through the ICSP on microchip studio.

If you upload a sketch with an ISP it overwrites the bootloader. To get the bootloader back, burn a fresh bootloader. Connect your ISP to the ICSP header, and select your ISP with Tools-\>Programmer. Select the right Arduino board. Select Tools-\>Burn Bootloader.

---

<div class="post-metadata">

**Author:** ![jborja21](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jborja21/32/913893_2.png) [@jborja21](https://forum.arduino.cc/u/jborja21)\
**Post date:** [February 24, 2023, 6:45pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/3 "2023-02-24T18:45:19Z")

</div>

I did as you suggested, and I get the error below.

```cpp
"C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -catmelice_isp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.0 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xff instead of 0x3f (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD8:
avrdude: load data hfuse data from input file 0xD8:
avrdude: input file 0xD8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

"C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -catmelice_isp -Pusb "-Uflash:w:C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:i" -Ulock:w:0x0F:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.0 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex"
avrdude: writing flash (261406 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 261406 bytes of flash written
avrdude: verifying flash memory against C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: load data flash data from input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex contains 261406 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 261406 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

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

avrdude done. Thank you.

Failed to burn bootloader: uploading error: exit status 1

```

---

<div class="post-metadata">

**Author:** ![johnwasser](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnwasser/32/214270_2.png) [@johnwasser](https://forum.arduino.cc/u/johnwasser)\
**Post date:** [February 24, 2023, 7:31pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/4 "2023-02-24T19:31:58Z")

</div>

It looks like the programming of the lock bits is not working as expected. There is a warning that the fuses should be set to 0xFF instead of 0x3F. It couldn't hurt to change the "boards.txt" file to do that:

```cpp
mega.bootloader.tool=avrdude
mega.bootloader.tool.default=avrdude
mega.bootloader.low_fuses=0xFF
## Was:
##mega.bootloader.unlock_bits=0x3F
##mega.bootloader.lock_bits=0x0F
## Changed to:
mega.bootloader.unlock_bits=0xFF
mega.bootloader.lock_bits=0xCF

```

You can find the boards.txt file in:  
`C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\boards.txt`

---

<div class="post-metadata">

**Author:** ![jborja21](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jborja21/32/913893_2.png) [@jborja21](https://forum.arduino.cc/u/jborja21)\
**Post date:** [February 24, 2023, 8:56pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/5 "2023-02-24T20:56:54Z")

</div>

This time it was loading a while and looked promising, but it failed again.

```cpp
"C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -catmelice_isp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.1 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xff instead of 0x3f (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD8:
avrdude: load data hfuse data from input file 0xD8:
avrdude: input file 0xD8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

"C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -catmelice_isp -Pusb "-Uflash:w:C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:i" -Ulock:w:0x0F:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.0 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex"
avrdude: writing flash (261406 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 261406 bytes of flash written
avrdude: verifying flash memory against C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: load data flash data from input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex contains 261406 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 261406 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

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

avrdude done. Thank you.

Failed to burn bootloader: uploading error: exit status 1

```

---

<div class="post-metadata">

**Author:** ![ua6em](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ua6em/32/930389_2.png) [@ua6em](https://forum.arduino.cc/u/ua6em)\
**Post date:** [February 24, 2023, 8:59pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/6 "2023-02-24T20:59:49Z")

</div>

> [@jborja21](#):
>
> ` Programmer Type : JTAG3_ISP`

STK-500V2

---

<div class="post-metadata">

**Author:** ![johnwasser](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnwasser/32/214270_2.png) [@johnwasser](https://forum.arduino.cc/u/johnwasser)\
**Post date:** [February 24, 2023, 9:09pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/7 "2023-02-24T21:09:02Z")

</div>

> [@jborja21](#):
>
> looked promising, but it failed again.

Nothing changed so the "boards.txt" changes didn't work. Try re-starting the IDE.

---

<div class="post-metadata">

**Author:** ![jborja21](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jborja21/32/913893_2.png) [@jborja21](https://forum.arduino.cc/u/jborja21)\
**Post date:** [February 24, 2023, 10:32pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/8 "2023-02-24T22:32:00Z")

</div>

I uninstalled and reinstalled the arduino IDE. It still gave me the same error. I read on this site [avrdude: verification error, first mismatch at byte](https://arduino.stackexchange.com/questions/17762/avrdude-verification-error-first-mismatch-at-byte-0x0000-0x00-0x16-using) to **connect a pullup resistor to ground and RESET**. This worked for me!

```cpp
avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.0 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xff instead of 0x3f (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD8:
avrdude: load data hfuse data from input file 0xD8:
avrdude: input file 0xD8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.09s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
"C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -catmelice_isp -Pusb "-Uflash:w:C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:i" -Ulock:w:0x0F:m
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : usb
         Using Programmer : atmelice_isp
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description : Atmel-ICE (ARM/AVR) in ISP mode
         Vtarget : 5.0 V
         SCK period : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex"
avrdude: writing flash (261406 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 261406 bytes of flash written
avrdude: verifying flash memory against C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: load data flash data from input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:
avrdude: input file C:\Users\jborja\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex contains 261406 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 261406 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xcf instead of 0x0f (double check with your datasheet first).
avrdude: 1 bytes of lock verified

avrdude done. Thank you.

```

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [August 23, 2023, 10:32pm UTC](https://forum.arduino.cc/t/trouble-with-the-bootloader/1094438/9 "2023-08-23T22:32:13Z")

</div>

Closed on August 23, 2023, 10:32pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
