Problem flashing .hex dump

Hello!

I have a dump from a Funduino clone board (UNO R3) in a .hex file. File size is 32768.

I'm trying to flash it to an original UNO R3 board using avrdude, but I got this error:

Detected 1e950f = ATmega328P
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

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

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

avrdude.exe: Device signature = 0x1e950f
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: reading input file "AVRDUDESSRELOJFAA.hex"
avrdude.exe: input file AVRDUDESSRELOJFAA.hex auto detected as Intel Hex
avrdude.exe: writing flash (32768 bytes):

Writing | #################################################
avrdude.exe: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x10
avrdude.exe: stk500_recv(): programmer is not responding

I already tried more boards and other computers and always got the same error.

Searching, I think that the problem is that the HEX dump already have the bootloader (32768 bytes vs. 32256 bytes of program room) and avrdude is overwriting the bootloader of the new board ?

The board is connected using an USB cable to the computer. Already tried diferent cables.

I'm really lost with this.

Any idea ???

Thanks.

Yup, you correctly diagnosed the problem - except, it doesn't actually overwrite the bootloader - the bootloader fails to erase/write the bootloader area of flash, and exits.

Uh, has it actually successfully uploaded the sketch? It looks to me like it had already successfully written most of the sketch, got to the page it can't erase because it's the bootloader sketch, and then choked. But the other stuff should be there....

You can always open the hex file in a text editor and chop out the part after the start of the bootloader section (leaving the final line, though, which signifies the end of the file). Since the boundary will be aligned with the lines, you don't even have to calculate any checksums.