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

    Submitted by Paulo on Tue, 03/31/2020 Permalink

    Olá Daniel,

    Recentemente adquiri uma placa V1.1.5 para minha Ender 3. Tenho um BL Touch genérico (3D Touch) e por isso sai em busca de um firmware compatível, foi assim que cheguei ao seu site. O que está acontecendo é que quando tento executar a gravação, tanto pelo VS Code quanto pelo AVRDude simplesmente fica tudo "congelado". 

    Eu já tentei de tudo: reinstalei novo bootloader tanto pelo Arduino quanto pelo Raspberry PI, tentei outras versões de Fw, tentei usando outras portas USB do meu note, tentei com outro note. Já fiz com a impressora ligada, com a impressora desligada e nada...

    Será que eu matei minha placa?

    Agradeço por qualquer outra dica que você possa me dar.

    Obrigado,

    Paulo

    Olá Daniel,

    Descobri que o problema está em meu notebook. As portas USB só estão servindo para carregar celulares e ler pendrives, qualquer uso além destes fica congelado. Utilizando um notebook "zerado" funcionou perfeitamente. Meu note é um guerreiro, mas já está dando sinais de cansaço.

    De qualquer forma agradeço muito sua atenção e o trabalho realizado e disponibilizado por você. Gostaria de saber se você pode disponibilizar o código fonte usado para gerar o HEX do firmware compilado para TMC2208 + BLTouch.

    Muito obrigado,

    Submitted by Clive Galway on Tue, 03/31/2020 Permalink

    Hi, I used the precompiled HEX file of this build for a while, served me well, many thanks!

    However now I am tinkering with building my own versions of Marlin, but one thing that was in your build I do not know how to get back...

    When adjusting Z Probe offset via LCD menu, in your version this actually moves the Z carriage up/down as you adjusted the value - I found this very useful as I would G28, then move Z axis to 0, then use the Z offset setting to tweak it such that it just gripped a piece of paper - found it to be very quick and simple. In my own builds however, altering Z probe offset does not seem to move the carriage up/down as you adjust it

    Is this something you enabled? If so, can you tell me what it was?

    TIA

    Submitted by SiXiS on Sat, 03/28/2020 Permalink

    Don't know what i'm doing wrong, as soon as i enable tmc2208_stanallone there is not enough space

    Der Sketch verwendet 130518 Bytes (100%) des Programmspeicherplatzes. Das Maximum sind 130048 Bytes.text section exceeds available space in board
    Globale Variablen verwenden 4751 Bytes (28%) des dynamischen Speichers, 11633 Bytes für lokale Variablen verbleiben. Das Maximum sind 16384 Bytes.

    in 2.0.5 and also in 2.0.4.4 version

    Please help

    In menu I set 0.2+2.4 i my measuring and nothing. Z Probe on LCD show 2.60 but in print same value. Without change. I got meny error messages from this FW. Like temp error. Z error and another. For me its not usable. :( Do you have somebody last version with BL and TMC? 2.0.5.2 on new? Or do you have only configs to marlin?

    The 2.0.1 version works with all boards with or without TMC drivers. It's pure Marlin firmware with no code modifications. If you are getting temperature errors you have a hardware problem, it's not the firmware.

    I made available the 2.0.5 version, see the comments below. You will have to compile for TMC drivers but this does not take more than 5 minutes.

    Regards,

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

    Regards,

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

    Hi,

    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)

    Thx

    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

    Hi,

     

    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
    M500

    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
    M500

     

    Hello,

    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)