Page 1 of 5

Improvements by using TMC2130 driver.

Posted: Fri Jan 12, 2018 10:42 pm
by ABH
I decided to post some findings and theories here, that technically inclined persons might find interesting.
Raise3D printers are using Trinamic TMC2100 based stepper motor driver modules, configured to use the smooth and nearly silent StealthChop mode.
An associated "feature" of the StealtChop drive mode is the so-called "microPlyer", which is marketed as microstep "interpolation" that gives a smooth motor operation. In reality, this is not an interpolation feature but rather an extrapolation feature, that tries to predict the time for a future step by assuming that all steps are equally spaced in time and of course unidirectional.
This has some severe consequences for the use in 3D printing, as described below.
I have been wanting to disable the microPlyer feature for a long time in the TMC2100, but unfortunately this is not possible unless you abandon StealtChop drive mode and configure the driver for SpreadCycle mode.
StealthChop provides higher torque than SpreadCycle for the speed range used in 3D printing. Many "3D printing experts" all over the Internet claims that there is a torque penalty by using StealtChop over SpreadCycle, but this is incorrect according to information from the manufacturer. In various Trinamic application notes it is shown that for the NEMA17 type of stepper motors StealtChop will give you the highest torque for speeds below 150 rpm, corresponding to below 100 mm/s X/Y axis velocity in Raise3D printers.
On the other hand, I have experienced myself, that a TMC2100 in StealtChop mode in certain situations can skip steps. I blame the microPlyer feature for this. In the datasheet for TMC2100 it is stated: "Attention: microPlyer only works perfectly with a stable STEP frequency". Well, a 3D printer has nothing but an unstable step frequency! It accelerates and brakes and changes motor direction all the time, just think of a rectilinear infill pattern, usually created at quite high speed.
So, I always had the suspicion, that the use of microPlyer in 3D printing is a big mistake. Remember that Trinamic IC's are not really targeting 3D printing. There are many other (high volume) applications, where these IC's can be used. 3D-printers are not even mentioned in the datasheet's listing of applications for this driver IC :-)
A problem with the use of microPlyer in 3D printing is illustrated in the figure below.
Figure1.png (5.45 KiB) Viewed 23694 times

The figure illustrates stepping forward from X pos. 0 to X pos. 3 and stepping back to X pos. -1. The velocity used here will be the so called "jerk speed", i.e. the velocity ending a brake phase (with constant negative acceleration) or starting an acceleration phase (with constant positive acceleration). The red curve is the electrical step trajectory following the native 1/16 microstep pulses as supplied to the TMC2100. The dotted blue curve is the "interpolated" trajectory, as supplied to the motor phases. The dotted blue curve is composed of 16 smaller steps, in-between the 1/16 steps, giving a resulting 1/256 microstepping smoothness. When reaching pos. 3, the driver expects a further move with the same speed in the same direction, but in reality the direction is changed! The result is an electrical "overshoot" corresponding to one 1/16 microstep distance (12.5 µm). At time=4.8 the driver realizes that it made a wrong prediction and it will now have to change the phase-currents back in a step that corresponds to twice the normal 1/16 microstep change. This "double step" in the opposite direction, which is necessary to mitigate the drivers wrong prediction, might come while the stepper motor is in a critical state. On top of the electrical overshoot, generated by the microPlyer feature, there will also be a mechanical overshoot caused by the abrupt velocity change and the systems inertia. The electrical overshoot plus the mechanical overshoot might furthermore be combined with a critical physical rotor position. The motors torque will not be constant when the rotor moves between the stator poles. If the rotor happens to be in a "weak" torque phase, then the rotor might tip over and a shift of 4 full-steps (= 0.8 mm in the Raise3D printers) will be the consequence.
My conclusion is: microPlyer "interpolation" is not intended for 3D printing, as you have these direction changes all the time.

