Marlin upgrade on the Ender 2 & 3
The Ender 2 is no longer being produced, yet it still gives amazing prints when used with the right firmware.
On this article I will show how to properly set up the Arduino IDE and the bootloaders to upgrade the firmware.
Before we begin, lets clarify and expose one of the biggest issues with the Ender 2 and Ender 3: the ATMega 1284p that comes with the default boards will not be the microprocessor of your dreams, on the contrary, it will be your nightmare. This small micro has very little room for code, and it will limit your options.
When you add more features to Marlin, like a custom boot screen, the ability to pause a print properly, or advanced material flow techniques. you are basically adding more and more code into the flash memory of the processor. On most boards this won’t be an issue, since they will have plenty of flash space to play with, however, on the Ender 2 and 3, this quickly becomes the limiting factor.
Long story short, I wanted to enable automatic calibration with other features and it doesn’t fit anymore with the latest code, so I made a fork. I added automatic calibration, Linear Advance and Advanced Pause, unless you disable one of them you will need to use this instead of the official Marlin repos:
Now that we cleared up all possible issues, lets continue to set up the environment to finally flash Marlin
You will need to perform these steps
- Install support for the 1284p microprocessor into Arduino IDE
- Connect an ISP (either arduino, or any other you have at hand) to the Ender 2 board
- Flash a bootloader through the Arduino IDE
Choosing which toolchain to add support to Arduino IDE.
While this could be straightforward, the reality is that there are 2 different options to support the 1284p. One is old but has been the default for ages. The other is new, it has a couple of extra security measures which are really recommended, but it still has one bug that makes you edit one file manually before using it for the first time.
The old toolchain was developed for a board called Sanguino. This library is very outdated, but it still works today.
Just go to the board manager and add this: https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json
This should add Sanguino back to the list of available boards. This library used to be part of the official list but it’s no longer the case.
For the second alternative, the code is much newer, comes with BOD protection, printf support and Link Time Optimization.
You just need to follow these instructions
And then select the following configuration in the Arduino IDE
Tools > Board > ATmega1284
Tools > Clock > External 16 Mhz
Tools > BOD > BOD v2.7 (for extra security)
Tools > Compiler LTO > LTO enabled (to reduce the binary size)
Tools > Variant > 1284P
Tools > Pinout > Sanguino
Tools > Bootloader > Yes (UART0)
This would be by far the recommended toolchain to use, if it wasn’t for a small bug you need to fix (if it happens to you. It did happen to me.).
That should be enough on the Arduino IDE side, now you need to connect the ISP and flash the bootloader. This is only done the first time you upgrade. The procedure and boards are the same for the Ender 2 and 3.
For Marlin itself, the web is filled with articles and videos that show how to compile it, enable new features and mod it as needed. I personally recommend Linear Advance and Advanced Pause. The new pause functionality is really good. Even though I don’t really use it that much, changing the filament becomes an easy task with it. And finally Linear Advance improves the print quality by a huge margin compared to the stock firmware.
Good luck!