4 Axis CNC Controller for Grbl_ESP32
Loading README and project media…

Trinamic SPI stepper motor drivers are great. They have dozens of features not found on traditional small stepper drivers. You can't control all the features via configuration pins, like the MS1, MS2 and MS3 traditionally used to select microstepping. They use SPI to setup and control the features.
Note: Some of these drivers are sold in a pre-configured mode. They are often call "Stand Alone" versions of the drivers. This project is not compatible with those. It only works with SPI controlled drivers.
Typically each SPI device requires a SS (slave select) signal. With multiple drivers, this can cause problems with I/O pin count limited controllers, like the ESP32.
Most SPI devices can be used in a daisy chain mode (see image). As bits are received into a register via the MOSI pin, bits are shifted out of the register of the MISO pin. Trinamic drivers use a a 40 bit wide register. To write to all three drivers shown below, you would send (3) sets of 40 bits. The first set of 40 bits would end up in the last driver. The SS line is pulled low once all drivers have their data. To write to only one driver, dummy data would be sent to the non targeted drivers.
![]()
There is a very comprehensive and easy to use library, TMCStepper, for SPI control, but it does not support daisy chaining. I created a fork that has a basic ability to write to any driver in an SPI daisy chain. It does not support reading data yet.
Note: Obviously, external I/O expanders can be used increase I/O pin count. This project is focused on using only the I/O on the ESP32.
This project represents a lot of work. Please consider a safe, secure and highly appreciated donation via the PayPal link below.