Can't upload compiled sketch with bootloader: "verification error; content mismatch"

Hello,
I need to put another bootloader on my Arduino Pro Mini (3.3V / 8MhZ) to make OTA updates possible.

I followed this tutorial (Software / Flashen | AskSin++ only in German, sorry). Basically what I did is I compiled a sketch, then downloaded the bootloader from AskSinPP/bootloader/avr at master · pa-pa/AskSinPP · GitHub and created a *.hex file that contains both the bootloader and firmware.

I am using an Arduino UNO as ISP Programmer.

Uploading only the compiled sketch (without bootloader) works:

>>>: avrdude -c arduino -p m328p -P COM6 -b 115200 -v -v -e -U flash:w:"E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.eightanaloginputs.hex":a 

avrdude.exe: Version 7.0
             Copyright (c) Brian Dean, http://www.bdmicro.com/
             Copyright (c) Joerg Wunsch

             System wide configuration file is "E:/_dls/AVRDUDESS-2.14-portable/avrdude.conf"

             Using Port                    : COM6
             Using Programmer              : arduino
             Overriding Baud Rate          : 115200
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             Serial program mode           : yes
             Parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :

                                               Block Poll               Page                       Polled
               Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
               flash                  65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00
               signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00

             Programmer Type : Arduino
             Description     : Arduino
             Hardware Version: 3
             Firmware Version: 4.4

avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: erasing chip
avrdude.exe: reading input file "E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.eightanaloginputs.hex"
avrdude.exe: input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.eightanaloginputs.hex auto detected as Intel Hex
avrdude.exe: writing flash (19718 bytes):

Writing | ################################################## | 100% 3.17s

avrdude.exe: 19718 bytes of flash written
avrdude.exe: verifying flash memory against E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.eightanaloginputs.hex:
avrdude.exe: load data flash data from input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.eightanaloginputs.hex:
avrdude.exe: input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.eightanaloginputs.hex auto detected as Intel Hex
avrdude.exe: input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.eightanaloginputs.hex contains 19718 bytes
avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 2.54s

avrdude.exe: verifying ...
avrdude.exe: 19718 bytes of flash verified

avrdude.exe done.  Thank you.

But uploading the other *.hex file with bootloader included fails, I get a verification error:

>>>: avrdude -c arduino -p m328p -P COM6 -b 115200 -v -v -e -U flash:w:"E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.with_bootloader_JPLCSw5001.hex":a 

avrdude.exe: Version 7.0
             Copyright (c) Brian Dean, http://www.bdmicro.com/
             Copyright (c) Joerg Wunsch

             System wide configuration file is "E:/_dls/AVRDUDESS-2.14-portable/avrdude.conf"

             Using Port                    : COM6
             Using Programmer              : arduino
             Overriding Baud Rate          : 115200
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             Serial program mode           : yes
             Parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :

                                               Block Poll               Page                       Polled
               Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
               flash                  65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00
               signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00

             Programmer Type : Arduino
             Description     : Arduino
             Hardware Version: 3
             Firmware Version: 4.4

avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: erasing chip
avrdude.exe: reading input file "E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.with_bootloader_JPLCSw5001.hex"
avrdude.exe: input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.with_bootloader_JPLCSw5001.hex auto detected as Intel Hex
avrdude.exe: writing flash (32768 bytes):

Writing | ################################################## | 100% 5.31s

avrdude.exe: 32768 bytes of flash written
avrdude.exe: verifying flash memory against E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.with_bootloader_JPLCSw5001.hex:
avrdude.exe: load data flash data from input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.with_bootloader_JPLCSw5001.hex:
avrdude.exe: input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.with_bootloader_JPLCSw5001.hex auto detected as Intel Hex
avrdude.exe: input file E:\_dls\HM-LC-Sw2-FM-master\HM-LC-Sw2-FM-master\Software\HM-LC-Sw2-FM\HM-LC-Sw2-FM.ino.with_bootloader_JPLCSw5001.hex contains 32768 bytes
avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 4.16s

avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x7e00
             0x11 != 0x50
avrdude.exe: verification error; content mismatch

avrdude.exe done.  Thank you.

This are my settings:
Screenshot

I also tried changing fuse settings with avrdude, same problem:

PS E:\_dls\AVRDUDESS-2.14-portable> .\avrdude.exe -p m328p -c arduino -P COM6 -U lfuse:w:0xE2:m -U hfuse:w:0xD0:m

avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: reading input file "0xE2"
avrdude.exe: writing lfuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.06s

avrdude.exe: 1 bytes of lfuse written
avrdude.exe: verifying lfuse memory against 0xE2:

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

avrdude.exe: verification error, first mismatch at byte 0x0000
             0x00 != 0xe2
avrdude.exe: verification error; content mismatch

avrdude.exe done.  Thank you.

What is wrong, why can't I change fuse settings or upload another bootloader?

But uploading normal compiled sketched works, so the ISP Programmer (Arduino UNO) should work correctly. I also tried another Arduino Pro Mini, same problem.

Will it allow you to just read the fuses?


I have a dragon programmer, when I get strange results, it's usually a wiring connection problem...

It did think it read 0 for the L fuse... Did you modify any of the fuses previously?

I don't think it would try to write if the fuses were set wrong, so I'd check wiring and make sure everything is connected... is this on an UNO board or a bread board 328p.?

:smiley_cat:

Reading lfuse / hfuse seems to be working. As I wrote the Arduino Pro Mini 3.3V / 8MhZ is connected to an Arduino UNO (used as ISP Programmer)

PS E:\_dls\AVRDUDESS-2.14-portable> .\avrdude -p m328p -P COM6 -c arduino -B 10 -U lfuse:r:-:i -v                       
avrdude.exe: Version 7.0
             Copyright (c) Brian Dean, http://www.bdmicro.com/
             Copyright (c) Joerg Wunsch

             System wide configuration file is "E:/_dls/AVRDUDESS-2.14-portable/avrdude.conf"

             Using Port                    : COM6
             Using Programmer              : arduino
             Setting bit clk period        : 10.0
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             Serial program mode           : yes
             Parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :

                                               Block Poll               Page                       Polled
               Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
               flash                  65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00
               signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00

             Programmer Type : Arduino
             Description     : Arduino
             Hardware Version: 3
             Firmware Version: 4.4

avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: reading lfuse memory:

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

avrdude.exe: writing output file "<stdout>"
:0100000000FF
:00000001FF

avrdude.exe done.  Thank you.
PS E:\_dls\AVRDUDESS-2.14-portable> .\avrdude -p m328p -P COM6 -c arduino -B 10 -U hfuse:r:-:i -v

avrdude.exe: Version 7.0
             Copyright (c) Brian Dean, http://www.bdmicro.com/
             Copyright (c) Joerg Wunsch

             System wide configuration file is "E:/_dls/AVRDUDESS-2.14-portable/avrdude.conf"

             Using Port                    : COM6
             Using Programmer              : arduino
             Setting bit clk period        : 10.0
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             Serial program mode           : yes
             Parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :

                                               Block Poll               Page                       Polled
               Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
               flash                  65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
               calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00
               signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00

             Programmer Type : Arduino
             Description     : Arduino
             Hardware Version: 3
             Firmware Version: 4.4

avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: reading hfuse memory:

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

avrdude.exe: writing output file "<stdout>"
:0100000000FF
:00000001FF

avrdude.exe done.  Thank you.

hm, what I can see is that the verification error is always at byte 0x7e00.
Is this the address where the bootloader code starts ?

Can it be that I got a batch of Arduino Pro Minis where the bootloader is write protected? Is something like this possible?

Can I debug this somehow to make some progress?

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