Marlin 2.0 Firmware configured for Ender 3 + BL Touch

This is the vanilla version of Marlin Firmware 2.x pre-configured for Creality Ender 3 printers with original or generic BL Touch sensors. The standard configuration file from Marlin distribution was carefully reviewed to include the latest Ender 3 specific settings from the official Creality firmware and from Antclabs.

Please note that this is not the version I recommend for 8-bit boards like the one used in the Ender 3. The most stable and feature rich version of the firmware for this architecture is the 1.1.9 that I made available in another article. Marlin 2.x is aimed to a new generation of boards using 32-bit processors, the built in libraries are bigger and there is less space left for features. Anyway, if you want to try this you can be sure I did the best I could to configure it properly and fit the maximum amount of features possible. It was downloaded and installed more than 10000 times and I believe most of the users will find no problems with it.

Features

  • Official "vanilla "Marlin firmware with all hardware settings from Creality latest official firmware.
  • The maximum amount of Marlin features that I was able to fit in the small 128KB memory.
  • BLTouch original/generic versions enabled by default. Compatible with BLTouch versions from 1.0 up to 3.x
  • No need to remove any capacitors from the board
  • Installs from the PlatformIO IDE that runs in several operating systems
  • Source code modified to prevent releasing the BLTouch sensor during "beep" events triggered by LCD menus
  • Thermal runway protection enabled
  • Does not reset the bed level settings after the G28 (Home) command
  • Custom menu with maintenance mode, emergency mode and full auto bed leveling sequence (warmup, wait, home, level and then save settings)
  • Ultra-precise bilinerar bed leveling algorithm with 25 probing points, 3 slow probes per point (takes about 10 minutes to complete)
  • Run and toggle the bed level and BLTouch tools from LCD menus
  • Tuned PIDs for faster heating
  • M503 enabled (reports all printer settings)
  • Baby steps enabled and configured for the stepper driver "Magic Numbers"
  • Fully compatible with OctoPrint
  • All changes from the original Marlin config file were marked with the comment tag "Customized DBP"
  • Due memory size limitations, the power resume function was disabled as well as the arc support
  • LCD menus were changed to "slim mode" to save memory space
  • Optional compiled files ready to upload to the board (no configuration, no compilation, no installation of any tools):
    • Creality standard board
    • Creality upgraded boards with TMC silent drivers (like the 1.1.5)

Note about the bed leveling strategy

There are two ways to perform the automatic bed leveling, the first is before every print and the second is only when necessary. Based on my experience with the Ender 3, it's better to do an extremely precise (slower) bed leveling when necessary than a simpler one before every print. This firmware configuration reflects this choice.

If you want to do quick/imprecise bed leveling before every print you will need to reconfigure the firmware.

