I don’t know if it’s the lack of sleep ( I have a newborn in the house) or if this genuinely was a tough project, but I finally got everything working after five evenings of hacking.
Marlin Firmware Open Source 3D Printer Driver. First created in 2011 for RepRap and Ultimaker by Erik van der Zalm et. Al., today Marlin drives most of the world's 3D printers. Reliable and precise, Marlin delivers outstanding print quality while keeping you in full control of the process. Jun 25, 2020 New to PlatformIO and using a Mac with Visual Studio PIO install. How do I compile a.hex file to flash a Marlin build for a 3D printer and where do I find the file on my system? Sorry but I have tried google searches and this forum but nothing seems to make sense or work for me. If you have a helpful solution, please elaborate on steps as I think I am missing something along the way.
But didn’t you have firmware installed?
Yes, I had the TH3D firmware installed, but I had a huge problem; My prints were off-centre and printing half size in the Z-axis. It transpires that the lead screw was changed on newer Ender 5’s and the firmware I had, didn’t support that.
In mid-to-late 2019, Creality upgraded the base Ender-5 leadscrew to the same one used on the Ender-5 Pro which prevents the bed from dropping once power is cut.https://github.com/MarlinFirmware/Configurations/tree/import-2.0.x/config/examples/Creality/Ender-5
- For Marlin Firmware V1 you will need Arduino 0023 IDE to save, compile and upload to the 3d printer motherboard. In the following notes, to edit the firmware, I’ll be using line numbers to reference the location of the code in the Marlin firmware configuration file.
- Open the Marlin folder as your workspace. Compile your project, using the Build button. It may take some time as various components are download and compiled. You will now have compiled firmware, ready for use! You can find the compiled firmware in the main Marlin folder, inside an hidden folder: Documents GitHub Marlin.pio build jgauroraa5sa1.
Borked firmware
As someone who works in software development, I had a keen interest in the Marlin software, so I thought, rather than use someone else’s code I would compile my own. This turned out to be a harrowing ordeal…
Having compiled all my changes in version 2.4.4 of Marlin, I flashed the firmware to my Ender 5. It was only when I booted the printer to start a test print that I noticed the screen was completely blank. My intuition told me I had fudged something, so I tried to flash the board again. No change.
New bootloader
I had a gut feeling that the bootloader was probably the root cause, so I set out on a path to install a new bootloader. The problem was that my USBISP (that came with the BLTouch) wasn’t recognised on OSX and I didn’t have an Arduino Uno (which unfortunately is the only device 99.9% of YouTubers use in their videos).
After hours of searching (during the early hours while my son wouldn’t go back to sleep) I stumbled on this very poorly recorded video that was absolute gold. Here it is:
I had an Arduino Mega1248 from years ago… and it worked!
Again, during my early hour searches I found the following link. I wish I found this earlier:fwi_marlin_20_on_creality_115_silent_board
Operation “bull in a fridge” and the false success
For those of you who have tinkered with Marlin 2.0 you will know that getting it to fit on your Creality board with all the features you need is like trying to squeeze a bull into a fridge. When I added BLTouch, Auto Bed Levelling, Z safe homing and Slim LCD, I kept blowing the available capacity. I would get messages like this:
BTW, if you haven’t seen that message format before then, you probably aren’t using Auto Build Marlin with VSCode. If like me, you have spent an unreasonable amount of time messing about with Arduino IDE by installing U8Glib and finding Sanguino boards, then I highly recommend using this approach. The tool is built on PlatformIO, which handles all the libraries the project needs. There are 2 buttons; build
and upload
.
Finally, when I got a configuration that eventually fit, I uploaded it to the board and printed my first configuration cube. I have to be honest, the results were astonishing and made it all worthwhile. However, there was one big problem… I forgot to enable auto bed levelling…… fuck!
Operation OctoPrint
I had this on my list as a task to do later, but with my unsuccessful attempts at building a hex file small enough to live on the Ender 5 I was forced to bring this forward so that I could disable the SD slot and save space. I found an old Raspberry Pi 3B and installed octoprint on it. The best instructions I found are provided below. Note, at the time of writing, some of the options were obsolete.
Marlin 2.0.5.3 Update gives “err: EEprom Version”
So, with the OctoPrint build complete and tested, all I had left to do was compile the firmware with all of my configurations. Once the SD option was disabled I think the complete build was about 87% of total capacity. However, when I flashed the firmware I was greeted with the message err: EEprom Version
. As a Mac user I had a horrible time finding software that worked and allowed me to send GCode to my printer. In the end it was the terminal that won with the screen
tool.
You can use screen
for that. Open a terminal window and type screen /dev/ttyUSB0 115200
. The general form is screen serialdevice baudrate
. You will then see everything that the printer sends. Everything you type will be sent to the printer.
The only thing left to do was send an M502
followed by an M500
and everything worked perfectly. You can find the docs for these commands, here.
So that concludes my journey of running Marlin 2 on the Ender 5.
In this guide, I show you how to install Marlin 2.0 firmware on the Anet A8 or the Anet A8 plus.
Read the full transcript below if you prefer a written version.
Hello, my name is Daniel, welcome to the CrossLink channel. I would like to help you being more successful with 3d printing and if you're here for the first time, subscribe and hit the bell notification icon so you don't miss anything.
So why you should upgrade your firmware to Marlin 2.0?
First of all, enabling thermal runaway protection should be your main concern regarding safety features. Many printer manufacturers, still forget to activate this by default.
But you will also be able to unlock new features for your printer like mesh bed leveling for better first layer results or power loss recovery to resume failed prints or support for bed leveling sensors or linear advance for better print quality, just to name a few.
And in general with affordable 3D printers, it's like with affordable Android phones. Once they are released, it's very unlikely that the manufacturer will ever release a firmware upgrade and mostly the printers will ship with firmware that is already outdated when you buy it.
If you wanna learn more about the pros and cons of uprading to Marlin 2.0 vs. staying with an older version, watch this video here, where I elaborate in depth about this topic and more important things to know.
So, let's talk about the prerequisites for flashing Marlin 2.0 to this printer.
You will need to have a bootloader installed on your Anet mainboard.
Preferrably the optiboot bootloader that allows you to have more available program memory so you can flash larger firmware files that have more features enabled.
How Do I know, if I have a bootloader?
This question is really important because having a bootloader is a prerequisite to be able to flash firmware to your printer using just a USB cable connected directly between your computer and your printer.
So how can you know if your printer mainboard has a bootloader on it? - Actually you can't. It's not possible to tell unless you just try it out using the USB cable.
But the good thing is - you can't break anything physically by just trying it out.
I have made several videos to explain how you can flash a bootloader to one of these Anet boards. One method is explained in THIS video, which is how to do it with an Arduino UNO.
THIS other video explains, how to flash the bootloader using a cheap programmer device that you can get for under 10 USD with the required adapter.
I have linked all videos, I am mentioning here in the description of this video.
If you find out that you're not able to flash firmware using a USB cable, go and install a bootloader first and then come back to this video and continue from here.
Ok, with this out of the way, let's continue with the setup.
You need to download the Marlin Firmware from github to your computer, either on a Mac or PC. The github link is in the description of this video.
On the Marlin github page, first click on the Branch button and then select the bugfix-2.0.x version. We wanna make sure, we get the latest version with all the latest bugfixes.
Then, click on the 'Clone or download' button and select to download a zip file.
After that's done unpack the downloaded zip file into a folder on your computer.
Now there is one major thing that has changed since January 2020.
The printer specific configuration files that we need as a starting point - they used to be in this config folder of the Marlin repository - but they have been moved to another location - another github repository.
So what does it mean for you?
It means you have to go to this second github page, which is the Configurations repository.
Now, this is really important, don't just download a zip file from there without this next step.
Klick on the Branch button and select the bugfix-2.0.x version from that list.
Now, click on the 'Clone or download button' and select to get a zip file from there.
Inside of this second repository - once you unzipped it to a different folder on your computer - you will find the configuration files that you're looking for.
Marlin Firmware Upgrade
Navigate to the examples->Anet->A8 subfolder or the A8plus subfolder depending on the printer model that you have.
Copy all files from this folder into the Marlin folder that is located inside the Marlin repository. Make sure you confirm to overwrite all existing files.
In the previous guides to flash Marlin firmware, I have used the Arduino IDE for compiling and flashing Marlin firmware and this is still possible but the recommended way for the future is to use Visual Studio Code with PlatformIO, which I will show you in this video.
So, let's first make sure to install visual studio code from www.visualstudio.com.
Make sure you don't accidently select the full blown visualstudio for pc or visualstudio for mac if you're a mac user. Visual Studio Code is the thing that we need and that works.
After installing visual studio code, you need to launch it for the first time and open the extensions tab on the left hand side of the window.
In the search field, enter 'platformio' and then select 'PlatformIO IDE' from the results list.
Now, click the 'Install' button and wait until the installation process is finished. Don't launch any other installation at the same time and make sure, you don't close visual studio code until it's done installing.
There might be a message saying 'Please restart VSCode' after the installation. If you see this, please close Visual Studio Code and launch it again.
After the installation is finished, click on the extensions tab of visual studio code again and search for the extension 'auto build marlin'.
Install this extension by clicking 'install'.
Now, we are ready to do the final touches to our Marlin configuration before we will upload it to the mainboard.
First, open the Marlin folder in visual studio code by clicking the folder icon in the left menu bar and then clicking 'Open Folder'.
Navigate to the folder, where you have unzipped the Marlin files into, don't navgate further into any subfolder there and click 'select folder' to open it.
Now, you can already test, if everything is set up correctly and your're able to build the firmware.
Go to the left menu bar again and click the large 'M' button. This takes you to the Auto Build Marlin extension.
Here, hit the build button in the header of the upper section that is named 'Build…'. The buttons will show as soon as you move your mouse cursor into the section and will be hidden otherwise, so don't be confused if you don't seen them right away.
The build will then start in the terminal tab and depending on your computer's performance can take up to a few minutes. Especially in the first run, it will need to install several software packages from the internet, so please make sure you are connected.
After the build has finished, you will see a list of results. Please scroll up a little bit until you see the amount of program memory used by this build.
This will tell you how much memory you can still use for other features and the default configuration shows already, that there is not much room left, so we might have to address this later if we enable more functionalities than the available program memory can take.
For the starters, please at this point don't enable any additional features yet. I am stressing this in pretty much every video about firmware flashing because I like to test things individually and enable one feature at a time to be sure, I know what change in the configuration caused a particular problem during the build or upload process. So unless you already have some experience, keep the default configuration at this point and let's continue with that.
Now it's time to flash the firmware to your printer.
Turn your printer on and connect it to your computer using the USB cable.
Now, in visual studio code, in the Auto Build Marlin Tab, click the 'Upload' button.
After the build has been finished, the firmware will be uploaded to your printer and you will see that it is finished in the terminal tab.
Also, Your printer will be rebooting after the firmware has been flashed successfully.
Marlin Firmware For 3d Printer
Great, this is already a very important milestone. Now, we did not yet make any adjustments to the configuration. We will start doing this right now.
Navigate to the folder menu in visualstudio.
Expand the Marlin subfolder. You should see the Configuration.h and Configuration_adv.h files.
Open the Configuration.h file by clicking it.
I would suggest to enable a feature, which I use all the time on printers that don't have a bed leveling probe and that is Mesh Bed Leveling.
However, this guide will not explain how to use mesh bed leveling. I already published another video about this, it's linked in the info card up here.
Let's first start with enabling the MESH_BED_LEVELING feature around Line 1215 of Configuration.h.
By the way, if you can't find the option that I am referring to, because the line numbers might have changed in the meanwhile, try the search option using the Edit→Find Menu or the corresponding Keyboard shortcut. Enter the term you are looking for in the popup, so for example MESH_BED_LEVELING and use the arrow keys to navigate around, if there is multiple hits for that search term. And there you are.
Right below that in line 1221, enable RESTORE_LEVELING_AFTER_G28. This will make sure, that every time a print starts, your mesh bed leveling configuration is activated automatically, so it loads all the points that you have calibrated and uses them for the upcoming print.
Then jump to line 1333 and enable LCD_BED_LEVELING.
This will add a menu item to your printer's menu to be able to actually control and configure bed leveling using the printer menu.
Marlin Firmware For Mac Os
Good, now save your changes to this configuration file by using the File->Save menu item or the corresponding shortcut. You will see that once you have unsaved changes in a file, there will be a white dot nearby the file name in the open tabs. As soon as the file is saved, this dot will disappear.
Let's try to upload this new version of Marlin firmware to the printer by using the Auto Build Marlin menu again.
This was successful, so from here you could already start to print, however there might be situations where you run in to memory size issues, where all the features that you would like to enable will cause the firmware to grow to such an extent that it will not fit anymore into the available program memory.
This can happen for example when you like to install a bltouch probe with auto bed leveling and probably another better display.
I have written a blog post, that I've linked in the description of this video, where I break down all the potential features that you might at some point want to enable in Marlin 2.0 and what other features you could potentially disable to free up enough memory to be able to compile the firmware.
So if you encounter an error that tells you The program size is greater than maximum allowed, refer back to that blogpost for more information how to fix it.
If you like this video, please do me a favor. I appreciate if you hit the like button or subscribe to my channel - BUT - the real way, how you can support me is - Go watch some of my other videos that I have linked here in these two cards. Thanks for watching, see you next time.
You might see that after the reboot you get an error message on your printer's display saying 'Err: EEPROM Version'.
This happens when you upgrade from an older version of Marlin firmware to 2.0 and you can resolve it quickly by entering the printer menu, then going to the configuration menu and finally entering the Advanced Settings menu. Scroll down to the bottom until you select the 'Initialize EEPROM item'. You then have to highlight the Init item, using the up-down buttons and finally click the middle button to confirm it. There will be no visual confirmation unfortunately.
Power off your printer and power back on to see whether this was successful. Now you should get 'Anet A8 ready' instead of the error message.
Marlin Firmware Configurations
If you run into issues like this one saying that the port has been detected but there is still a not in sync problem, this is an indication that your bootloader needs to be re-installed. Please install the optiboot bootloader using one of the instruction videos, I have linked in the video description.