While TMC2100 doesn't allow the microPlyer to be disabled in StealtChop mode, this can be done in the TMC2130 driver IC. There are Watterott driver modules available, that can be used in the Raise3D motion controller board. As the TMC2130 is configurable via an SPI interface, you need to connect some wires from connector pins on the motion controller board (Rumba board) to the SPI pins on the Watterott driver modules, in order to "talk" to the chip.
There has recently been added support for TMC2130 in the Marlin firmware. Not in the Raise3D version of Marlin (Raise3D firmware "1.1.6-rev1" is one year old and based upon a three year old Marlin SW!), but in the real Marlin open source project, where the latest release is called 1.1.8, and is from December 2017. There are a few modifications necessary to make the std. Marlin firmware work in Raise3D printers. I made these modifications to the 1.1.8 release in a repository that can be found here:
There are pre-compiled ".firm" files for the std. printer configurations (N1, N2, N2PLUS, single, dual, Bondtech), that can be used directly, without the need for setting up Arduino to compile the firmware.
Using TMC2130 with this firmware also allows you to set the stepper motor currents by M-code M906.
"M906 X900 Y900" for example, will set the RMS phase current in both X and Y stepper motors to 900 mA.

I used a specific wiring for the SPI signals on the motion controller board. This wiring is also defined in the firmware. There must be agreement between the HW and SW on this. All SPI connections are taken from the Rumba board "EXP1" connector:
SPI connections.png
SPI connections.png (2.42 KiB) Viewed 23694 times

The EXP1 socket on the Raise3D Rumba board is mounted incorrectly (turned 180 deg.).
This means that the pin numbering doesn't follow normal convention and the marking on an IDC connector.
The pin numbers listed above follows the Rumba board schematic and are thus different to the IDC connector marks.
This picture shows the correct pin marking of the EXP1:

The 4 pins on a module used for the SPI must not go into the module socket on the Rumba board. This will create unintended shortcuts.
Some people use connectors for the SPI wires to the module, but I chose to solder in the wires.
Connectors will be large and tall and will reduce the air flow for cooling the drivers heatsink.
Wired Modules.jpg

This link might also be interesting:

So, this write-up has so far just been theory, but is it really true?
I saved a g-code file that I never had any success printing, while using the TMC2100 drivers in StealthChop mode. There is a certain layer region in that model that always produced one or more skipped steps. No matter how high stepper motor current was used, I always experienced skipped steps in this particular g-code file. The same STL file printed fine if I moved it to another place on the build plate. This supports my theory, that in this particular g-code file there are abrupt direction changes at critical stepper motor rotor/stator phases. The gantry in my printer was never disassembled from the time when these print failures happened till today. A disassembly might have made printing this g-code file possible, as this would likely move the rotor/stator phase relative to the critical abrupt direction change. I should mention that I printed hundreds of other models without problems with skipped steps, so this is not a common problem for me.
When I started using the TMC2130 driver with the new firmware, that had microPlyer disabled, I was able to print the g-code file for the first time using StealthChop!
I afterwards confirmed that using TMC2130 with microPlyer enabled generated skipped steps.
I also confirmed that using TMC2100 drivers and the same firmware generated skipped steps.
The visual results from using StealthChop with disabled microPlyer are better than ever. I don't see any downside of this modification at all and I would therefore strongly recommend this modification. If you listen carefully you can sometimes hear a very faint tone from the stepper motors now, that was not there before. This is the only very minor "negative" consequence of the modification. I know that some people are using other types of drivers that doesn't have this issue. However, I like the smoothness and silence of the StealthChop mode, so I am happy about this modification. And, my conclusion is clear: Using microPlyer interpolation in 3D printers is a mistake.

Re: Improvements by using TMC2130 driver.

Posted: Sat Jan 13, 2018 3:13 am
by firesped
interesting. I replaced all my steppers with Panucatt SureStepr SD6128 Stepper driver myself. I use them on my trinus as well, which I replaced the controller with the Panucatt Azteeg X5 GT 32bit Motion Controller. I'm not even sure that printer makes any noticeable noise at all with the digipot versions.

do you know which steppers use microPlyer?

Re: Improvements by using TMC2130 driver.

Posted: Sun Jan 14, 2018 4:34 pm
by ABH
I think it is only trinamic that has this feature in their TMCxxxx series drivers. Never heard of any other drivers that does interpolation (= extrapolation).

Re: Improvements by using TMC2130 driver.

Posted: Wed Jan 17, 2018 9:32 am

thanks for effort to integrate the SPI interface to the Marlin Version of Raise3D printers.

