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 Y min and Y 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.

21
Dodaj komentarz

avatar
10 Comment threads
11 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
11 Comment authors
Silvio FrancoGatoBofusnoneXeruvim Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Powiadom o
Arek K.
Go艣膰
Arek K.

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

Bossman74
Go艣膰
Bossman74

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
Go艣膰
Bossman74

I meant use the E1 to drive my Z2 stepper.

Bossman74
Go艣膰
Bossman74

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… Czytaj wi臋cej »

pc7x
Go艣膰

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
Go艣膰
The JT

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

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
Go艣膰
Xeruvim

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
Go艣膰
none

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
Go艣膰
Gato

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
Go艣膰
Silvio Franco

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.