Requirements

  • BLTouch installed on pin 27
  • Z stop switch removed (it can block the Z axis movement)
  • IMPORTANT! BLTouch tip height must be adjusted according to the official instruction manuals. There are different BLTouch sensor clearences and the YouTube videos tips are wrong most of the times
  • Bootloader installed
  • Microsoft Visual Studio Code if you plan to install from the source code
  • PlatformIO IDE extension installed on Visual Code if you plan to install from the source code

    Instructions for installation from the Source Code

    1. Download and install Visual Studio Code.
    2. From Visual Studio Code extension menu, install the PlatformIO IDE.
    3. With all requirements running, unpack this entire Marlin source code downloaded from the link below to a folder.
    4. From Visual Studio Code select File->Open folder and select the folder where the platformio.ini file is located. Attention! Use the "open folder" command, not the"open file".
    5. Look for the configuration.h inside the "Marlin" sub-folder and edit the following configuration to the relative coordinates of your BLTouch mount to the Nozzle. This does not need to be too precise, the only purpose is avoiding the probe to test outside the bed. The default settings X = -42mm, Y= -5mm and Z=0 are for this mount:
      #define NOZZLE_TO_PROBE_OFFSET { -42, -5, 0 }

       

    6. Save the file and then select Terminal->Run Task->Build . It will take a few minutes for the system to download all dependencies and compile the code.
    7. If the code compiled properly you will see something like this in the terminal: "=== 1 succeeded in 00:00:30.050 ===".
    8. Connect your printer to the computer using the USB cable.
    9. Go to the Visual Code menu Terminal->Run Task->Upload .
    10. If everything goes well another message like this "=== 1 succeeded in 00:00:55.010 ===" will be printed.

    Installation using the pre-compiled HEX file

    The pre-compiled firmware is also available here. You can simply burn the compiled HEX file directly to your Ender3 board without installing the Visual Studio Code or PlataformIO.

    To upload the pre-compiled firmware you will need the AVRDUDE 6.3 tool. For your convenience I included the Windows version of this tool in the zip file that contains the HEX firmware but the tool is also shipped with the Arduino IDE and PlatformIO. The upload command in Windows PowerShell should look like this:

    ./avrdude -p atmega1284p -c arduino -P COM3 -b 115200 -v -U flash:w:firmware.hex:i 
    

    The serial port is something between COM1 and COM8, depending on where the USB driver is pointing to, and firmware.hex is the file you are uploading. If you are using other operating system like Linux the port address will be somehting like this /dev/ttyUSB0.

    After initializing the board with the new firmware don't forget to reconfigure the probe offsets running the following command from any serial terminal. Replace the default offset values in the command (-42, -5, 0) with the ones for your probe mount.

    M851 X-42 Y-5 Z0
    M500

    Post-installation configuration

    1. Manually pre-level the bed! This is important because the BLTouch has limited max/min detection ranges and the print quality can be affected if the Z-Axis moves too much.
       
      1. Cool down the bed and the nozzle. Heating should have little to no effect on this specific procedure.
      2. Disable stepper motors using the LCD menu command.
      3. Place a credit card on one the bed, the thickness of the card will be used as a reference distance.
      4. Turn the Z axis with your hand until the nozzle hits the credit card.
      5. Move hot end to several positions of the bed, starting from the 4 corners. For each position, adjust the bed level knobs to keep the nozzle at the credit card thickness distance from the nozzle. This is what you would do in manual calibration but instead of using a paper you will use the card for convenience. The card thickness does not matter because the BLTouch probe will redefine the Z reference.
         
    2. Heat the bed to the printing temperature and run the bed level command from the LCD (Motion -> Bed Leveling -> Level bed)  or using the G29 gcode or using the Heat and Level command from the custom menu (recommended). Note that the Heat and Level command waits 2 minutes after the bed is hot to allow the mounted surfaces to expand/contract properly.
    3. Save the settings using the LCD menu or the M500 gcode (if you used the Heat and Level custom command, they will be automatically saved).
    4. Add the following gcode to the startup code of you slicer, right after the line of the G28 command to load the bed level configuration from the memory before every print:
      M420 S1

       
    5. After enabling the bed level, print something large and flat to adjust the Z offset. The nozzle will always be far from the bed until you adjust the offset to a negative value (LCD -> Configuration -> Probe Z Offset). Don't forget to save the settings after the print to keep the offset in the memory.

    Custom pre-compiled firmware versions for different BLTouch mounting brackets

    If you have a different bracket for BLTouch and would like me to pre-compile the firmware for you please let me know in the comments below. The compiled firmware will be available for everyone so I need detailed information about the bracket manufacturer/model or the link to the site hosting the STL files.

    Troubleshooting tips

    • Disable serial port clients before flashing: If the COM ports are used by any other app, the flashing process will fail. Shutdown Cura, OctoPrint, any other slicer and any other Serial Monitor program like the Arduino IDE before compiling/flahsing the new ROM.
    • Reset the EEPROM: Sometimes the EEPROM memory is not reset during the Marlin reflash and this can cause problems. To reset manually use the following G-Codes from any Serial Terminal: M502 followed by M500.
    • Blank screen after flashing: You did not flashed the firmware properly. Please use AVRDude according to the instructions above and if this does not work you might have to reflash the bootloader.
    • Optiboot bootloader: To compile/flash the firmware forcing optiboot support, edit the file platformio.ini and replace the lines default_envs = melzi or default_envs = sanguino_atmega1284p with default_envs = melzi_optiboot . If you flashed your bootloader with Arduino IDE, that uses optiboot by default, you don't need to update this setting, it works perfectly out of the box.
    • Serial Port Monitor for Windows: This small program allows you to send/receive GCode to the printer. If the characters look strange you are probably using the wrong baud rate (start with 115200bps).
    • avrdude: stk500_getsync() attempt 1 of 10: not in sync: Wrong baud rate for the serial port or serial port already in use (OctoPrint, Cura, etc..). Try configuring the upload rate to 115200bps. If you are using PlatformIO to upload, make sure you are using the correct baud rate for your environment in the platformio.ini file.
    • Reconfigure the BLTouch probe offsets: Use the following command replacing the -42, -5 and 0mm coordinates with the offsets of your actual mount:
      M851 X-42 Y-5 Z0
      M500

       

    Ultimate version for PRO users

    For power users that rely on OctoPrint for managing the workflow I created this ultimate version of the Firmware that packs the maximum amount of features the printer can handle at the expense of the SD Card support.

    Files
    Version
    Marlin 2.0.1 (January/2020)
    Platforms
    Any operating system
    File size
    5.1 MB (source), 450 KB (HEX)
    Checksum
    Package 1 SHA256: 770FA69E3F5A694C41521CBE307EA9B6CC73CCCAE7494669EF93B87D68D0DE9E
    Package 2 SHA256: E557C4E5CA17BE436BEE977DA3C864734C66516A0D5608841A6C4DBF47201509
    Package 3 SHA256: 96242782112FBE50EE206EA826FBDB38B22DB342D020E83C947109EDEC36B61A
    Screenshots

    Post Categories

    Comments

    This error happens if the temperature of the bed reaches 125°C. Since the bed PID control is not enabled, any spike in the reading will cause the printer to halt. If the bed is always at low temperature (60°C) you might have the firmware configured for the wrong probe type, a short-circuit or EM noise.

    Before doing anything, try resetting the EEPROM: M502 followed by M500. I am not sure if the firmware supports soft limits and this would definetly reset the limit to 125°C.

    Hi Daniel,

     

    Turns out it was badly flashed (my mistake...), flashed it correctly with the precompiled firmware using the USBISP from creality on settings DC D6 FD and its perfect now! Thank you!

    Ohh and for anyone reading this with what i have (glass bed, new springs, bltouch 3.1 and everything configured) and using Cura 4.4, make sure you set the X and Y offset on it. The print was coming very off from the center but i managed to balance it by setting X: -5 and Y -8.5, it now prints in the center.

    Submitted by ambrosv on Sat, 02/15/2020 Permalink

    I just flashed your firmware and the only issue i have is when i power it up the screen is blank.  I have to power it down and power it back up a few times before anything shows up on screen.  Once I get a screen everything seems to work correctly.  Appreciate your work and help in advance.  

    Submitted by Casper on Thu, 02/13/2020 Permalink

    First off, thanks for all your work on this. 

    I think I installed everything correctly. installed the bootloader from ISP, then flashed with vcode using the marlin configuration provided here, both the regular and ultimate. I can run the g28 and g29, without problem. I get some significant variances between the 9 spots checked in g29. When I go to print anything the z-axis it starts too high in the front, then catches near the middle and finally digs into the print bed about 3/4 of the way through. In my slicer, Cura, I see there are some commands that use the z-axis position, example: G1 X0.1 Y200.0 Z0.3 F1500.0 E15. I'm assuming the z-axis reference should not be there since the printer due to the auto mesh leveling. when I remove z-axis references the z-axis does not move from it's current position. no matter what it is. I've been working on this for 3 days now, I'm about to send the bltouch back and hope I can get the old way to work again. Anyone have any advice as to what I'm doing wrong or missing?

    Hi,

    The commands you see in Cura will later be adjusted be the firmware to include the proper Z offsets according to the bed level grid.

    From what you described I would investigate the following possible causes:

    1. Make sure you have the proper height between the BLTouch probe tip and the nozzle tip. Every BLTouch version requires different clearances and I've seen several YouTube videos reporting the wrong values.
    2. Make sure you manually pre-leveled the bed before running the automatic bed level according to the instructions above. BLTouch has a limited action range and if a part of the bed is too far or too close to the probe it will report garbage data.
    3. Make sure your BLTouch wiring and connectors are OK. If any connection is lose the board will not be able to read the data properly.
    4. Run the G29 command from a Serial Terminal and check for errors.

    If nothing works you probably have a faulty probe.

    Thanks! I will try these when I get home. I don't think I did the bed leveling first, which is probably the step that's causing my issues. all the attempts are running together so I think I'll reset everything to stock, then install marlin again. then bed level, then try g29.

    g29 runs fine right now, just doesnt seem to do anything other than report the 9 variances. /shrug.

    thanks!

    I reflashed the board. installed new marlin. manually leveled the bed at -2.24, sent commands through the terminal. Ran g29, got reasonable values back. m500 to save them. then ran G1 X10.1 Y200.0 Z0 F1500.0 E15, which tried to print in the air above the bed. changed it to G1 X10.1 Y200.0 Z-2.24 F1500.0 E15 it tried to print but the offset is a bit too low. I tried making changes to the firmware before upload and nothing will compile. I've tried VS Code and arduino..Doesn't seem like it should be this hard but I am obviously out of my depth.

    Now to figure out how to reset it all back to factory settings.....hopefully I can get this to work otherwise I have an expensive paperweight.

    I ran

    g28

    g1 z0 after g28 it put the nozzle up super high so I, thought,  had to move it to 0

    then leveled the 4 corners  and center as if i were a manual leveling bed which is moving the bed and nozzle to the corners and middle and using a piece of paper. I did not put it so low to catch but just enough that it was close (I didnt have a credit card or anything of similar width at the time). 

    then when I tried to run a test print from Cura, it tried to lay down the primer line, then tried to print way off to the left side, causing the machine to lock up. 

    Thanks.

    The left limits are defined by the X end stop switch. If the mechanical switch is working the car can't crash.

    I recommend you to double check the electronic connections.

    By design the nozzle will always be distant to the bed after the calibration and you must set the Z offset from the LCD menu to a negative value to move it closer.

     

     

    I think I've misunderstood the zoffset from the beginning. I thought the offset was to say how far from the probe the nozzle was, and most values I've seen online are around -2. if i do it from where the nozzle stops after homing, mine would be -18 or so. isnt that odd?

    If you are using Bltouch and Ender 3 the Z offset in the firmware code should always be zero.

    The physical Bltouch retracted/extended height difference from the nozzle must be within the specs in the Bltouch manual. You can adjust that using washers or different brackets.

    If everything is alright the Z-Offset from the LCD menu should be something between - 0.2mm to - 2mm.

    Regards

     

    Thanks for all your help! I've decided to get rid of the probe and continue to do it manually. no matter what I did the nozzle was always 2-4mm above the bed. setting the z-offset and saving, did nothing. after homing it would, again be at 2-4 above. so each time the z-offset kept getting bigger. /shrug

     

    anyway, thanks a lot!

     

    Submitted by Ragpuss on Fri, 02/07/2020 Permalink

    I am using platform in VS code and have built the firmware easily enough but when I try to upload I get avidude sync errors, I think maybe the boot loader I had has been corrupted or over written somehow ?

    Is there a way to export the build file as a hex so that I can upload using my boot loader interface board that came with my BL Touch ?

    or could you please make me a hex using your 2.x for bl touch 3.1 with -50 -8 0 offsets and max temp of 285 ?

    Thanks for any help

     

    The recently compiled firmware can be found inside the hidden folder named .pio/build/melzi  that is automatically generated inside the main project folder. If only the upload failed you will be able to find the firmware.hex file ready to be flashed.

    If you compiled Marlin 2.0.1 the folder name will be .pio/build/sanguino_atmega1284p

    Thank you, I found it,

    is there an easy way to add a boot loader to the ender 3, reading online seems to assume that I am knowledgable about Linux, which I'm not , it would be nice to be able to flash via USB in the future, at least until I upgrade to a 32bit board ?

     

    I used my ardinio and some googling and managed to install the boot loader (YAY) :)

    Tested it using PlatformIO by editing some FW and then uploading and now all working,

    Thank you for your help.

    I tried to add a small menu item but it took the FW over size, do I need to just disable 1 menu item in order to add a different one  or are all the sizes different ?

    thanks,

     

    For power users that use OctoPrint for managing the prints I released the Ultimate Marlin 2.x version. This version does not support the SD Card reader but includes several features like the S-Curve Acceleration Feature and Adaptive Step Smoothing Feature both should improve the print quality and reduce the noise.

    Submitted by Liz on Mon, 02/03/2020 Permalink

    First - let me say THANK YOU. I've been messing with this thing forever and was about to give up!

    After manually leveling and then running Heat and Level, am I crazy or can I no longer see the default menu items (like Disable Steppers, Move Axis, Auto Home...?)

    Remember that this is Marlin 2.0 and the menus are slightly different from 1.1.x. The items in the former "Prepare" menu are now distributed in the "Motion" and "Temperature" menus.

     

     

     

    Submitted by Ragpuss on Sat, 02/01/2020 Permalink

    Great Firmware , I have run the hex as is for a couple of weeks and working well.

    can you add a compiled hex for BL Touch with a V6 hotend fitted with the Hero Me double 1510 fan mount ?

    I can find the offsets etc' if you don't have them, there were a few alterations needed with the steps, temps, etc' I pretty new to 3D printing and trying to learn about the coding but not there yet.

    Also is it possible to enable the M600 function ?

    Thank you in advance.

     

    You need to measure the offsets for the BLTouch using a ruler. The extruder steps and temperatures can be adjusted from the LCD menu, no need to hardcode in the firmware.

    M600 requires Advanced Pause feature that requires Nozzle Park feature. With all that enabled the firmware does not fit the small 1284p memory. Disabling the SD card would free enough memory for both features but I belive the best option is use the slicer filament replace command.

    Thank you for your reply,

    I will work out those off sets and re-post.

    I use a Pi with Octoprint for uploading my prints so not really using the SD however is there anything else that would give the room ?

    Thanks again.

     

    No. The Ultimate version is optimized for using less processor cycles and has advanced movement smoothing features enabled.
    I recommend you to start using this version and move to the Ultimate only when you are very familiar with your printer otherwise it is very difficult to differentiate hardware/calibration problems and firmware glitches.

     

    I do have that add-on but I have found it hard to change colour part way through a print and then successfully resume, maybe me doing it wrong but that add-on also has the M600 command in place which is much easier but needed the advanced pause etc' to be enabled.

    Thank you again for your time and great work :)

     

    I just installed this and all seems well, a few things in the LCD that I need to learn about, lol

    The only thing so far that I am having a problem with is the maximum temp' I can't get it past 260 but the E3D V6 want it to be 285, can I c change that somewhere or is it a FW only setting ?

    Thanks

     

    You will have to change the temperature limits in configuration.h : #define HEATER_0_MAXTEMP 275 and recompile the firmware (takes less than 5 minutes).

    Please doublecheck if your board can handle the increment of power. Ender-3 boards are not designed for high power outputs.

    I tried running a build after some mods on this 2.03 ultimate firmware but platformio shows an error as soon as the build starts.

    The error is something about the environment name, like, "Melzi \\ custom..... "

    Have you had the same error ?

     

    The error I'm getting is in the platformio.ini file,

    the environment shows Melzi  #// Custom DB

    If I change this line to just Melzi then it works

    is it ok to do this or is that there for a reason ?

    thanks

     

    I got it to install and all seemed good until I tried the auto bed levelling when it came off of the front of the bed by about 10mm ?

    I have the offsets the same as what work with the 2.01, is there something else in this Ultimate version that needs changing or do I need different offsets for some season ?

    Thanks,