Marlin
Marlin copied to clipboard
[FR] TMC5161 stepper driver support
I have encountered a problem, I use the latest marlin firmware and 5160 is OK on my motherboard. The configuration is not changed, only the drive is changed to 5161, and the information displayed using M122 is normal, but when I move the XYZ axis, there is only a little movement and then it cannot move. I used M122 to see the information changed.
move_before:
move_x_asis:
Please tell me where the problem is(TMC5160 is OK on my motherboard).
Can you add your configuration files, including your pins file if you have modified it.
I would also like to know if you see the same results every time you run M122, or if the results are somewhat random.
我还想知道每次运行M122时是否看到相同的结果,或者结果是否有些随机。
Hi,this is my configuration file, the pin file has not been moved configuration.zip. Every time I move any axis, the mstep of the corresponding axis will become 256, and then the motor will not move.
This might be related to https://github.com/MarlinFirmware/Marlin/issues/16311.
That issue was closed since the fix belongs to TMCStepper, but there is a workaround described that you could try.
This might be related to #16311.
That issue was closed since the fix belongs to TMCStepper, but there is a workaround described that you could try.
Hello, is there any other solution besides this, I will try one by one.
I used a logic analyzer and here is the result:
My problem has not been solved, this seems to have nothing to do with TMCStepper, I try to reduce the speed of SW_SPI, and the result of M122 is not random, it only changes after I move the axis, and each time after the change, M122 The results are also fixed. I also want to know if there are other ways to get my 5161 working properly.
My problem has not been solved, this seems to have nothing to do with TMCStepper, I try to reduce the speed of SW_SPI, and the result of M122 is not random, it only changes after I move the axis, and each time after the change, M122 The results are also fixed. I also want to know if there are other ways to get my 5161 working properly.
@sjasonsmith does the info from @lijinlin19970813 make any bells ring?
@sjasonsmith does the info from @lijinlin19970813 make any bells ring?
@boelle These are SPI-connected drivers. Everything I have been has been for UART-connected drivers. I've never used either of these.
The behavior you're describing could be due to too little power being used for the speed, acceleration, jerk, and microstep settings.
One possibility is the RSENSE settings specified in the Configuration_adv.h file are wrong. The current settings are 0.11 Ohms. A picture I saw that showed both the 5160 & 5161 pololu driver modules showed 0.075 Ohm resistors on the 5160 and 0.062 Ohm resistors on the 5161. You'll need to physically examine your modules to see what resistors are actually used.
I doubt that this is your problem. If my numbers are accurate you are actually sending more current to the steppers than specified in Configuration_adv.h.
I suggest you try some RIDICULOUSLY conservative settings to see if that is the problem. Try setting microsteps to 4, cut steps per unit by 4, cut acceration max by 10, cut max speed by 10 and decrease jerk by 10. Then manually issue really slow movement commands (G0 X20 F200).
The behavior you're describing could be due to too little power being used for the speed, acceleration, jerk, and microstep settings.
One possibility is the RSENSE settings specified in the Configuration_adv.h file are wrong. The current settings are 0.11 Ohms. A picture I saw that showed both the 5160 & 5161 pololu driver modules showed 0.075 Ohm resistors on the 5160 and 0.062 Ohm resistors on the 5161. You'll need to physically examine your modules to see what resistors are actually used.
I doubt that this is your problem. If my numbers are accurate you are actually sending more current to the steppers than specified in Configuration_adv.h.
I suggest you try some RIDICULOUSLY conservative settings to see if that is the problem. Try setting microsteps to 4, cut steps per unit by 4, cut acceration max by 10, cut max speed by 10 and decrease jerk by 10. Then manually issue really slow movement commands (G0 X20 F200).
I changed the RSENSE to over 0.062, it is still invalid, but I will try what you said to change other parameters to try the effect.
Also double the current settings in configuration_adv.h
@lijinlin19970813 did the last suggestion from @Bob-the-Kuhn help?
do we have a bug or does it more look like a config error?
It still happens, at least for me. With the latest TMCStepper library (0.6.1 as of posting), I can get up and down movement by jogging manually. Homing seems to work fine too, however, around the first few probes, the Z simply stops moving.
Whatever is happening, the stepper entirely seems to shut off. I can freely move the rod the moment the failure occurs. Unfortunately, I'm using a BTT E3 board, and I don't have enough memory for TMC_DEBUG currently.
Ok, I stripped down the code enough to get M122 on the machine. It's an E3 DIP, with 2208s in UART on the X, Y, and E0. Z is the 5161.
SENDING:M122
X Y Z E
Enabled false false false false
Set current 650 800 1000 700
RMS current 642 795 990 673
MAX current 905 1121 1396 949
Run current 20/31 25/31 19/31 21/31
Hold current 18/31 22/31 17/31 18/31
Global scaler 133/256
CS actual 18/31 22/31 17/31 18/31
PWM scale 21 25 16 21
vsense 1=.18 1=.18 1=.18
stealthChop true true true true
msteps 16 16 16 16
tstep max max max max
pwm
threshold
[mm/s]
OT prewarn false false false false
OT prewarn has
been triggered false false false false
off time 3 3 3 3
blank time 24 24 24 24
hysteresis
-end -1 -1 -1 -1
-start 1 1 1 1
Stallguard thrs 0
DRVSTATUS X Y Z E
stallguard
sg_result 0
fsactive
stst * * * *
olb
ola
s2gb
s2ga
otpw
ot
157C
150C
143C
120C
s2vsa
s2vsb
Driver registers:
X 0xC0:12:00:00
Y 0xC0:16:00:00
Z 0x80:11:40:00
E 0xC0:12:00:00
Testing X connection... OK
Testing Y connection... OK
Testing Z connection... OK
Testing E connection... OK`
I then perform a move (up is fine, it's the direction change too that causes the issue), the microsteps changes to 256 and the address changes as well:
G1 Z10
SENDING:G1 Z10
G1 Z0
SENDING:G1 Z0
M122
SENDING:M122
X Y Z E
Enabled false false false false
Set current 650 800 1000 700
RMS current 642 795 990 673
MAX current 905 1121 1396 949
Run current 20/31 25/31 19/31 21/31
Hold current 18/31 22/31 17/31 18/31
Global scaler 133/256
CS actual 18/31 22/31 8/31 18/31
PWM scale 21 25 8 21
vsense 1=.18 1=.18 1=.18
stealthChop true true false true
msteps 16 16 256 16
tstep max max max max
pwm
threshold
[mm/s]
OT prewarn false false false false
OT prewarn has
been triggered false false false false
off time 3 3 0 3
blank time 24 24 36 24
hysteresis
-end -1 -1 -1 -1
-start 1 1 6 1
Stallguard thrs 0
DRVSTATUS X Y Z E
stallguard
sg_result 0
fsactive
stst * * * *
olb
ola
s2gb
s2ga
otpw
ot
157C
150C
143C
120C
s2vsa
s2vsb
Driver registers:
X 0xC0:12:00:00
Y 0xC0:16:00:00
Z 0x80:08:00:00
E 0xC0:12:00:00
Testing X connection... OK
Testing Y connection... OK
Testing Z connection... OK
Testing E connection... OK
At this point, the stepper no longer responds, and requires a reboot of the firmware to regain control. Depending on the motion, the Z address will change each time the failure occurs. I've seen 0x80:08:40:00 as well as 0x80:0D:40:00.
I have attached my config files for reference.
Hi,
I‘ve got the same problem with my TMC5161 drivers. I tried the decrease of sw spi clock with no succes. If i force the drivers to use chop mode, the Steppers are working. Current Must be in a small Range window to prevent it from stop. If I try to use faster movements the Steppers stop working at Point of Switch to spread Cycle.
a lot of updates and fixing has happend in the last week, is the problem still there?
@boelle I'll try and set up a test rig tonight. https://github.com/teemuatlut/TMCStepper/blob/master/src/source/TMC_platforms.h has not been modified for the stm32 platform, only for the LPC176x family.
Luckily, I have one E3 DIP machine standing by.
Just compiled 2.0.3.
Environment: BIGTREETECH E3 DIP 1.0 (STM32F103RC, 256k, NOUSB) Steppers: X: BIGTREETECH TMC2208 V3.0 UART Y: BIGTREETECH TMC2208 V3.0 UART Z: BIGTREETECH TM5161 V1.1 SPI (Configured as TMC5160 with TMC_USE_SW_SPI) E: BIGTREETECH TMC2208 V3.0 UART
All steppers detected. Issuing a home command, Z engages but does not move. X and Y homing continues, but Z is seemingly disengaged. Unable to enable M122 due to lack of memory. But likely previous issues noted above.
Without recompiling the firmware, I replaced the problematic stepper with a BIGTREETECH TMC5160 V1.2. As expected, the stepper engages and moves in both forward and reverse directions without issue.
It appears as though there were further changes to the 5161 series than simply integrating the MOSFETs into the die. Adding to the concerns, the product page notes product changes are currently underway: https://www.trinamic.com/products/integrated-circuits/details/tmc5161/
I will reach out to Trinamic for comment. For the time being, I would recommend users stick with the refined 5160s, as they are operating as expected.
is it the same with bugfix 2.0.x ?
is it the same with bugfix 2.0.x ?
bf2 is only one commit ahead of 2.0.3. Testing with it would be a waste of time.
I still got the same issue, I posted it on the BTT Github, but nobody responsed to it in the last 5 weeks...
I also cut the CLK-Pin from the 5160 and the 5161. The 5160 are working fine, but the 5161 make a little move and stop after that without any failure. I changed the "RSense" from 0.075 (5160) to 0.060 (5161)
I tried it on the SKR Pro V1.1 and today with a completly new setup on the SKR V1.4 Turbo The 5160 work well and the 5161 are stopping immediatly.
Can someone tell me if it is normal, that the drivers are very loud with 0.9° Steppers? I'm using them in a CoreXY and need around 1.5V to get the Steppers warm up to 40°C . If I use only 1.2V the Steppers are not so noisy, but the Steppers are cold as ice and I'm loosing steps like hell...
These drivers are really crappy. I tried everything on a SKR 1.1 Pro, I couldn't get them to work. I don't understand how Bigtreetech makes them work on this video https://www.youtube.com/watch?v=UW_JtHcgcd4, support never answered my questions!
I can't seem to get my TMC5160 working, either. Connected one as a test to E0 and M122 does the following:
I've snipped the CLK pin, tried with and without connecting CLK to ground, adjusted RSENSE to 0.075 Ohm and nothing seems to work. Here's my current configuration (nightly bugfix build, 02/04/2020): Configuration.zip
Maybe someone has an idea of what I could have missed. I haven't tried limiting the SPI speed and honestly I don't really know how to do that, either.
Well, for one thing, we don't formally support the 5161. As for the 5160 not working, well I'm not sure how well supported it is now in TMCStepper either. It is all very new, so we may have to wait on @teemuatlut to find some free time to troubleshoot them generally. We have a set of them here, but at the moment my custodial duties are taking up too much time to dive into testing. But perhaps @shitcreek and I will find some time to play around with 5160's later this week.
If it's only a matter of weeks, I'm still hopeful. With my knowledge of steppers drivers I can unfortunately not help. Thanks for everything else.
@Werebear93 I dont know what physical driver slots are configured on your board, but this looks off to me. Z/Z2 if you are using dual Z motors this would be strange.
#if AXIS_IS_TMC(Z)
#define Z_CURRENT 800
#define Z_CURRENT_HOME Z_CURRENT
#define Z_MICROSTEPS 16
#define Z_RSENSE 0.11
#define Z_CHAIN_POS -1
#endif
#if AXIS_IS_TMC(Z2)
#define Z2_CURRENT 800
#define Z2_CURRENT_HOME Z2_CURRENT
#define Z2_MICROSTEPS 16
#define Z2_RSENSE 0.075
#define Z2_CHAIN_POS -1
#endif
Also checking your voltage, are you running a 24v or 12v system?
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V
Have exactly the same issue. After disabling SOFTWARE_DRIVER_ENABLE and STEALTHCHOP_X _Y _Z _E, the TMC5161 runs. But no features then... TMC5161 on SKR_1.4_Pro with SPI and recent Marlin Bugfix branch.
RSENSE - Nothing helped... here are the Informations:
// | --------------------------------------------------------------------------|
// | RSENSE [Ω] | RMS current [A](CS=31) | Sine wave peak current [A] (CS=31) |
// | 0.22 | 1.1 | 1.5 |
// | 0.15 | 1.6 | 2.2 |
// | 0.12 | 2.0 | 2.8 |
// | 0.10 | 2.3 | 3.3 |
// | 0.075 | 3.1 | 4.4 |
// | 0.066 | 3.5 | 5.0 |
// | 0.060 | 3.8 | 5.4 | <--
// | --------------------------------------------------------------------------|
// Documentation --> 9 Selecting Sense Resistors List -
https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5161-datasheet_Rev1.02.pdf