The microPlyer™ is interpolating the next step with the frequency / speed of the previous step. During acceleration when the next step is shorter than the previous one, the interpolated step cannot be completed. To not lose any steps, the IC catches up by doing a large step. This large step has the maximum size of the microstep you are using as input, so e.g. a 16 microstep. So in any case the motion is smoother by using the microplyer. I added a black line to the drawing which shows how the movement would look like.
Untitled.png (11.54 KiB) Viewed 23553 times

The issue you are seeing is related on how stealthChop™ is working. steahlthChop™ is using a pure current regulation without any pre-regulation. Depending on the steepness of the acceleration the target current might not be reached during the accereleration phase. We improved this in the version, stealthChop2™. Here we are using a pre-regulation which allows more torque during accerleration phases. This version is integrated e.g. in our new TMC22xx family. We also came with a new SilentStepStick in our portfolio which is using the TMC2208:

Re: Improvements by using TMC2130 driver.

Posted: Thu Jan 18, 2018 4:47 pm
by ABH
Thank you TRINAMIC for answering my post.
It is good to know that you have improved the current loop in StealthChop-2 in TMC22xx series drivers. I didn't know that there was a difference in StealthChop between the 1st and 2nd generation drivers. I will certainly try out the TMC2208. Maybe the StealthChop-2 will use feed-forward compensation in addition to the proportional regulator in Stealtchop-1?

However, a general improvement in the StealtChop current loop doesn't change my conclusion about microPlyers applicability to 3D printers. Your black curve indicates that the driver is effectively delaying the phase currents by one microstep when the speed is slow and constant. For 1/16 microstepping this is only 12.5 um, so it doesn't matter, but what if the inputs are full-steps, then the driver will be lagging one full step, or 0.2 mm, when using microPlyer, compared to instantaneous full-step drive of the phases. Is this really correct?
I am also questioning this, because the experiment I did with disabled microPlyer decreased the likelihood of skipping steps and no other settings were changed in the experiment besides disabling of microPlyer.
Anyway, whether microPlyer handles the direction change by using a double step or effectively delays the step input, I find this feature unnecessary for 3D printers, as the smoothness and silence of the motors is not as important as precision and reliability.

Re: Improvements by using TMC2130 driver.

Posted: Thu Jan 18, 2018 6:05 pm
Your are right, in special situation the microPlyer is delaying by a full step. microPlyer is used to compensate other side effects that occur when using very low microstepping as e.g. fullstepping.

When using fullstepping the system can start to oscillate which can have an even higher impact on the print result than this "delay". You can see this in picture below. The ideal steps are rectangle but due to the long step distance the actual target position will be overshot and the system start to oscillate around the target point. With microPlyer you are doing 256 equal small steps instead so you won't overshoot the target position and you also have less vibration in the system.


Re: Improvements by using TMC2130 driver.

Posted: Thu Jan 18, 2018 6:47 pm
by Vice Chief
Great work ABH and thanks, Trinamic, for weighing in.

I have what might be a stupid question. Are the silentstepsticks that Trinamic linked drop-in replacements for the existing Raise3D stepper drivers?

Re: Improvements by using TMC2130 driver.

Posted: Fri Jan 19, 2018 1:00 am
by Jetguy
Vice Chief wrote:Great work ABH and thanks, Trinamic, for weighing in.

I have what might be a stupid question. Are the silentstepsticks that Trinamic linked drop-in replacements for the existing Raise3D stepper drivers?

According to what I just checked out, drop in from Digikey ... ND/6873626

Now in saying drop in, I mean the physical layout and pins designations are the same. We may have to read the data sheet, set the MS switches, obviously set the current using the potentiometer, and add some good quality heatsink- not to mention, validate the configuration resistors for the modes. So yes, it "plugs in" and doesn't require a firmware change unlike the additional wiring and custom firmware presented by the TMC2130 series since you must use software to set the configuration via the SPI- and why both the firmware and then that custom wiring is required.

I'm buying a set of these newer TMC2208s based on this info for testing.

Re: Improvements by using TMC2130 driver.

Posted: Fri Jan 19, 2018 1:03 am
by Jetguy
Sadly, my favorite local vendor Filastruder doesn't yet have these TMC2208s. Hopefully I can put a bug in his ear and get him to carry some based on this new info. I mean heck, he already carries the others (TMC2100s, TMC2130s, shoddy DRV8825s, and classic A4988s).

