Trinamic parameter tuning

Have questions about the equipment used for macro- or micro- photography? Post those questions in this forum.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

Andy Davies
Posts: 142
Joined: Tue Dec 09, 2014 3:25 pm

Trinamic parameter tuning

Post by Andy Davies »

I have 6 Trinamic TOS-100 boards with TMC260 motor chips driving a 6 axis system with an Arduino Mega that has different size stepper motors handling different loads.

I want to tune the following parameters for each one:

1. Stall Guard railStepper.setStallGuardThreshold(threshold, filter)

2. railStepper.setSpreadCycleChopper(2,24,8,6,0) where the values are for constant_off_time, blank_time, hysteresis_start, hysteresis_end, hysteresis_decrement

I have not had any joy in using the TMC26XmotorTest in testing these parameters.

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Re: Trinamic parameter tuning

Post by mawyatt »

Andy,

We've not used the Trinamic Test boards, but found that having an accurate view of the motor Sine and Cosine current waveforms valuable in setting the controller parameters for the TMC 5072, 5130 and 5160 Trinamic devices and various stepper motors and focus rails. To view the motor currents you can use a current probe like the Hantek CC-65 (need two), or a DIY dual current monitor like described on here awhile back. Of course you'll also need an oscilloscope, but any type should work. Also didn't find Trinamic CS very helpful, we found that you are kind of "on your own" regarding any help from them unless you are an OEM source!

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

Andy Davies
Posts: 142
Joined: Tue Dec 09, 2014 3:25 pm

Re: Trinamic parameter tuning

Post by Andy Davies »

Can the Stallguard value be found by starting low so that the motor stalls and then increasing the vale until it moves? I think I've found that the behaviour is different depending on whether you are going clockwise or anticlockwise!

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Re: Trinamic parameter tuning

Post by mawyatt »

Andy Davies wrote:
Fri Jul 03, 2020 5:06 pm
Can the Stallguard value be found by starting low so that the motor stalls and then increasing the vale until it moves? I think I've found that the behaviour is different depending on whether you are going clockwise or anticlockwise!
Don't know, probably best to study the Trinamic documentation. We don't use stall guard since the rail length, screw pitch, motor steps are all known and loaded as basic parameters and the control is such as to not run into either rail end. On the THK KR20 rails they have a start magnetic sensor which a routine was created to define this as the "Zero Home" position, this feature was included in the custom 5072, 5130, 5160, 5130 + 5072 Triple Axis Controllers. It was not included in the Quad Axis Controller (Dual 5072) because of space limitations on the Raspberry Pi Custom Hat implementation.

The THK rails also have rubber "bumpers" at each end which will "squeal" when they are engaged, this give a good audio feedback when you do something wrong :oops: However, no harm to the rail nor motor which is nice :roll:

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

kaleun96
Posts: 270
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Re: Trinamic parameter tuning

Post by kaleun96 »

Andy Davies wrote:
Fri Jul 03, 2020 5:06 pm
Can the Stallguard value be found by starting low so that the motor stalls and then increasing the vale until it moves? I think I've found that the behaviour is different depending on whether you are going clockwise or anticlockwise!
I've noticed this too, one direction runs slightly slower than the other as well.

Tuning the parameters of the Trinamic drivers while "blind" (i.e. no oscilloscope) can be quite difficult because you may happen across an acceptable parameter value but not get the result you wanted because another parameter has the incorrect value. I've read the datasheet who knows how many times and I still have a hard time juggling the relationship between all the different parameters.

In general I think it's best to take Trinamic's advice and leave the stallguard threshold at 0 and try to get it working by changing the other parameters. If you then end up with something close to working but not perfect, you could adjust the threshold a little.

If you haven't set this up already, I recommend writing an Arduino/RPi program that allows you to adjust all of the parameters on command, rather than having to upload a new program/sketch each time you change a parameter.
- Cam

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Re: Trinamic parameter tuning

Post by mawyatt »

kaleun96 wrote:
Mon Jul 06, 2020 1:31 am
Andy Davies wrote:
Fri Jul 03, 2020 5:06 pm
Can the Stallguard value be found by starting low so that the motor stalls and then increasing the vale until it moves? I think I've found that the behaviour is different depending on whether you are going clockwise or anticlockwise!
I've noticed this too, one direction runs slightly slower than the other as well.

Tuning the parameters of the Trinamic drivers while "blind" (i.e. no oscilloscope) can be quite difficult because you may happen across an acceptable parameter value but not get the result you wanted because another parameter has the incorrect value. I've read the datasheet who knows how many times and I still have a hard time juggling the relationship between all the different parameters.

In general I think it's best to take Trinamic's advice and leave the stallguard threshold at 0 and try to get it working by changing the other parameters. If you then end up with something close to working but not perfect, you could adjust the threshold a little.

If you haven't set this up already, I recommend writing an Arduino/RPi program that allows you to adjust all of the parameters on command, rather than having to upload a new program/sketch each time you change a parameter.

Good advise Cam, we often create custom "test programs" to help evaluate various performance parameters....very handy and a big time saver! Also can't emphasize how valuable an oscilloscope is, especially for DIYers. Any scope is fine for this type of work.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

Post Reply Previous topicNext topic