Hello everyone.
Here is my problem:
arduino mega 2560 is not listed as a device, and cannot be programmed by USB nor ICSP. The led works (pattern: blin-blink-pause).
Uploading a programm through ICSP seems to work but the program doesn't work and the led stays off.
How did this start?
I uploaded a sketch that would read every pin status, analog, input and output. It fried TWO arduino mega2560. Both stopped working. For some strange reason one of them started working while I was trying to find what was wrong, even though I didn't fix anything, I just plugged it and it was alive again. But I have still one dead arduino mega, and I bought an AVR isp MK2 programmer to try to fix it.
Details on what I have tried:
I have an AVR ISP MK2 programmer so I tried to burn the armega8u2 firmware through ICSP:
sudo avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_getparm(): failed to get parameter 0xa1
avrdude: stk500v2_program_enable(): cannot get connection statususe:w:0xD9:m -U eavrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for AT90USB82 is 1E 93 82
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude done. Thank you.
mega8u2 seems to be fried.
Then I tried to burn the bootloader through the mega2560 ICSP port but the arduino IDE gives me an error trying to burn the bootloader, and the console log is empty.
So I tried to burn the bootloader manually:
sudo avrdude -c avrispmkII -p m2560 -P usb -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m
sudo avrdude -c avrispmkII -p m2560 -P usb -v -v -v -U flash:w:stk500boot_v2_mega2560.hex
sudo avrdude -c avrispmkII -p m2560 -P usb -U lock:w:0x0F:m -v -v -v
Every command works as expected. no error messages are shown. BUT the arduino is still not recognized. By now the led blinks twice, pauses, and keeps repeating this cycle.
As a final test I uploaded a sketch to the arduino using the ICSP port. No errors are shown, but the program NEVER starts. I'm talking about the simple "blink" example program. no modifications, I just load it, compile it and try to upload it using the programmer (Ctrl+Shift+U). This time the leds simply stops working until I burn the bootloader again.