Replacing the Bootloader of an Arduino Mega Using an Arduino Nano - peno64/ArduinoOTAwiki GitHub Wiki

Requirements

  1. Arduino Nano (as the programmer)
  2. Arduino Mega (the target device to replace the bootloader)
  3. Some jumper wires
  4. A 10 µF capacitor

Steps

1. Setting up the Arduino Nano as an ISP (In-System Programmer)

  • Connect the Arduino Nano to your computer via USB.
  • Open the Arduino IDE.
  • Go to File > Examples > 11.ArduinoISP > ArduinoISP.
  • Upload the ArduinoISP sketch to the Nano by clicking the upload button.

2. Connecting a 10 µF Capacitor

  • After uploading the ArduinoISP sketch, connect a 10 µF capacitor between the RESET pin and GND of the Arduino Nano:
    • The positive side (+) of the capacitor should be connected to the RESET pin of the Nano.
    • The negative side (-) should be connected to GND.
  • This capacitor prevents the Arduino Nano from automatically resetting during the bootloader burning process, ensuring it remains stable as an ISP.

3. Making Connections Between Arduino Nano and Arduino Mega

  • Make the following connections between the pins of the Nano and the Mega:
    • Nano D10 to Mega RESET
    • Nano D11 to Mega MOSI (pin 51)
    • Nano D12 to Mega MISO (pin 50)
    • Nano D13 to Mega SCK (pin 52)
    • Nano GND to Mega GND
    • Nano 5V to Mega 5V

4. Burning the Bootloader

  • In the Arduino IDE, go to Tools > Board and select the correct board for your target (in this case, Arduino Mega 2560 or Optiboot8-avr (in Sketchbook)).

  • Go to Tools > Programmer and select Arduino as ISP.

  • Select the correct serial port

  • Go to Tools and click on Burn Bootloader.

    This will start the process of burning the bootloader onto the Arduino Mega. If everything is correctly connected, the Arduino IDE should display a message indicating that the bootloader was successfully burned.

Important Notes

  • Ensure that you select the correct board and processor in the Arduino IDE, otherwise, the bootloader burning process may fail.
  • If the connections are incorrect or there is an issue with the power supply, the burning process will not succeed. In such cases, check your wiring and try again.
  • The Arduino Nano must receive proper power via USB. Make sure it is well connected to the computer.
  • The 10 µF capacitor is crucial to prevent an automatic reset of the Arduino Nano during the bootloader burning process.
  • Note that the Arduino Nano is powered via USB and that it's 5V pin is connected to the 5V pin of the Arduino Mega to power it. So don't connect the USB of the Arduino Mega to your computer at this moment. Once the bootloader is uploaded, at least the 5V and RESET cable should be disconnected and USB from the Nano should be disconnected before connected the USB of the Mega to your computer.

Following these steps should allow you to successfully replace the bootloader of your Arduino Mega using an Arduino Nano. Good luck!

See also https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/