I think I have screwed a Mega2560 and need advice as to whether or not it is worth trying to repair.
I'm working with the latest Linux Mint Mate using Arduino IDE 1.8.14. While developing an algorithm with no hardware connected to the Mega apart from the USB cable connecting it to my PC the serial output stopped. I pressed reset but nothing changed. I disconnected then reconnected the USB - nothing changed. I restarted my computer - nothing changed. I tried to re-upload my sketch but it failed. I re-installed the boot loader using a USBasp and the pin13 led started flashing with what seemed to me to be a short flash follwed by a longer flash with the total period being about 1 second. Nothing else changed. Throughout all of this the USB is recognised by my computer. I uploaded using the USBasp an 'led flash' sketch which uploaded OK but failed to flash the led. I changed to using a second Mega and this work perfectly !
When using the USBasp the bootloader uploaded without any error but the new bootloader failed to allow me to upload the 'led flash' sketch I think it is possible the Mega8u2 USB processor that is not working (supposition only, no real proof especially since my computer recognises the USB port). Before I throw out the Mega I would like to try re-installing the code in the Mega8u2 . I can see a 6 pin header (which I assume is the ICSP header I need to use) but where do I get the bin image from ?
The error message when trying to upload my program is -
avrdude: Version 6.3-20190619 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/home/skyvan/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" User configuration file is "/home/skyvan/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : /dev/ttyACM1 Using Programmer : wiring Overriding Baud Rate : 115200 avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude done. Thank you. An error occurred while uploading the sketch
Edit : the power of sitting down with a cup of tea and a biscuit ! After a cup of tea, had one last try - re-installed the boot loader then the led blink sketch. Worked perfectly.