Trinamic Drivers and Custom PCB

IMG_20200208_193716.jpg

TMC4361

As a tangent from the Whip Cracking Machine, i started wanting better servo motor control. After some research, i settled on wanting to use the TMC4361a. This chip take higher level SPI commands, and translates them to step and direction signals, which are standard for basically all servo and stepper system, despite the relatively high step frequency necessary.

The 4361 can do up to about 8 million steps/second, and while that sounds like a lot, it’s actually lower than most servo system can operate (~50mhz for one drive that i have, and 24mhz for another). With electronic gearing, top speed and full resolution should be achievable however.

Importantly, since the Raspberry Pi only has to send high level motion control parameters (acceleration, top speed, deceleration, etc) and a position command, it’s very low load on the raspi, and allows smooth motor operation with non-deterministic operating systems and variable OS load.

I searched for Python drivers for this chip, and came up short. There were some implementations that were incomplete, or not very confidence inspiring. Trinamic had some baseline drivers that did everything* other than the SPI communication. How hard could it be to implement those functions to extend their code?

After a month or two, i’m mostly done. My drivers do take their register and field enumeration files, but use almost nothing else of theirs. I’ve created a much higher level implementation, which allows easy use of negative and fractional value, clips values to safe ranges and assures value relationships are sane, implements auto-tuning routines, and etc.

As part of the journey i taught myself PCB design with KiCad. Here are some TMC4361a-BOB raspberry pi expansion boards. They have jumpers for configuration on multiple channels and i/o pins, RJ45 for shielded transmission of step and direction signals over longer distances, and pin breakouts to testing. They’re built to stack on other boards to allow multiple outputs at once.


TMC5160

The SPI datagram and a lot of the concepts are shared between the TMC4361a for step and direction control, and the other Trinamic SPI chips. The other particularly interesting chip is the TMC5160, which is a stepper motor driver with integrated motion controller (though not as nice as the 4361a). This meant i wanted to make a driver that allows the use of this chip as well. The drivers were now starting to be broad family.

There are a few really interesting features of this chip. Specifically integrated motion controller, mechanical load detection, encoder comparison, silent operation, low power operation with low load, high speed operation, and high current capability with bigger MOSFETs (this version limited to 3.1A at 36v ~= 100w!).