Flash the Arduino bootloader to the ATMega2560

The Arduino bootloader is a small program resident on the chip memory that allows to install new firmware through a serial connection, without the need of an external programmer.

When you buy a new ATMega2560 is possible that it comes without any bootloader pre-installed, so you have to burn it yourself to unlock the the capability of the d-diot board to upload the RFLink firmware and other sketches directly from your Raspberry Pi, through the serial0 interface.

The bad news is that to burn the Arduino bootloader you need an external programmer; the USBAsp is a common and cheap programmer but unfortunately, due to this bug, it don't works properly with the ATMega2560 microcontroller.

USBAsp programmer with 3.3 - 5V voltage selector

More details about this issue and a possible solution are here, but a simpler way is to use an Arduino board as ISP programmer.

Follow this tutorial to use your arduino board as a programmer for the ATMega2560. For me it worked perfectly with the wiring diagram reported below and setting the USE_OLD_STYLE_WIRING (uncomment line 81) in the ArduinoISP sketch that comes with the Arduino IDE.

Arduino as ISP wiring

The PIN 1 (MISO - orange wire) of the ICSP header in the d-diot board is located in the bottom left corner and is marked with a discontinuity in the blank line of the footprint.

  • how_to/atmega2560/flash_bootloader.txt
  • Last modified: 2019/05/26 09:42
  • by franzunix