This is an old revision of the document!
You need to make sure that you can flash the arduino bootloader again onto the chip.
For this you need an programmer like the AVR Dragon.
This is the wiring connection for the AVR Dragon to the Trigorilla ISP connector:
AVR Dragon ISP (pin) | Trigorilla ISP connector (pin) |
---|---|
1: MISO | 1: D50 (Mega2560 pin 22) |
2: VTG | 2: +5v |
3: SCK | 3: D52 (Mega2560 pin 20) |
4: MOSI | 4: D51 (Mega2560 pin 21) |
5: RESET | 5 RESET (Mega2560 pin 30) |
6: GND | 6: GND |
To flash the bootloader, download and install avrdude:
gunzip -c avrdude-6.3.tar.gz | tar xf - cd avrdude-6.0 ./configure make su root -c 'make install'
In /etc/udev/rules.d add (obviously as root user) the following file: 45-atmel.rules
# Atmel Corp. Dragon ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
Then reload udev rules with:
sudo udevadm control --reload-rules && udevadm trigger
A bootloader can be found in the arduino directory from where you downloaded the arduino IDE itself. The location for Arduino-1.8.5 is:
Original bootloader:
arduino-1.8.5/hardware/arduino/avr/bootloaders/stk500v2/Mega2560-prod-firmware-2011-06-29.hex
or the newer one that fixes the WDT and the !!! problems1):
arduino-1.8.5/hardware/arduino/avr/bootloaders/stk500v2/stk500boot_v2_mega2560.hex
avrdude -p m2560 -P usb -c dragon_isp -v
avrdude -p m2560 -c dragon_isp -P usb -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m -e -v
To prevent an error with the fuse setting at the verification step2), change this command in:
avrdude -p m2560 -c dragon_isp -P usb -Ulock:w:0xFF:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m -e -v
avrdude -p m2560 -c dragon_isp -P usb -Uflash:w:stk500boot_v2_mega2560.hex:i -Ulock:w:0x0f:m -v
Similarly, to prevent an error with the fuse setting at the verification step3), change this command in:
avrdude -p m2560 -c dragon_isp -P usb -Uflash:w:stk500boot_v2_mega2560.hex:i -Ulock:w:0xcf:m -v
If you get an error like the following with avrdude:
... Reading | ################################################## | 100% 0.05s avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x0000 0xcf != 0x0f avrdude: verification error; content mismatch ...
You may have to change the fuse setting verification step4). See above for the change.