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
avrdude -p m2560 -c dragon_isp -P usb -Uflash:w:stk500boot_v2_mega2560.hex:i -Ulock:w:0x0f:m -v
avrdude -p m2560 -c dragon_isp -P usb -Uflash:w:stk500boot_v2_mega2560.hex:i -Ulock:w:0x0f:m -v avrdude: Version 6.3, compiled on Mar 11 2020 at 23:44:01 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/usr/local/etc/avrdude.conf" User configuration file is "/home/mni/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : usb Using Programmer : dragon_isp avrdude: usbdev_open(): Found AVRDRAGON, serno: 00A200007476 JTAG ICE mkII sign-on message: Communications protocol version: 1 M_MCU: boot-loader FW version: 255 firmware version: 7.33 hardware version: 1 S_MCU: boot-loader FW version: 255 firmware version: 7.33 hardware version: 7 Serial number: 00:a2:00:00:74:76 Device ID: AVRDRAGON AVR Part : ATmega2560 Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PA0 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00 flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : DRAGON_ISP Description : Atmel AVR Dragon in ISP mode Vtarget : 4.9 V SCK period : 4.00 us avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.15s avrdude: Device signature = 0x1e9801 (probably m2560) avrdude: safemode: hfuse reads as D8 avrdude: safemode: efuse reads as FD avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "stk500boot_v2_mega2560.hex" avrdude: writing flash (261406 bytes): Writing | ################################################## | 100% 0.00s avrdude: 261406 bytes of flash written avrdude: verifying flash memory against stk500boot_v2_mega2560.hex: avrdude: load data flash data from input file stk500boot_v2_mega2560.hex: avrdude: input file stk500boot_v2_mega2560.hex contains 261406 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 261406 bytes of flash verified avrdude: reading input file "0x0f" avrdude: writing lock (1 bytes): Writing | ################################################## | 100% 0.06s avrdude: 1 bytes of lock written avrdude: verifying lock memory against 0x0f: avrdude: load data lock data from input file 0x0f: avrdude: input file 0x0f contains 1 bytes avrdude: reading on-chip lock data: Reading | ################################################## | 100% 0.05s avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x0000 0xcf != 0x0f avrdude: verification error; content mismatch avrdude: safemode: hfuse reads as D8 avrdude: safemode: efuse reads as FD avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF) avrdude done. Thank you.