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.


  • 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.


  • 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

    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.
    • Correct fuse settings: If you are using other software than AVRDUDE to upload the firmware make sure you are using the correct fuse settings. Apparently the Creality tutorial has the wrong settings and the board fails to boot afterwards.
    • 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


    Other Marlin downloads for Ender 3

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

    Post Categories


    Submitted by Maarten Brichart on Sat, 03/21/2020 Permalink

    Hi, i flashed the firmware. Menu's and all ok. All the commands for the bed leveling sensor work. but when homing it homes X and Y perfectly but then stops and tells me home Z first. the Z axis does not move. the sensorprobe tries to tho

    Here download links for the version of Marlin

    Please note that due memory limitations it has less features than the 2.0.1: custom menus, boot screens, status screen and status/filenames scroll. If you are looking for the maximum amount of features please check the Ultimate version.

    I have question. I have TMC board+BL touch. After flash to I go to menu and use Auto Home. After this I go to Move Z and set 0. Now I go to Menu/Configuration/Z Probe and adjust end. Store setting. After print my printer always have 0.2 and print in air not to bed. What I do bad?

    I will need more information to knwo what's happening...


    1. Take a note of the final offset you got.
    2. Reset the EEPROM.
    3. Level the bed.
    4. Home the bed.
    5. Insert the Z offset you wrote down.
    6. Save the settings.
    7. Reboot the printer.
    8. Check if the offset is there and report the results back to me.


    Do not print anything between the steps 1 and 8.


    Submitted by Nicolas on Tue, 03/10/2020 Permalink


    You put different HEX for standard and silent board.

    So I imagine the source code is different and i would like to know if it's possible to have a link to download source code marlin 2.0.1 for ender 3 TMC2208 + bl touch  (i have an ender 3 with silentboard creality 1.1.5 + bl touch 3.1 official)


    Source code is the same for both files. To enable TMC drivers edit configuration.h and replace the driver type from A4988 to TMC2208_STANDALONE as follows:

    #define X_DRIVER_TYPE TMC2208_STANDALONE //Customized DBP
    #define Y_DRIVER_TYPE TMC2208_STANDALONE //Customized DBP
    #define Z_DRIVER_TYPE TMC2208_STANDALONE //Customized DBP
    //#define X2_DRIVER_TYPE A4988
    //#define Y2_DRIVER_TYPE A4988
    //#define Z2_DRIVER_TYPE A4988
    //#define Z3_DRIVER_TYPE A4988
    //#define Z4_DRIVER_TYPE A4988
    #define E0_DRIVER_TYPE TMC2208_STANDALONE //Customized DBP


    Submitted by Daniel. on Sat, 03/07/2020 Permalink



    I want to thank you for the amazing changes you have maked. I've compared the files with the newest version of Marlin en changed them in the new version. Probing takes forever but it works so much better than everytime when you start a print and is super precise. I created a version for an Ender 3 and a Tronxy X1. I want to thank you.

    Submitted by Steve on Sat, 03/07/2020 Permalink

    Thank you for the time and work you put into pulling this all together.

    Submitted by Eloy on Wed, 03/04/2020 Permalink

    First of all thanks for compiling this marlin.
    I have tried your version with the creality 1.1.5 silent board and it seems to run well.
    Maybe it is me, but I think that the steppers are a bit noisier than my previous 1.1.x marlin.
    I miss the option of configuring the e-steps of the axis and the extruder in the LCD menu. Could this be fixed in the marlin? right now I don't know how to compile my own marlin.
    The other thing it is that when I do the bed leveling procedure the 5x5 grid is not correctly aligned all the grid is displaced to the left a few cm, leaving like 1/5 of the right bed without probing.

    This version uses "slim" LCD menus to fit in the board memory. E-steps can be set using the following code where the 99 should be replaced by you actual steps.

    M92 E99

    The alignment of the grid is related with the way Marlin 2.0 reads and uses the probe offsets. You can change it by adjusting the X offset:

    M851 X-42 Y-5 Z0



    I would like to flash directly the .hex files but the probe offsets aren't correct. I have the original Bltouch 3.1 ordered on the Creality store (see picture below) the probes are : "X-45 Y-6 Z0":

    Original Bltouch mount

    Is it possible to upload the .hex file with this offsets with silent boad parameters too?


    Thanks for the reply!


    Submitted by Steve on Wed, 02/19/2020 Permalink

    just installed a BLTouch v3.1 and I'm using the Petsfang V2 mounting bracket on the left side of my Ender 3.  I have tried many times to add the offsets for the probe to the firmware but no luck compiling a viable HEX file.  I think this is why I'm getting so many probing failures.  According to the post on Thingiverse, these are the offsets:

    v2 BLTOUCH........................X......-42................Y......-5

    Could you compile your HEX file to include these offsets?  

    Submitted by Ben on Sun, 02/16/2020 Permalink

    Before i begin, thank you so much for putting your time and effort on all of this.


    The problem i'm having is that i flashed it perfectly and did everything right but when it finishes to level the bed, it gives me an error saying "maxtemp:bed printer halted"
    I checked the sensors and all are working fine, reflashed and still doing the same. I even just leveled it with the minimal temps on the bed and its still saying that error.

    Any ideas what it can be? (note this happens with the normal level bed way or the custom command way)


    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?


    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.


    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


    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. 


    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.



    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 ?