Flash Firmware Via USB Anet A8 ATMega1284

Posted on

Anet A8 board upgrade using USB Error

In this article I will explain how to How to Flash Firmware Via USB on Anet A8 ATMega1284 and it worked.

Anet is a cheap 3D printer manufacturer from China. One of the printers that I use is Anet A8.

However, when I upload/upgrade the firmware to the Anet V1.5 board via USB from the Arduino IDE, it generates an error “avrdude: stk500_getsync() attempt 1 of 10 not in sync”. As shown in the article below:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x65
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x63
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x68
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x6f
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3a
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x53
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x44
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x63
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x61

avrdude done.  Thank you.

What happened?

That’s because the anet a8 (ATMega1284P) board doesn’t use optiboot loader by default, so it can’t be uploaded via USB. But it will be successful it you use Arduino as ISP and USBasp.

Upgrade Firmware Anet A8 ATMega1284  USB (Success)
This image property of Anet 3D

How to fix it?

Therefore, we have to burn the bootloader by selecting the optiboot option.

To burn the bootloader as far as I know there are two ways, via USBasp and Arduino as ISP.

In this article I will be using the Arduino Uno Board.

Download Arduino IDE

To burn the bootloader and upload the firmware, we can use the Arduino IDE.

For those of you who don’t have Arduino IDE, please download it by clicking the following button:

When finished, please install Arduino IDE on your laptop.

If you use the Linux Operating System, please read the article Install Arduino IDE Ubuntu 22.04 Terminal.

Download Anet Board Library

Once Arduino IDE is available on the computer, by default it doesn’t provide a library board for anet a8.

Therefore you have to download the hardware library for the ATMega1284P used by the Anet 3D board.

The Anet a8 uses the ATMega1284P chip. We can use the library from SkyNet3D Marlin.

Please download the hardware board library by clicking the following button:

or

After your download is complete, extract the file.

Inside the extracted folder there is a “hardware” folder. Please copy the “hardware” folder.

Now, in this case I’m using linux distros base ubuntu, go to Home > Arduino.

If there is no “hardware” folder in the Arduino folder, please paste the file there.

But if in the Home > Arduino folder there is a hardware folder, just copy the “anet” folder and paste it into Home > Arduino > Hardware.

Now, open your Arduino IDE, and click the Tools menu > Board > Marlin AVR Boards. You can see there are two versions available is Anet V1.0 and Optiboot.

Now, please choose Anet V1.0 (Optiboot).

Flash Firmware Via USB Anet A8 ATMega1284

Make Arduino Board As ISP

Now, it’s time to make the Arduino Uno board into an ISP to be a bridge between the computer and the anet 3d board.

Please follow these steps in Arduino IDE:

  • Click File > Examples > 11. ArduinoISP > ArduinoISP
  • Click Tools > Board > Arduino AVR Boards > Arduino Uno
  • Click Tools > Ports > Choose Arduino Board Port (like ttyUSB, ttyCOM, or COM)
  • Click Tools > Programmers > AVRISP MKII
  • Click Upload

After the ArduinoISP firmware has been uploaded to the Arduino Uno Board, now Arduino Uno can become a bridge between the computer and the Anet board.

Anet A8 & Arduino Uno ISP Wiring

Now time for you to connect the arduino board to the Anet A8 as shown in the image below.

Make sure you have disconnected the USB from the Arduino Uno and turned off the power from the Anet board to avoid short circuits during jumper installation.

Upgrade Firmware Anet A8 ATMega1284  USB (Success)
This image property of eliasrm87

Don’t forget to use a 10uF capacitor connected between reset and gnd arduino board.

Burn Bootloader to Anet A8

After the wiring is complete. Please reconnect the Arduino Uno board to the computer and connect the power to the Anet Board.

Now it’s time to do the bootloader, we have to change the arduino IDE configuration to something like this:

  • Click Tools > Board > Marlin AVR Boards > Anet V.10 (Optiboot)
  • Click Tools > Programmer > Arduino as ISP
  • Click Tools > Burn Bootloader

If no errors occur, it means that you have successfully burn bootloader in the anet 3d board.

Upgrade Firware using USB

Now, remove the Arduino ISP wire from the Anet Board.

Connect the computer to the anet a8 board using USB.

Please upload the latest firmware code, read more How to Upgrade Firmware Anet A8 Marlin.

If successful, you will see something like this.

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/opt/arduino-1.8.9/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/neon/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 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   128    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  9000 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
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9705 (probably m1284p)
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 "/home/neon/Arduino/hardware/anet/avr/bootloaders/atmega/optiboot_atmega1284p.hex"
avrdude: writing flash (130556 bytes):

Writing | ################################################## | 100% 0.24s

avrdude: 130556 bytes of flash written
avrdude: verifying flash memory against /home/neon/Arduino/hardware/anet/avr/bootloaders/atmega/optiboot_atmega1284p.hex:
avrdude: load data flash data from input file /home/neon/Arduino/hardware/anet/avr/bootloaders/atmega/optiboot_atmega1284p.hex:
avrdude: input file /home/neon/Arduino/hardware/anet/avr/bootloaders/atmega/optiboot_atmega1284p.hex contains 130556 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.14s

avrdude: verifying ...
avrdude: 130556 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.02s

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.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

Done.

I hope this How to Flash Firmware Via USB on Anet A8 article can be useful.