EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: LiftedTrace on October 26, 2020, 09:34:51 pm

Title: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on October 26, 2020, 09:34:51 pm
I am a beginner. I got me this nice home built 3d printer that I am using the TMC5160 drivers on. I wanted to fine tune them and started reading thru the data sheet |O.
What I am confused on at the moment is the oscilloscope measurements they show on page 70 of the datasheet. I have a Rigol DS1054z oscilloscope and I have access to both current sense resistors, but when I probe across any one of them I do not see the wave form they show on the datasheet. I do not have a current probe.
Do I need to configure the scope in a some special way to view this wave form?
My hopes were being able to see changes to the waveform when I modify certain parameters, but if I cannot even see it, I'm sort of at a loss.
Do I connect the probe ground and probe directly across the sense resistor?
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: thm_w on October 26, 2020, 09:47:58 pm
Do I connect the probe ground and probe directly across the sense resistor?

Yes but make sure the probe ground is on the right side of the resistor, eg the grounded side.

Quote
This  can  best  be checked  when  measuring  the  motor  current  either  with  a  current  probe  or  by  probing  the  sense resistor voltages (see Figure 8.2).
https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5160A_Datasheet_Rev1.14.pdf (https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5160A_Datasheet_Rev1.14.pdf)

What kind of waveform do you see? Is the motor moving at a set low speed? They mention <100 full steps/s in the datasheet.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on October 28, 2020, 03:01:21 am
Quote
What kind of waveform do you see? Is the motor moving at a set low speed? They mention <100 full steps/s in the datasheet.
Its definitely less that 100 steps/s. The waveform I have no idea what it looks like. Its all a blur of lines all over the screen. Maybe there is a trick to triggering on this type of signal? I move the trigger up and down the whole width of the screen blur but I get nothing to come into view.
I just got this DS1054z scope, so I dont know how to capture screens yet. Ill work on that and post a screen shot of what I am getting.
I was thinking maybe because I cannot measure current, I needed to use two probes and combine them somehow....one on each sense resistor? I really have no clue.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: thm_w on October 28, 2020, 09:49:38 pm
100 full steps or 100 micro steps?

Its possible to use two probes, subtract them, and then come up with a waveform (A-B), but that should not be necessary here.

What value is the current sense resistor? You can divide 200mV by that to tell you what one division on the scope screen would be.

From the screenshot in the first post they are using bandwidth limiting mode, likely 20MHz. If you enable that it will clean up the waveform slightly.
Try setting trigger to auto and zooming in/out with x and y, see if anything shows up or not. If you see anything sinusoidal at that point you can try to trigger on it.

Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on October 29, 2020, 02:04:20 am
Quote
100 full steps or 100 micro steps?
So I am not sure where the 100 full steps was in the data sheet, but with that, i think my math is right for around 80 full steps/s.
I am pulsing the step every 780micro seconds, and the chip is configured for 16 micro steps, same as my printer. So 780micro seconds is 1282 pulses per second, divided by 16 gives me close to 80 full steps per second.

Quote
What value is the current sense resistor?
The sense resistors are .075ohms

Quote
Its possible to use two probes, subtract them, and then come up with a waveform (A-B), but that should not be necessary here.
So I tried this and got the same ugly wave form. I cannot get a clean waveform.

Quote
From the screenshot in the first post they are using bandwidth limiting mode, likely 20MHz. If you enable that it will clean up the waveform slightly.
Try setting trigger to auto and zooming in/out with x and y, see if anything shows up or not. If you see anything sinusoidal at that point you can try to trigger on it.
So I got nothing clean when doing this. Limiting band width did clean up some of the really faint larger signals, but overall its just a mess.

If I can explain it at all, I can sort of "see" some sine wave looking signals moving around in the mess at a slow rate across the screen, but I cannot seem to trigger off it. I have no idea how they captured that wave form.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on October 29, 2020, 12:37:41 pm
I had a thought while sleeping about this. I wonder if it’s me pulsing it with the step input that is making the unclean signal.
I think there is a way to tell the chip itself to run at a certain speed.
Perhaps this is how they get the clean waveform. 🤔
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: thm_w on October 30, 2020, 08:36:44 pm
That would be the best, if there is some sort of internal test mode to run the motor at a slow speed. But if not, there is no way around pulsing.
What could help is increasing the 16 micro steps to max, 256. Then pulse a bit faster to compensate.

