Skip to content
GEEKnodes

3D printing · Updated on

How to Configure and Compile Marlin 2 for the Ender 3 SKR 1.3

Compile Marlin 2 for an Ender 3 with an SKR 1.3 board and TMC2208 drivers using VS Code and PlatformIO: configuration, LPC1768 environment and microSD flashing.

After swapping the stock board on my Ender 3 for a BIGTREETECH SKR 1.3, the next step was configuring Marlin, the firmware that runs the printer. The new board is useless without firmware compiled for it: you have to tell it which board it is, which drivers it has, which display and which thermistors.

When I wrote this guide in 2020 I used Marlin 2.0 with the Atom editor and the PlatformIO plugin. Atom was discontinued in 2022, so I’ve updated it to the method the Marlin documentation recommends today: Visual Studio Code with PlatformIO. The files and paths are the same, so my screenshots still work as a reference.

Requirements

1. Install VS Code and PlatformIO

  1. Install Visual Studio Code.
  2. Open the Extensions view and install PlatformIO IDE.
  3. Optionally, install Auto Build Marlin: it adds buttons to compile and picks the board environment for you. When you open the Marlin folder, VS Code usually suggests it.

The first time, PlatformIO takes a few minutes to download its tools.

2. Download Marlin and the example configuration

  1. Download the latest stable release of Marlin from marlinfw.org or from its releases on GitHub. In 2020 I used 2.0.x; today the stable branch is 2.1.x.
  2. Also download the example configurations (MarlinFirmware/Configurations) for the same version as Marlin. Mixing versions is the number one cause of compile errors.
  3. Unzip Marlin and open the folder that contains platformio.ini in VS Code (File › Open Folder).

Inside you’ll see the Marlin/ folder with the two files you’re going to edit: Configuration.h and Configuration_adv.h.

Marlin 2 folder structure with Configuration.h and platformio.ini (2020 screenshot) Marlin Configuration.h file open in the editor (2020 screenshot)

3. Configure Marlin for Ender 3 + SKR 1.3

The official examples don’t include a specific folder for the Ender 3 with an SKR 1.3, so the most practical approach is to start from config/examples/Creality/Ender-3/CrealityV1/ (the stock board), copy its two files into Marlin/ and change everything that depends on the board. If you want to compare, the BigTreeTech SKR 1.4 folder is the closest match.

Diagram of a printer connected to the SKR 1.3, with four TMC2208 drivers for X, Y, Z and E.
The Marlin configuration has to match the board and its drivers.

In Configuration.h:

#define MOTHERBOARD BOARD_BTT_SKR_V1_3

#define X_DRIVER_TYPE  TMC2208
#define Y_DRIVER_TYPE  TMC2208
#define Z_DRIVER_TYPE  TMC2208
#define E0_DRIVER_TYPE TMC2208

#define CR10_STOCKDISPLAY   // stock Ender 3 display

Also check:

  • TEMP_SENSOR_0 and TEMP_SENSOR_BED: the thermistor type. If you swapped the hotend for a V6, check which one it has.
  • Motor direction (INVERT_X_DIR…): with TMC drivers you usually need to invert one or more compared to the stock board.
  • If you’re fitting a BLTouch or 3DTouch, the probe section (BLTOUCH, NOZZLE_TO_PROBE_OFFSET, AUTO_BED_LEVELING_BILINEAR…).

Configuration_adv.h holds the driver current for UART mode: X_CURRENT, Y_CURRENT, Z_CURRENT and E0_CURRENT, in RMS milliamps. Start from the example values and adjust them for your motors; don’t copy numbers blindly.

In platformio.ini, the environment for the SKR 1.3 is LPC1768:

default_envs = LPC1768

4. Compile

Start the build from PlatformIO › Project Tasks › LPC1768 › Build, from the icon in the bottom bar, or with the Auto Build Marlin button. In 2020, with Atom, it was the PIO Build (LPC1768) menu; the result is the same.

Marlin compiling for the SKR 1.3 (2020 screenshot)

When it finishes, SUCCESS should appear in the Terminal tab.

5. Install the firmware

The resulting file is at .pio/build/LPC1768/firmware.bin.

Installation sequence: compile for LPC1768, copy firmware.bin to a microSD card and update the board.
The board renames the file to FIRMWARE.CUR when it installs the firmware.
firmware.bin file in Marlin's .pio/build/LPC1768 folder
  1. Copy firmware.bin to the root of the microSD card (FAT32).
  2. With the printer off, insert the card into the slot on the SKR 1.3.
  3. Turn it on. The board installs the firmware in a few seconds.
  4. If the file is named FIRMWARE.CUR when you take the card out, the update worked.

Check that it works

  • Send M115 from a terminal (OctoPrint, Pronterface…): it shows the compiled Marlin version.
  • M122 shows the status of the TMC2208 drivers; none of them should report a communication error.
  • M502 followed by M500 loads the new firmware’s values into EEPROM, so they don’t get mixed up with the old ones.
  • Move each axis and home the printer (G28).

Common problems

Compile error mentioning the Configuration.h version. The configuration files aren’t the same version as Marlin. Download the examples from the matching tag.

The board doesn’t update. The microSD card isn’t FAT32, the file isn’t named exactly firmware.bin, or you put the card in the display’s slot instead of the board’s.

The display shows nothing. CR10_STOCKDISPLAY is missing or the cable is in the wrong EXP connector.

The motors make noise but don’t move, or move backward. Check the *_DRIVER_TYPE and INVERT_*_DIR settings.

PlatformIO can’t find the environment. You opened the Marlin/ subfolder instead of the root folder that contains platformio.ini.

What about Klipper?

These days many Ender 3 owners use Klipper instead of Marlin. Klipper splits the work: a computer (usually a Raspberry Pi) calculates the movements and the board just executes them. It adds features like input shaping and pressure advance, and you edit the configuration in a text file (printer.cfg) without recompiling. The SKR 1.3 (LPC1768 microcontroller) is supported, and the project includes an example configuration for it. If you already have a Raspberry Pi running OctoPrint, it’s worth considering; if you want something that runs on the board alone, Marlin is still a perfectly good choice.

Comparison: Marlin calculates and controls from the board; Klipper calculates on a computer and controls from the board.
Klipper splits the computing between a computer and the printer board.

Process video

Gear used

Creality Ender 3 Ender 3 on AliExpress

Accessibility preferences

Quick profiles

Text and reading

Text size
Default
Line height
Default
Letter spacing
Default
Word spacing
Default

Colour

Motion and orientation

Cursor