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 https://github.com/MarlinFirmware/Marlin“)
  • 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!

Configuration.h

Define board:

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

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_XMIN_PLUG
#define USE_YMIN_PLUG
#define USE_ZMIN_PLUG
#define USE_XMAX_PLUG
#define USE_YMAX_PLUG
//#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.
#define ENDSTOP_INTERRUPTS_FEATURE

Configuration_adv.h

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
 * (https://github.com/teemuatlut/TMC2130Stepper).
 *
 * 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:

#if聽ENABLED(HAVE_TMC2130)聽||聽ENABLED(HAVE_TMC2208)

//聽CHOOSE聽YOUR聽MOTORS聽HERE,聽THIS聽IS聽MANDATORY
#define聽X_IS_TMC2130
//#define聽X2_IS_TMC2130
#define聽Y_IS_TMC2130
//#define聽Y2_IS_TMC2130
#define聽Z_IS_TMC2130
#define聽Z2_IS_TMC2130
#define聽E0_IS_TMC2130
//#define聽E1_IS_TMC2130
//#define聽E2_IS_TMC2130

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)
 */
 #define MONITOR_DRIVER_STATUS

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

pins_RAMPS.h

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
#endif
//#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
#endif

#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
#endif

And that’s it, compile and send to the printer! Have a fine hacking 馃檪
Here is quick example how quiet the printer is, after described modification:
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.
Subscribe
Notify of
guest

39 Comments
Inline Feedbacks
View all comments
Arek K.
Arek K.
6 years ago

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

Bofus
Bofus
6 years ago
Reply to  Sauron

I guess, what he says is that in the picture “SPI Connection” You connect the Y and X endstops to the Y MIN and Y MAX, but you say it has to go to X MIN and X MAX, as shown in the picture above.
Im following your tutorial, excellent!

Robb
Robb
5 years ago
Reply to  Sauron

I think that you were correct the first time. The lines going to Y MIN and Y MAX are chip selects, not endstops, right?

Bossman74
Bossman74
6 years ago

Are the connections the same for a MKS Gen L 1.0?
Also could I use E2 to drive my Z2 stepper and could both Z steppers have sensorless homing to make sure the gantry is parallel to the bed?

Bossman74
Bossman74
6 years ago

I meant use the E1 to drive my Z2 stepper.

Bossman74
Bossman74
6 years ago

I’ve managed to make it work, thanks for your help ! I don’t know why, but when i had the move the SCO wire from the D50 pin to D64. When connected to D50, my TFT32 display couldn’t communicate with the board. So I moved it to D64 and change the pin location in “pins_RAMPS.h” is that ok ? #if ENABLED(TMC_USE_SW_SPI) #ifndef TMC_SW_MOSI #define TMC_SW_MOSI 51 #endif #ifndef TMC_SW_MISO #define TMC_SW_MISO 64 #endif #ifndef TMC_SW_SCK #define TMC_SW_SCK 52 #endif #endif Also I have a filament sensor with 3 pins (5v+,GND,SIG) on which pin shouldI connect it? I’ve read that I… Read more »

pc7x
6 years ago

I get:

Driver registers:
X = 0xE0:0C:00:00
Y = 0xE0:0C:00:00
Z = 0xE0:0C:00:00
E0 = 0xC0:0C:00:00
E1 = 0xE0:0C:00:00

Some have the same address, is this correct?

The JT
The JT
6 years ago

I had to resolder the connections on the board. The problem is that if I plug the driver in, it starts heating up immedialty without anything else connected on the board. What did I do wrong?

admin
Admin
6 years ago
Reply to  The JT

You would have to show some schematics, pictures – it’s hard to tell with information you provided so far. If it’s heating, it means it transfers current (close circuit), did you insert it correctly?

Xeruvim
Xeruvim
6 years ago

What can i do if i don’t can solder those 2 tiny spots? ( i manage to remove the resistor but i fail to make the other two)

none
none
6 years ago

I may be late to the party but i have one Question. You said you got SD Card to work, how is that?
I Only (visible) Plan on using a MKS TFT32, do you have plugged in another Display/SD Card Reader Combo?
Do you know of anything that would work for me?

