This tutorial is based on this link
We can use an Arduino Board as an ISP programmer for another arduino board or clone. In this case I will use an Arduino UNO clone to upgrade the bootloader of an Arduino MEGA 2560 clone, using ISP script from Arduino IDE.
I had to do this because I was reprogramming my BQ Prusa i3 Hephestos quite modified from the original, and was loading the new version of Marlin 2.0.1. But on different releases of my modification to adjust the software to the hardware features existing in my 3D printer I found out that on certain versions the MEGA 2560 got stuck in middle of the upload procedure. This is due apparently to an old faulty bootloader. The bootloader has a debugging mode, and enters this state when it finds some sequence in the uploaded stream, thus terminating the communication.
You can buy a programmer and follow the steps for the particular programmer you have. But this example uses another Arduino board, and it is converted into an ISP Programmer with a script.
In this case we are using an Arduino UNO as the programmer, to change the bootloader of an Arduino MEGA 2560. We need to identify the pin 1 of the ISP connection.
Pin 1 of ISP connector is the MISO Pin and connects to the D12 pin in the Arduino Programmer. Pin 2 is the Vcc/5V and connects to the 5V Pin in the Programmer. Pin 3 is the SCK Pin and is connected to the D13 Pin in the programmer. Pin MOSI is Pin 4 of the ISP connection, and is connected to the D11 Pin in the programmer. Pin 5 in the ISP connection is the Reset Pin and is connected to the D10 Pin in the programmer. And Pin 6 in the ISP connector is connected to the GND of the programmer. As can be seen up on the diagram.
The programmer is connected to the computer with the Arduino IDE through a USB. Most likely a USB B Cable, but can be different on some clones and models.
We have to program our programmer as an ISP programmer. Everything is already prepared in the Arduno IDE. Connect your Arduino Board to be used as programmer as usual. Select Board type, Serial Port, etc. so you can upload an script to it.
To get the ISP Program just go to File | Examples | 11.ArduinoISP | ArduinoISP.
Now you are ready to upload the ISP programmer software to your Arduino Programmer Board. Just click on Upload, and the IDE will compile and upload the program.
Once the program is loaded in the programmer board it is already set as an ISP programmer. There is nothing to change in the hardware. Also the connection is ready for the transfer. So next step is changing the Board type to the Target Model. In this way Arduino IDE knows what type of Board we are programming. In this case an Arduino MEGA 2560 clone board.
Select Tools | Programmer | Arduino as ISP so the IDE environment knows what type of programmer is dealing with.
We are now ready to upload the new bootloader that is already in the Arduino IDE folders. We click on Tools | Burn Bootloader and we have to wait a few seconds until the IDE ends.
It returns “Done burning bootloader”.
Now we can unplug, and use our target Arduino Board with its new bootloader.