You have probably landed here because rather than swap out the ANet A8’s mainboard for a newer 32bit board you would prefer to just upgrade it’s firmware to Marlin in order to install the additional safety monitors. Good Luck!
Jun 20 – Work In Progress – Having seen someone on facebook this week struggling to work with the PIO Marlin Autobuild for the ANet Printer, and I still have my old ANet board and I am currently bored so, I have decided to give it a go and see if I can get it to firstly build and secondly upload.
The thing with fully automatic build scripts is that they are great when they work first time. But when they do not it is often very difficult to debug them.
If you want to try using the Marlin Autobuild add-in for PIO then you could try following this video…
https://www.youtube.com/watch?v=38PkynA1uGI
So the following will be a step by step guide to manually building and updating the AnetV1.5/V1.7 board to the latest stable release Marlin build.
To manually upgrade the existing ANet V1.5 or V1.7 board to Marlin simplistically all we need to execute is the following steps.
Back up the existing Anet configuration
Install VSCode on our computer
Install PIO in VScode
Download the latest Marlin stable release (Marlin 2.0.5.3)
Validate our Compiler environment by building the default Marlin configuration
Download the matching ANet A8 Configuration files
Modify Marlin and PIO for the ANet Board and recompile Marlin
Upload the newly compiled firmware on the ANet Board
a) Manually
b) Configure PIO for automatic upload.
c) Optional installing a bootloader
Then iterate around steps 6 and 7 adding new features until you rather quickly run out of the ANets limited memory !!
Step 1. Backup the existing configuration
Before starting the upgrade use Pronterface (or similar) to send M503 to the original ANet Motherboard to retrieve from EEPROM the running set up that you have been using. If the board has already been removed from the printer just reconnect the 12V power and plug in the USB cable. You need to use the configuration values retrieved as the basis of your initial configuration of Marlin.
Remember the initial aim should be to get the printer working as well as it was before the upgrade. Then you can try the faster/newer/fun options once it has been debugged.
Steps 2 to 5. Depending on your operating system you should follow my instructions on one of the following SKR build pages up until you have successfully completed their Section 7 – Validate the Installation.
Step 5. To download the latest Marlin ANet A8 Configuration file in a browser go to
https://github.com/MarlinFirmware/Configurations
In the top left corner change the branch from bugfix-2.0.x to release-2.0.5. You really do not want to be working in the bugfix code branch as that is the daily build and which often overnight will introduce new errors as multiple developers try to work the bugs out and add new features at the same time.
Then click on the Clone or download button and select download zip. Unzip the compressed file and navigate the file tree to config/examples/Anet/A8 where you will find the 3 of the 4 files that we need.
_Statusscreen.h
configuration.h
configuration_adv.h
Step 6. We now need to update the default Marlin configuration for the ANet board
Copy the three files from the ANet example to your Marlin source directory (if you have been following my examples this would be) Marlin-2053-mmdd/Marlin/ in the process overwriting the two existing default configuration files.
The final file that needs updating is the platformio.ini file. For that we need to open the default 2.0.5.3 file in VSCode.
In the left hand window make sure that your project directory is expanded. If you can not see the .github entry then click on “>MARLIN-2053-mmdd” to expand the file tree. Scroll down to the bottom and locate “platformio.ini” and left click on it to open it in an editor window in VSCode. Now search the code for “default_envs” (approximately line 21) and change this from “default_envs = mega2560” to read “default_envs = sanguino1284p” then save the file.
Then rebuild Marlin by clicking on the tick icon.
Jun 22nd – Up to here this all seems to be working on my Macbook and I have a new firmware.hex file.
Step 7. Upload the firmware to the ANet board
Before the printer starts up the printing firmware, if present, it will run the bootloader code. The bootloader is a separate application that looks for the presence of a device programmer attached to the USB port. If it finds one it will attempt to download new firmware from it. If it does not find a device programmer it will exit and the existing firmware will start up.
Unfortunately because the ANet board has limited memory capacity (128K) the ANet team decided to remove the Arduino bootloader from some ANet boards, freeing up more memory (about 2K) for bigger firmware. So depending on the age of your ANet board you may need to install a bootloader before you can successfully get it to upload the new Marlin firmware.
So let us assume that your board has a boot loader installed, otherwise you will need to jump to Step 7c for help in installing one.
If the build has been successful you will find the new firmware in the .pio/build/sanguino1284p/firmware.hex file.
Step 7a. Manually uploading a hex file to the ANet board
To manually upload a hex file to the ANet board we need an upload program. The standard program is called avrdude. If you have an Arduino IDE installed on your machine then you already have avrdude.
I thought this would be trivial, I could just use the Arduino IDE from a command line to upload the hex file, but how wrong could I be. The ANet (and Ender 2) uses an ATMega1284p chip (a Sanguino) and this is not used by any normal Arduino board so extra board support has to be installed into the standard Arduino IDE to get it to work.
So from the Arduino Forums (https://forum.arduino.cc/index.php?topic=625108.0) here is how to install Sanguino board support:
Arduino > (File) > Preferences
To the “Additional Boards Manager URLs” field, add https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json. If you have multiple URLs in the field, separate them with commas.
Click the “OK” button.
Tools > Board > Boards Manager
Wait for the downloads to finish.
Search for “Sanguino”.
Click on “Sanguino by Kristian Sloth Lauszus”.
Click the “Install” button.
Wait for the installation to finish.
Click the “Close” button.
Note: Another alternative board manager is the MightyCore with Sanguino Pins which has better Link Time Optimisation so can create smaller executables. See github….
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin
You can use this straight from a terminal command line.
or you could download XLoader for Windows, which is a simple graphics front end for avrdude program . XLoader and avrdude can be obtained as a single package from
https://www.hobbytronics.co.uk/arduino-xloader
Step 7b. Automatically uploading a hex file to the ANet board
You can should you wish configure platformIO to copy the firmware.hex file to your USB connected printer by configuring the upload_port parameter in platformio.ini. For the ANet board this would be the USB serial port that the ATMega1284p is attached to.
To execute the transfer after a Tick build then click on the -> (right arrow) next to the Tick icon. To build and automatically transfer simply start the build with the -> icon.
Step 7c. Installing a boot loader
To install a bootloader please refer to one the following videos…
My Macbook AVRDude upload command line
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude
-C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf
-v
-patmega1284p
-carduino
-P/dev/cu.usbserial-14240
-b115200
-D
Uflash:w:/var/folders/fy/46480xqn0cn7lpj4lrkrknth0000gn/T/arduino_build_759234/Blink.ino.hex:i
System wide configuration file is “/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf”
Using Port : /dev/cu.usbserial-14240
Using Programmer : arduino
Overriding Baud Rate : 115200
My Win 10 AVRDude upload command line
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude
-CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf
-v
-patmega1284p
-carduino
-PCOM7
-b115200
-D
-Uflash:w:C:\Users\admin\AppData\Local\Temp\arduino_build_675437/Blink.ino.hex:i
System wide configuration file is
“C:\Program Files(x86)\Arduino\hardware\tools\avr/etc/avrdude.conf”