This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:3dprinting:anycubic_i3_mega:replacing_atmega2560 [2020/03/12 07:44] – admin | projects:3dprinting:anycubic_i3_mega:replacing_atmega2560 [2022/02/04 12:40] (current) – [Install avrdude] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Replace Atmega2560 at Trigorilla board ====== | ====== Replace Atmega2560 at Trigorilla board ====== | ||
- | You need to make sure that you can flash the arduino bootloader again onto the chip. | + | If the Atmega2560 is broken, gives for example wrong temperature readings ((See for example here: [[https:// |
- | For this you need an programmer like the AVR Dragon. | + | With the right equipment, removing the Atmega2560 and soldeering a new one should be pretty straightforward. Once done, you need to make sure that the arduino bootloader is in place. |
- | This is the wiring connection | + | For this you need a programmer like the [[https:// |
+ | |||
+ | ^ Connecting trigorilla ISP to AVR Dragon ISP ^ | ||
+ | | {{: | ||
+ | |||
+ | This is the wiring connection | ||
^ AVR Dragon ISP (pin) ^ Trigorilla ISP connector (pin) ^ | ^ AVR Dragon ISP (pin) ^ Trigorilla ISP connector (pin) ^ | ||
| 1: MISO | 1: D50 (Mega2560 pin 22) | | | 1: MISO | 1: D50 (Mega2560 pin 22) | | ||
Line 13: | Line 18: | ||
| 6: GND | 6: GND | | | 6: GND | 6: GND | | ||
- | To flash the bootloader, download and install avrdude: | + | (Pin marking is given on the silk-screen) |
+ | |||
+ | For flashing | ||
==== Download avrdude ==== | ==== Download avrdude ==== | ||
Line 23: | Line 30: | ||
<code bash> | <code bash> | ||
- | gunzip | + | # Dependencies |
- | cd avrdude-6.0 | + | sudo apt-get update |
+ | sudo apt-get install build-essential bison flex automake libelf-dev libusb-1.0-0-dev libusb-dev libftdi-dev libftdi1 | ||
+ | |||
+ | mkdir -p $HOME/ | ||
+ | cd !$ | ||
+ | wget http:// | ||
+ | tar xzf avrdude-6.4.tar.gz | ||
+ | # See here https:// | ||
+ | # for an explanation about word designaters in bash | ||
+ | cd !$:r:r | ||
./configure | ./configure | ||
make | make | ||
- | su root -c 'make install' | + | sudo make install |
</ | </ | ||
Line 49: | Line 65: | ||
Original bootloader: | Original bootloader: | ||
- | arduino-1.8.5/ | + | |
| | ||
or the newer one that fixes the WDT and the !!! problems((See for more info: https:// | or the newer one that fixes the WDT and the !!! problems((See for more info: https:// | ||
Line 60: | Line 76: | ||
=== 1. Unlock fuses, erase, verify === | === 1. Unlock fuses, erase, verify === | ||
+ | The original command would be: | ||
+ | |||
avrdude -p m2560 -c dragon_isp -P usb -Ulock: | avrdude -p m2560 -c dragon_isp -P usb -Ulock: | ||
+ | But this command will cause avrdude to show an error at the verification step((See here: [[http:// | ||
+ | |||
+ | avrdude -p m2560 -c dragon_isp -P usb -Ulock: | ||
+ | |||
+ | The reason is that only the lowest 3 bits from the lockbits are used. The other bits don't return any sensible value and causes avrdude to indicate an error. Ideally you would need to use a logical AND to filter for the lowest 3 bits. | ||
=== 2. Write the bootloader, set the lock fuse, verify === | === 2. Write the bootloader, set the lock fuse, verify === | ||
avrdude -p m2560 -c dragon_isp -P usb -Uflash: | avrdude -p m2560 -c dragon_isp -P usb -Uflash: | ||
+ | |||
+ | Similarly as in step 1, to prevent an error with the fuse setting at the verification step, change this command in: | ||
+ | |||
+ | avrdude -p m2560 -c dragon_isp -P usb -Uflash: | ||
==== Problems ==== | ==== Problems ==== | ||
=== verification error, first mismatch at byte 0x0000 === | === verification error, first mismatch at byte 0x0000 === | ||
+ | If you get an error like the following with avrdude: | ||
+ | |||
<code bash> | <code bash> | ||
- | avrdude -p m2560 -c dragon_isp -P usb -Uflash: | + | ... |
- | + | ||
- | avrdude: Version 6.3, compiled on Mar 11 2020 at 23:44:01 | + | |
- | | + | |
- | | + | |
- | + | ||
- | | + | |
- | User configuration file is " | + | |
- | User configuration file does not exist or is not a regular file, skipping | + | |
- | + | ||
- | Using Port : usb | + | |
- | Using Programmer | + | |
- | avrdude: usbdev_open(): | + | |
- | JTAG ICE mkII sign-on message: | + | |
- | Communications protocol version: 1 | + | |
- | M_MCU: | + | |
- | boot-loader FW version: | + | |
- | firmware version: | + | |
- | hardware version: | + | |
- | S_MCU: | + | |
- | boot-loader FW version: | + | |
- | firmware version: | + | |
- | hardware version: | + | |
- | Serial number: | + | |
- | Device ID: | + | |
- | AVR Part : ATmega2560 | + | |
- | Chip Erase delay : 9000 us | + | |
- | | + | |
- | | + | |
- | RESET disposition | + | |
- | RETRY pulse : SCK | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | Block Poll | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | | + | |
- | | + | |
- | | + | |
- | SCK period | + | |
- | + | ||
- | avrdude: AVR device initialized and ready to accept instructions | + | |
- | + | ||
- | Reading | ################################################## | + | |
- | + | ||
- | avrdude: Device signature = 0x1e9801 (probably m2560) | + | |
- | avrdude: safemode: hfuse reads as D8 | + | |
- | avrdude: safemode: efuse reads as FD | + | |
- | avrdude: NOTE: " | + | |
- | To disable this feature, specify the -D option. | + | |
- | avrdude: erasing chip | + | |
- | avrdude: reading input file " | + | |
- | avrdude: writing flash (261406 bytes): | + | |
- | + | ||
- | Writing | ################################################## | + | |
- | + | ||
- | 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 | ################################################## | + | |
- | + | ||
- | avrdude: verifying ... | + | |
- | avrdude: 261406 bytes of flash verified | + | |
- | avrdude: reading input file " | + | |
- | avrdude: writing lock (1 bytes): | + | |
- | + | ||
- | Writing | ################################################## | + | |
- | + | ||
- | 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 | ################################################## | Reading | ################################################## | ||
Line 170: | Line 105: | ||
0xcf != 0x0f | 0xcf != 0x0f | ||
avrdude: verification error; content mismatch | 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. | + | |
</ | </ | ||
+ | You may have to change the fuse setting verification step((See here: [[http:// | ||
===== Further information ===== | ===== Further information ===== | ||
* [[https:// | * [[https:// |