Issue with uploading program after burning bootloader

avrdude -v -p atmega2560 -c stk500v1 -P /dev/ttyACM0 -b 19200 -e -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m'

avrdude -v -patmega2560 -cstk500v1 -P/dev/ttyACM0 -b19200 -U flash:w:bootloaders/stk500boot_v2_mega2560.hex:i -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m

Are you able to reproduce this error along with a successful sketch upload?

If you were using a new chip this would not work. If you had already programmed fuses for MegaCore this would not work. At least on my setup, the fuses do not get changed with the Lock bit failure.

If your board already has the correct fuses the the bootloader will be written and you will be able to upload sketches.

Hmm ok, this is getting really confusing you say new chip so you mean straight from the factory? Cause if so that's a huge concern for me as the main purpose is to flash the new chips that are coming from the factory I guess what my next question would be is what is the correct setting here then for this?

I realize this may seem unheedingly complicated the way I'm trying to do it but I cannot hook it up to my computer the burn the bootloader this is not an option for us do to a lot of things and we have to use the avrdude command my setup is Raspberry Pi running a python application -> Arduino ISP -> target chip

Take what I say with a grain of salt. I just play around with this stuff .:slight_smile:

1 - Get an up to date Avrdude and avrdude.conf. You may be able to use the Download for Linux ARM 64 bit or 32 bit depending on what Raspberry Pi you are using.

2 - Just overwrite the two bits I pointed out to you earlier and see if it works for you.

I overwrote the original /etc/arduino.conf ,two bits at location 10591,47 and 10591,49 from o to x and this worked for the m2560 chip.

Code: [Select]
memory "lock"
size = 1;
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x o o o o o o o o";

Change to this.

Code: [Select]
memory "lock"
size = 1;
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x x x o o o o o o";

Regarding the fuse settings. You need to decide if you just want the setup we have just been working with ie avrdude -v -p atmega2560 -c stk500v1 -P /dev/ttyACM0 -b 19200 -e -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m

and the bootloader stk500boot_v2_mega2560.hex, you would be good to go.

MegaCore would give you options for different clock(crystal) rates and a smaller bootloader if that would interest you.