Gato
Gato
6 years ago

Thank you soooo much for this tuto, it really helped me. finally have my TMC’s running, but i still have a problem. Z mechanic end/stop works fine, but X/Y don’t, and i don’t really care to continue using mechanic ones, what should i change on Marlin to continue using mechanical end stops on X/Y?

Silvio Franco
Silvio Franco
6 years ago

Hi. I am finishing my 3D printer built from scratch. It is a CR-10 clone. I have installed TMC2130 stepper drivers on a MKS Gen 1.4 board. I have all the TMC2130麓s in the V1.0 version that is supposed they will not work in SPI mode. Is this a problem? Do I need to follow your Marlin config.h and config_adv.h respecting my machine dimensions, stepper motors specs and so one? What should be a reasonable voltage for the stepper drivers? Thanks for your job supporting the community . They help us a lot. Silvio. Cheers from Brazil.

Mohamed
Mohamed
5 years ago

Hello , Thanks for this tutorial
i Have Buy MKS Gen 1.4 And Driver TMC 2310 SPI So the connection That u explain on this tut that is will connect to my board ?!

i Have Question Of in connection Driver X And Y to End Stop !

How i can Do it .. i can see in photo u take the 3rd Hole in back of driver to end stop How i can do this ?!

Rodrigo Araujo
Rodrigo Araujo
5 years ago

In this configuration can I use the original lcd display of the anet? Which memory card reader should I buy? Thank you!

Itsme
Itsme
4 years ago

Thanks for this explanation, but I still don’t get the end stops part.

I do understand for interrupt based end stops. But where do you hook up the end stops now? Like I mean the switches themselves?

Itsme
Itsme
4 years ago
Reply to  Sauron

Edited, but how does the board know when it hit the xy limits?

I’m still building my printer, and I was thinking: I need 2 stops per axis. But out of this I understand, you only use the z?

Itsme
Itsme
4 years ago
Reply to  Sauron

Oooh that’s actually quite interesting. Hmm but that gives me a tiny problem. As I’m building my printer, my xy limits have a bit of space, but I guess I can block that. A thing easily done, esp now I know the theory around it

Itsme
Itsme
4 years ago

With the new firmwares available it seems they removed support for TMC drivers for: “ENDSTOP_INTERRUPTS_FEATURE” are you aware of this? Is there a fix? Or should I just go back to your firmware?

Itsme
Itsme
4 years ago
Reply to  Sauron

yeh it’s still there, but when you uncomment that for TMC drivers:
TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.

so can’t compile.. is that feature really needed or will it still not stop on software checking? (’cause as far as I understand it without that define it will just poll the interface)

Itsme
Itsme
4 years ago
Reply to  Sauron

I have a MKS Gen v1.4 and using 2.x . I learned from google that it’s a fairly common problem and some speak of being able to just disable sanity checks, but I haven’t heard any successtories yet.

Itsme
Itsme
4 years ago
Reply to  Sauron

Yeh, I used your “Or you can download what I鈥檝e prepared 馃檪”. I’m assuming 1.1.x isn’t too much of a downgrade to 2.x? Btw that download, you changed the values for the Limit switches, but not the steppers xD was wondering why it gave me a short on one of the steppers. Sooo I changed a few things, now my screen is working, steppers are working. Tho, perhaps you know this: I’m using 2 Z steppers, you use 2 drivers but I’m using a board that splits the 1 driver. But now they turn 1/2 as fast. Which makes sense..… Read more »

Sadegh
Sadegh
4 years ago

Hi
just a little comment: enabling “#define SOFTWARE_DRIVER_ENABLE” will cause NO movement in using TMC2130.

Josehernandez588@gmail.com
Josehernandez588@gmail.com
4 years ago

Hello, can you offer advice on issue with Ender black widow , motors not working, I think wiring issues

Benny
Benny
4 years ago

Hi can you make a tutorial for marlin 2.0. i am scratching my head for dual z axis to work.


39
0
Would love your thoughts, please comment.x
()
x