I’ve had a a few bad days trying to figure out why the files found in the MKS github wouldn’t work with their own TMC2130 stepsticks via SPI. My recommendation is to start from a fresh Marlin install and change the following lines. Of course you will have to change typical settings as well, but you can find those elsewhere.
First make sure the jumpers are set to SPI mode:
Changes to Marlin
I would start with the latest Marlin version from Github . In my case 220.127.116.11. The files found in MKS Github are outdated.
Line 21: default_envs = LPC1768
Line 107: #define SERIAL_PORT -1 Line 131: #define MOTHERBOARD BOARD_MKS_SGEN_L Line 673: #define X_DRIVER_TYPE TMC2130 Line 674: #define Y_DRIVER_TYPE TMC2130 Line 675: #define Z_DRIVER_TYPE TMC2130
Line 2189 #define TMC_USE_SW_SPI Line 2346 #define TMC_DEBUG
Line 2189 is not mentioned in the instructions!
Enabling sensorless homing:
Line 650: #define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. Line 651: #define Y_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
Line 2324: #define SENSORLESS_HOMING // StallGuard capable drivers only
Thats all. Hope it helped.