Re: Improvements by using TMC2130 driver.

Posted: Fri Jan 19, 2018 1:22 am
by Jetguy
Sorry for driving this off the 2130 solution and towards the 2208 solution. ... 08_v11.pdf

According to this, just set MS1 and MS2 on the mainboard to ON. That sets it in the matching 1/16th mode and set the current on the pot and it's good to go.

Re: Improvements by using TMC2130 driver.

Posted: Sat Jan 20, 2018 7:53 pm
by ABH
I installed Watterott TMC2208 drivers for X and Y axis yesterday.
At first I used HW configuration: MS1 and MS2 switches were set to "on" to tell the driver that the supplied steps are 1/16 microsteps. The default configuration means StealthChop mode with microPlyer. Motor phase current was adjusted on the potentiometer to 800 mA RMS (Vref = 1.1 V), which I always use. I didn't measure the temperature of the chip, but the driver felt cooler than the standard TMC2100, which is nice, and in line with the lower Rds_on of the MOSFETS used in the TMC2208 driver bridge.

I have mentioned before, that I use a specific gcode file for testing, that always gives skipped steps in a certain critical region with TMC2100. This model printed without any skipped steps with TMC2208.
I then reverted to TMC2130 drivers with microPlyer on, just to confirm that the issue remains with StealthChop-1 and microPlyer, and sure enough, I saw a skipped step in the critical region of this gcode file. I should mention, that for all the tests with this gcode file, I used the same spool of filament and same speed, acceleration and jerk settings in firmware. Actually the very same firmware was used for the last series of tests, as the added SPI control is just an add-on that doesn't prevent drivers without SPI to be used.

There is no visual quality difference whatsoever, between models printed with TMC2100, TMC2130 and TMC2208!

I then went on, and compiled a dedicated Marlin firmware to control TMC2208. This is necessary to switch microPlyer on and off and to use any other special setting. With this firmware it is also easy to set the phase current. This is done in the same way as for TMC2130, with M906 g-code.
I reduced the phase current all the way down to 300 mA and printed my critical gcode file with and without microPlyer enabled and I didn't observe any skipped steps at all. So, this driver chip is definitely better than TMC2100 generation chips.
I do not intend to use 300 mA driver current, it was just an experiment. Funny to print with stepper motors than almost feels cold during a print. I measured the surface temperature of the stepper motor to be 5 °C above ambient temperature!

If interested in the modified firmware for controlling the driver, it can be found here:

The single-wire UART of each driver must be connected to pins on the ATmega2560 MCU. The firmware assumes that UART1 is used for X and UART3 is used for Y. UART1 is normally used for "RepRapDiscount Full Graphic Smart Controller" which is actually normally supported for the Raise3D board, as an alternative to the Touchscreen Linux computer. I never had need for this, so this is not supported in this firmware.
The UART pin on TMC2208 chip must be routed to a pin on the driver module. This is done by a solder bridge on the module, as shown below.
When received from Watterott, there is no solder on this bridge. MS3 switch must be left in the "off" position.
Solder bridge.jpg

The connections needed on the Rumba board are shown here:
Board Connections.jpg

Re: Improvements by using TMC2130 driver.

Posted: Wed Jan 24, 2018 11:12 pm
by Jetguy
My TMC2208s just arrived from Digikey and likely, I'll just be installing without the serial interface but I also realized Panucatt has the TMC2224 stepper drivers.

So this question is really back to Trinamic who I hope is still watching this. I think the main difference between a 2208 and 2224 is that the -24 does 1/32 microstepping VS the 1/16th for the -08? All other main features seem to be the same?
Considering we use 1/16th stepping to maintain stock steps per mm, I don't think there is any gain or reason to jump to the 2224?

Re: Improvements by using TMC2130 driver.

Posted: Thu Jan 25, 2018 9:23 am
Yes, you are right. Both ICs are from the same family. The main difference is a different pinout and slightly different configuration setup via pins. Due to an additional used pin on the TMC2224 it is possible to switch between stealthChop™ and spreadCycle™ by pin configuration. The TMC2224 can be configured with pins to use 4, 8, 16 and 32 microstepping as input, while the TMC2208 is using 2, 4, 6 16 microstepping as inputs.