0.075R means quite a low output voltage, you can calculate what you expect to see based on your current limit.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: Doctorandus_P on October 31, 2020, 01:14:19 am
I think that part of your trouble may be due to inexperience with oscilloscopes.

Try to get to a solution in steps.
The first step is to give your scope something to look at, and for that it's much easier if your motor is running fast.
Try to give your motor enough pulses to run at least at 100RPM, and also make sure your motor has to deliver some torque.

If it's on a 3D printer, to do this I suggest:
Take of one of the timing belts from one of the pulleys, then take a piece of string and wrap it 2x over the pulley, and put some tension on the string, for example with a weight, a spring or an elastic band.

Then turn on the 20MHz filter in your oscilloscope. This greatly reduces the noise you see, and all your frequencies of interest are much lower then 20MHz.

After that change the time and voltage settings on your scope so you have something on the screen that looks like it may look plausible.
Next step is to refine the triggering, but the switching of the motor coils may make that difficult. Alternatively you can use single capture mode to capture a random part.

The signal I saw in the screenshot with the small triangle wave is very likely the ripple from the PWM of the current control through the motor windings. That is not an interesting signal at this moment. You want to zoom out your timebase to get the bigger picture.

Also:
Are you sure you're probing on the right side of the current shunt resistors?
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on October 31, 2020, 02:35:07 am
Thanks for the reply’s. My printer is printing at the moment, but something you both said had me thinking I am both not spinning fast enough and don’t have enough current set for the drive.
I will test it when the printer is done and report back, but something I noticed when I had more of the signal visible, I did see something that looked like the wave form but I think there was so much noise and it was so small I wasn’t able to trigger it.
I think increasing the speed and current might make it larger and come out of the noise enough to trigger. 
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on October 31, 2020, 06:00:54 pm
Ok well I think I may be unable to do this with my motors. I  increased the current and speed and began to see a better wave form, but still to small to do anything with. I dont think my motors can take the current required to get a good clean wave form. They were getting REALLY hot with just under an amp of current after only about a minute of being on.
Also, it seem my budget power supply has some 500mv 100k ripple on it at 24v which might be adding to the really ugly wave forms.
Not sure what else to do from here on out.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: thm_w on November 02, 2020, 10:04:41 pm
Ok well I think I may be unable to do this with my motors. I  increased the current and speed and began to see a better wave form, but still to small to do anything with. I dont think my motors can take the current required to get a good clean wave form. They were getting REALLY hot with just under an amp of current after only about a minute of being on.
Also, it seem my budget power supply has some 500mv 100k ripple on it at 24v which might be adding to the really ugly wave forms.
Not sure what else to do from here on out.

I think you'd have to swap out the resistor or use an amplifier across it, if the issue is too low of a signal. Whether that is worth your time, and if the IC supports a larger sense resistor, not sure.
It looks like in the screenshot 200mV -> ~2.7A. The scope they used is nothing special, but they may have some persistence turned on as well, on those yellow and blue traces (because you can see double traces).

0.5V is a decent amount of ripple for 1A load, is it a branded supply? The meanwell 150-24V I have sitting here is rated for 150mV p-p.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on November 02, 2020, 10:15:53 pm
The power supply I have is an amazon cheapo Eventek, variable voltage and current limiting
These drivers are capable is delivering 20A Per coil so maybe that is why it’s got such a small sense resistor.
It’s little brother TMC2130 has a larger sense resistor and cannot deliver as much current to the motor.
Perhaps they were driving these a good amount.
I am only giving my motors a measly .5A. The drivers are extreme over kill for my printer, but I had issues with the 2130’s over heating. These stay nice and cool.

