ATMEGA 2560 Bootloader works one time only, after uploading from USB, next Time not working

Hi, I'm using ATMEGA 2560 in our customized board. I'm using USBASP programmer and everything works fine when i downloading using usbasp programmer. i downloaded bootloader and it is successful. Then i removed programmer and uploaded using usb to serial connected to UART0, it successfully uploaded and works fine. Again if i upload the program using usb to serial board it is not responding. if i burn bootloader again it works for one time and repeating the same.
i tried to erase the chip and done fuse bits from avrdude cmd as follows still the problem exists

Full Chip Erase
avrdude -c usbasp -p m2560 -e

Set Fuse Bits 
avrdude -c usbasp -p m2560 -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFD:m

Write the Bootloader 
Tools > Burn Bootloader.

Set Lock Bits
avrdude -c usbasp -p m2560 -U lock:w:0x0F:m

Verify the Lock Bits
avrdude -c usbasp -p m2560 -U lock:r:-:i


following msg are the error msg during second time upload from usb to serial
     Using Port                    : COM16
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x41
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x54

what shall i do retain the bootloader

do you reset the ATmega right before the upload starts?

1 Like

Is the Tx LED always on?

Which bootloader did you flash? The Avrdude output shows that you tried to communicate with it using the stk500v1 protocol (Optiboot bootloader, -c arduino), But the bootloader that the Arduino MEGA is shipped with uses the stk500v2 protocol.

If you're flashing the MEGA bootloader, try -c wiring instead. It show us the entire Avrdude command when you're flashing the bootloader.

Thank you for your reply, not yet tried before. reset switch is not working i will replace and update you.

Thanks for your reply, No, it is blinking while program upload given

Thanks for your reply, Actually it is not arduino board, ATMEGA2560 chip used in our customized board. I'm using Optiboot 8.0

Thank you very much it's working after reset

That most likely means that the auto-reset circuity either doesn't work like intended, or isn't present at all.

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