When using the UART interface all (and the same) settings are available for both ICs.

Re: Improvements by using TMC2130 driver.

Posted: Fri Jan 26, 2018 9:24 pm
by Jetguy
Thanks for the answer. I've only got a couple of hours running my N2Plus and my N3 (not official Raise 3D custom built printer CORE XY) running the 2208s for XY. I went with the same defaults 1.1V vref for ~800mA RMS drive current. Impressed, this should be the new factory option and replacement drivers from here on out. Are you listening Raise 3D and tech support? This is plug and play and drop in replacement for the TMC2100s and could eliminate a lot of skipped step user complaints.

Re: Improvements by using TMC2130 driver.

Posted: Fri Jan 26, 2018 9:48 pm
by Jetguy
A replacement XY OEM Raise 3D supplied XY TMC2100 driver is $19.90 each or effectively $40 for a pair in the store ... per-driver

The newer stepper driver ic (TMC22xx series) with improved performance is "drop in compatible" and costs $7.39 each from Digikey (needs a heatsink and header pins soldered) or even more plug and play from Panucatt with heatsink and pins already soldered is only $9.90 for the TMC2224 Config setting is slightly different for the Panucatt with MS1 OFF, MS2 ON, MS3 OFF and a Vref setting of 0.4V That gives you 1/16th stepping, Stealthchop2, and current setting of 800mA RMS. ... 24-drivers

Re: Improvements by using TMC2130 driver.

Posted: Mon Feb 12, 2018 10:51 pm
by Jetguy
Just FYI, I've installed the Panucatt TMC2224s (because they come with really nice heatsinks and header pins for plug and play) into my N1 and a few other printers for testing.
On the N1, I used 0.47V Vref and the MS switches 1 OFF, 2 ON, 3 OFF to set microsteps to 1/16th and stealthchop2 on (controlled by MS3)
Note the orientation compared to the other drivers. Also note, this is also an N1 with Minbea brand motors. If you have different motors, the ideal Vref may be different due to motor heating.
X and Y axis stepper driver MS switch settings.

Stepper driver orientation compared to other drivers

My N1 motors for reference, If you have different motors, they may require slightly less current to prevent overheating.

I'm still trying to dial in N2 Plus and because I changed the motors mine may not be ideal for the final Vref setting.

That said, these drivers are worth the upgrade. It's not that they are going to make your printer faster, it's that a known potential XY skip under just the right gcode and firmware conditions is present in TMC2100s. TMC22XX series "fixes" this. If you can buy plug in drivers for $20 that eliminated the known chance of a skip, I'd highly suggest we get more folks behind this as new standard equipment on the N series.

Again, just note a couple of things. I fully recommend either driver, TMC2208 or TMC2224. Both are under $10 each right now. Both are from quality vendors making the boards. The TMC2208 is slightly lower cost, but doesn't ship with the headers soldered and needs a heatsink. The Panucatt 2224s represents a good value as they are coming plug and play, pins soldered, heatsink included for only $10 Also note, the suggest Vref is vastly different for the 2208 VS the Panucatt 2224. This is due to chosen resistors on the board, not any difference in chips.

Re: Improvements by using TMC2130 driver.

Posted: Tue Feb 20, 2018 11:00 am
by NeelD
Thanks for very informative post. Just question to @TRINAMIC will there be a V2 version of TMC2130 with new stealthChop2™ and same features?

Re: Improvements by using TMC2130 driver.

Posted: Sat Mar 10, 2018 10:10 am
by socke
I'm just doing the same mod, but can't build your firmware from the TMC2208 branch. It seems, the TMC2208Stepper.h is missing there. Could you please check that?


Re: Improvements by using TMC2130 driver.

Posted: Sat Mar 10, 2018 12:44 pm
by socke
Never mind. I found, it's a library which needs to be installed first. ;-)

Re: Improvements by using TMC2130 driver.

Posted: Sun Mar 11, 2018 1:53 pm
by socke
I just completed the first print after doing this mod. Everything went very well.
Thanks ABH for sharing this and your comprehensive write up!