Trinamic SPI Driver - bdring/6-Pack_CNC_Controller GitHub Wiki
Overview
Trinamic SPI Drivers are state of the art stepper motor drivers. The have so many features that you cannot set them all with a few jumpers and a potentiometer. They use an SPI communications interface to configure settings and read back data. There are a lot of driver types, but we currently only support the TMC2130 and TMC5160. When you buy them, make sure you are getting the SPI version. There are some that emulate standard drivers and do not use the SPI. These are called stand alone versions. You must use the SPI versions.
Recommended Sources
We recommend the the BigTreeTech brand.
- TMC2130 Ver 3
- TMC5160 any version. Note: A few people have seen issues where these motors stop working when set to medium to high current levels. We are trying to get to the bottom of the issue. It does not appear to be a hardware or firmware issue. It is likely one of the dozens of settings. We are not experts on these motors and cannot guarantee full performance from them at this time. See this note in the Grbl_ESP32 Wiki
Jumper Setup.
The Vcc jumper must be put in 3.3V mode
You must set the SPI/MS jumpers into SPI mode.
The TMC5160 jumper must be in the TMC5160 position for TMC5160 drivers and the other position for all other drivers.
StallGuard
Stallguard allows for sensorless stall detection. If a stall is detected it can send a signal to the controller. This controller treats it like a limit switch. If you want to use it, there are jumpers under the ESP32 to connect that signal to the ESP32.
Important Note: You cannot use use normal limit switches when the jumpers are installed. The signal from the drivers and the switches will conflict and damage the circuitry. Do not use a CNC I/O Module in socket #1 if X,Y,Z,and/or A are jumpered. Do not a CNC I/O Module in socket #2 if B and/or C are configured for stallguard.
Note: The StallGuard feature requires a lot of tuning for each machine design. It is an advanced subject that we can only offer limited personal support with. It is not for Newbies. See this page for information.
SPI Details
Each driver gets its own CS signal (not daisy chained). The SPI is also connected to the SD card socket.
Machine Definition
Here is a typical setup for all sockets. You can re-assign any socket for ganged motors, etc.
#define X_TRINAMIC_DRIVER 2130
#define X_DISABLE_PIN I2SO(0)
#define X_DIRECTION_PIN I2SO(1)
#define X_STEP_PIN I2SO(2)
#define X_CS_PIN I2SO(3)
#define X_RSENSE TMC2130_RSENSE_DEFAULT
#define Y_TRINAMIC_DRIVER 2130
#define Y_DIRECTION_PIN I2SO(4)
#define Y_STEP_PIN I2SO(5)
#define Y_DISABLE_PIN I2SO(7)
#define Y_CS_PIN I2SO(6)
#define Y_RSENSE X_RSENSE
#define Z_TRINAMIC_DRIVER 2130
#define Z_DISABLE_PIN I2SO(8)
#define Z_DIRECTION_PIN I2SO(9)
#define Z_STEP_PIN I2SO(10)
#define Z_CS_PIN I2SO(11)
#define Z_RSENSE X_RSENSE
#define A_TRINAMIC_DRIVER 2130
#define A_DIRECTION_PIN I2SO(12)
#define A_STEP_PIN I2SO(13)
#define A_DISABLE_PIN I2SO(15)
#define A_CS_PIN I2SO(14)
#define A_RSENSE X_RSENSE
#define B_TRINAMIC_DRIVER 2130
#define B_DISABLE_PIN I2SO(16)
#define B_DIRECTION_PIN I2SO(17)
#define B_STEP_PIN I2SO(18)
#define B_CS_PIN I2SO(19)
#define B_RSENSE X_RSENSE
#define C_TRINAMIC_DRIVER 2130
#define C_DIRECTION_PIN I2SO(20)
#define C_STEP_PIN I2SO(21)
#define C_DISABLE_PIN I2SO(23)
#define C_CS_PIN I2SO(22)
#define C_RSENSE X_RSENSE
Other Issues
Make sure you do not install any drivers in sockets that are not setup in your machine definition files. These will interfere with the SPI communication and no drivers will setup correctly.