I was thinking maybe I could put a filter on my power supply output to remove the output ripple and see if it cleans up a bit. I don’t know much about filters, so I been spending the last few days looking into that.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: mawyatt on November 03, 2020, 01:30:02 am
I ran into this problem when we starting looking into the TMC5130 and developed a current monitor based upon the Hall Effect to sense and display the Sine and Cosine stepper motor currents. Later we developed controllers based upon the TMC5160 and TMC5072 with the RPi for use with precision macro photo stacking utilizing linear THK KR type rails for taking ultra-high resolution chip images we have developed.

The Trinamic devices use PWM to efficiently drive the motor coils, so the coil voltage is jumping around but the current is like a small triangular waveform sitting on top a large offset. You really need to use a good current probe capable of measuring DC currents to see the waveforms, and why we developed the Hall Effect Motor Current Sensors.

You can follow the details over at photomacrography.net from Mike's Labs.

https://www.photomacrography.net/forum/viewtopic.php?f=25&t=39689&hilit=Motor+Current+Sensor (https://www.photomacrography.net/forum/viewtopic.php?f=25&t=39689&hilit=Motor+Current+Sensor)

If you want details on the macro focus rail, controllers and images I can provide more info.

Best,
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on November 06, 2020, 04:36:56 am
Wow thats some next level stuff, nice work. I think for the moment I have reached my level of knowledge and need to bow out and put this adventure on hold.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: Hellmut1956 on March 31, 2021, 11:17:40 am
I got a message today from the company Watterott. They are the ones that do design the SilentStepSticks board for Trinamic, the company that designs and manufactures the TMCxxx Ics and the company has been acquired by Maxxim. They have just released a new version of the SilentStepSticksTMC5160HV being version 1.4. The board is now specified to be operated for up to 50 VDC. So I can use my Meanwell 600 W 48 VDC power supply.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: LiftedTrace on March 31, 2021, 01:16:25 pm
That’s good to know, thanks for sharing.
Title: Re: Tuning TMC5160 Trinamic Stepper Drivers
Post by: Herrmannthegerman on November 03, 2021, 04:12:47 pm
Hi there,

I'm currently testing the TMC5130 which is very similar to the TMC5160 (except that the TMC5160 allows for higher supply voltages) and wanted to provide my observations.

Datasheet is here: https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5130_datasheet_Rev1.18.pdf (https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5130_datasheet_Rev1.18.pdf)

The step motor I'm using is rather "small". It has a nominal phase current of 75 mA, a nominal voltage of 12 V and a phase resistance of 138 Ohm. I'm thus using 1 Ohm sense resistors to be able to set the "running" current to about 75 mA (see IRUN register). Vcc = 35 V. The motor is running at V = 100 000 ppt (which translates to about 300 full steps per second). The motor has 24 full steps per full revolution.

The expected "current signal" when sensing the current as a voltage across the sense resistors is seen on page 61 and reproduced in the first posting of this thread. Yellow and cyan curves are the sense resistor voltages.

When I attach a scope probe across the sense resistor (there are two handy test points on the TMC5130-EVAL board) I get a signal very similar to the one in the datasheet:

(https://www.eevblog.com/forum/beginners/tuning-tmc5160-trinamic-stepper-drivers/?action=dlattach;attach=1314302;image)


This is when "StealthChop" is off and the driver is in "SpreadCycle" chopper mode.

Now when I enable "StealthChop" mode, the current signal should look like (datasheet, page 51):

(https://www.eevblog.com/forum/index.php?action=dlattach;topic=258362.0;attach=1314311;image)
(https://www.eevblog.com/forum/beginners/tuning-tmc5160-trinamic-stepper-drivers/?action=dlattach;attach=1314308;image)

This driver boasts to have a very smooth current signal due to "StealthChop". However, I see this signal across the sense resistor on my oscilloscope:

(https://www.eevblog.com/forum/index.php?action=dlattach;topic=258362.0;attach=1314314;image)
[attach=3]

The signal seems to be clipped. At least it is not symmetrical or harmonic as the ones seen before.

Any idea why this is? Is it because I don't use a current probe but rather probe the voltage across the sense resistor?


PS: Sorry, I'm struggling to attach these images in a reader friendly way. Although I had selected "inline expandable thumbnail" when uploading they did not appear inline but at the end of posting.