MKS Gen 1.4 board with TMC2130 and Marlin firmware – howto

I wanted to change my Infitary HiB3 stepstick drivers with TMC2130, mostly to get it working more quietly but also because the perspective (meaby someday…) of other nice features of Prusa i3 MK3 where appealing. Sadly Infitary has all motor drivers SMD soldered so I had to get everything new. I ordered (what seems to be the best value-money choice) Chinese MKS 1.4 board and pack of 5 TMC2130 v1.1 stepper drivers. The only difference (except the price ;)) between Chinese 1.0 and 1.1 TMC stepsticks is that 1.0 are soldered to be used without SPI feedback data. You could change them manually from 1.0 to 1.1 (you would need to resolder 3 jumpers and change side of 4 connectors – see picture), but I assumed it’s too much hassle and I went with 1.1 directly

The MKS 1.4 board is a simple ATmega2560 board with RAMPs 1.4 compatible connectors. It’s nice all-in-one solution, with almost everything you could possibly need for cheap 3d printer and a bit more:

  • You can power it up with 12-24V power supply,
  • you can have 3 axis drivers, 1 extruder driver and optionally additional extruder or axis driver. In my case, I have 2 Z-axis steppers so the E1 is going to be Z2. I could go with (like in my previous board) one Z-axis driver powering two steppers, but it’s rather ugly solution and since we want to have some „intelligence” out of our TMC drivers – this wouldn’t work well.
  • it has all endstops, fan and heated bed connectors,
  • two LCD connectors and
  • and two AUX ports.

Let’s begin…

MKS Gen 1.4 board with TMC2130I’ve used TMC drivers for all stepper motors, you could save some money and use it only for X/Y axis (perhaps Z) – but I ordered set of 5, and used all 5. I also used TMC 2130 feature to eliminate X and Y endstops (I still have mechanical Z min. endstop). Finally I have LCD with SD card reader – this is important, since I had to change pins 53 and 49 from „default” configuration (like for example Tom presented) to utilize unused endstops pins, to be able to use SD card still. I’ve also wanted to use interrupts for every working endstop (for ATMEGA this are 2, 3, 18, 19, 20, 21) – so there are also some small changes from original setup.

  1. Remove all jumpers,聽 that are going to be under TMC2130 driver (this could make you a lot of weird troubles if you forget 馃槈 )
  2. Put driver boards in place, remembering about correct orientation (match descriptions on MKS board with those on TMC board) – in my case, SPI pins where on green side (lower one)
  3. Connect 3 common lines from every driver to pins on AUX 3 socket (SPI connection schema). I’ve prepared for myself, 3 cables with 6 connectors each soldered together
  4. Connect CS line from every TMC driver to different pin on the MKS Board – pins from X and Y TMC drivers are connected to endstop pins, so SD card reader could work 馃檪
  5. Connect X and Y TMC endstop signal to X min and X max endstop pins (this is also different, because we want to use interrupts – respectively pins 2 and 3)

聽Now the software…

Some basics steps you should take to customize firmware for this configuration. In my case (March 2018) I had to use 1.1.x bugfix Marlin to make everything work properly (mainly quick homing option). Or you can download what I’ve prepared 馃檪
  • do a clone of git bugfix repo („git clone -b bugfix-1.1.x„)
  • add TMC library to Arduino IDE. Choose from „Sketch” menu, „Include library” -> „Manage library” and search „TMC2130Stepper”
  • You have to edit those files
    • Configuration.h
    • Configuration_adv.h
    • pins_RAMPS.h

Warning! This are only steps that are somehow different from standard configuration. Unless you’ve downloaded prepared config, you have to do other changes for your printer!


Define board:

// The following define selects which electronics board you have.
// Please choose the name from boards.h that matches your setup

Define endstops (X and Y are TMC – so they can work on both ends – min and max. Z is traditional, so only min):

// Specify here all the endstop connectors that are connected to any endstop or probe.
// Almost all printers will be using one per axis. Probes will use one or more of the
// extra connectors. Leave undefined any used for non-endstop and non-probe purposes.
//#define USE_ZMAX_PLUG

Enable interrupts for endstops:

// Enable this feature if all enabled endstop pins are interrupt-capable.
// This will remove the need to poll the interrupt pins, saving many CPU cycles.


Just speeds up homing – move X/Y at once:

#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially

Enable TMC 2130 support:

 * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
 * You'll also need the TMC2130Stepper Arduino library
 * (
 * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to
 * the hardware SPI interface on your board and define the required CS pins
 * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
 * You may also use software SPI if you wish to use general purpose IO pins.
#define HAVE_TMC2130

Enable wherever you have TMC 2130:



Enable SPI for TMC:

 * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
 * like overtemperature and short to ground. TMC2208 requires hardware serial.
 * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
 * Other detected conditions can be used to stop the current print.
 * Relevant g-codes:
 * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
 * M911 - Report stepper driver overtemperature pre-warn condition.
 * M912 - Clear stepper driver overtemperature pre-warn condition flag.
 * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)

Enable endstops:

 * Use stallGuard2 to sense an obstacle and trigger an endstop.
 * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
 * X, Y, and Z homing will always be done in spreadCycle mode.
 * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
 * Higher values make the system LESS sensitive.
 * Lower value make the system MORE sensitive.
 * Too low values can lead to false positives, while too high values will collide the axis without triggering.
 * It is advised to set X/Y/Z_HOME_BUMP_MM to 0.
 * M914 X/Y/Z to live tune the setting

 #define SENSORLESS_HOMING // TMC2130 only


Finally change pins according聽 to our connection on board.
Change limit switches pins, to interrupts pin and free two of them for X/Y CS signals:
// Limit Switches
#define X_MIN_PIN 3
#ifndef X_MAX_PIN
 #define X_MAX_PIN 3
//聽#define聽X_MAX_PIN 2
//#define Y_MIN_PIN 14
#define Y_MIN_PIN 2
#define Y_MAX_PIN 2
//#define Y_MAX_PIN 15
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
Change CS pins for X/Y axis:
// Steppers
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#ifndef X_CS_PIN
 #define X_CS_PIN 14 // Z Y_MIN_PIN
// #define X_CS_PIN 53

#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#ifndef Y_CS_PIN
 #define Y_CS_PIN 15 // Z Y_MAX_PIN
// #define Y_CS_PIN 49

And that’s it, compile and send to the printer! Have a fine hacking 馃檪
ps. About Marlin firmware I’ve prepared and linked here – this is firmware I configured for my upgraded Infitary printer (X/Y/2xZ + E0). You can use it, but probably you may need to change axis direction, bed dimensions and offset etc.

Dodaj komentarz

2 komentarzy do "MKS Gen 1.4 board with TMC2130 and Marlin firmware – howto"

Powiadom o

Your endstop connection is wrong. You got Y axis endstop on X_Max end stop 馃檪