TMC5160 not working despite working connection

Hi all!

I have a custom-built 3D printer with a Raspberry Pi 4 and a BIGTREETECH SKR V1.4 mainboard.
I just swapped my TMC2226 z motor driver with a TMC5160 motor driver for higher currents.
I even soldered both SD/SPI pins to VIO as shown here to definitely get SPI mode.
The output running the DUMP_TMC stepper=stepper_z command is:

TSTEP:      ffffffff tstep=1048575
PWM_AUTO:   ffffffff pwm_ofs_auto=255 pwm_grad_auto=255
PWM_SCALE:  ffffffff pwm_scale_sum=255 pwm_scale_auto=-1
OTP_READ:   ffffffff otp_fclktrim=31 otp_s2_level=1 otp_bbm=1 otp_tbl=1
MSCURACT:   ffffffff cur_a=-1 cur_b=-1
MSCNT:      ffffffff mscnt=1023
LOST_STEPS: ffffffff lost_steps=1048575
IOIN:       ffffffff refl_step=1 refr_dir=1 encb_dcen_cfg4=1 enca_dcin_cfg5=1 drv_enn=1 enc_n_dco_cfg6=1 sd_mode=1 swcomp_in=1 version=0xff
FACTORY_CONF: ffffffff factory_conf=31
DRV_STATUS: ffffffff sg_result=1023 s2vsa=1(ShortToSupply_A!) s2vsb=1(ShortToSupply_B!) stealth=1 fsactive=1 cs_actual=31 stallguard=1 ot=1(OvertempError!) otpw=1(OvertempWarning!) s2ga=1(ShortToGND_A!) s2gb=1(ShortToGND_B!) ola=1(OpenLoad_A!) olb=1(OpenLoad_B!) stst=1
GSTAT:      ffffffff reset=1(Reset) drv_err=1(ErrorShutdown!) uv_cp=1(Undervoltage!)
CHOPCONF:   ffffffff toff=15 hstrt=7 hend=15 fd3=1 disfdcc=1 chm=1 tbl=3 vhighfs=1 vhighchm=1 tpfd=15 mres=15(0usteps) intpol=1 dedge=1 diss2g=1 diss2vs=1
GCONF:      ffffffff recalibrate=1 faststandstill=1 en_pwm_mode=1 multistep_filt=1 shaft=1(Reverse) diag0_error=1 diag0_otpw=1 diag0_stall=1 diag1_stall=1 diag1_index=1 diag1_onstate=1 diag1_steps_skipped=1 diag0_int_pushpull=1 diag1_poscomp_pushpull=1 small_hysteresis=1 stop_enable=1 direct_mode=1 test_mode=1
========== Queried registers ==========
TPOWERDOWN: 0000000a tpowerdown=10
PWMCONF:    c40c001e pwm_ofs=30 pwm_autoscale=1 pwm_autograd=1 pwm_reg=4 pwm_lim=12
DRV_CONF:   00000400 bbmclks=4
COOLCONF:   00000000
THIGH:      00000000
TCOOLTHRS:  00000000
TPWMTHRS:   00000000
MSLUTSTART: 00f70000 start_sin90=247
MSLUTSEL:   ffff8056 w0=2 w1=1 w2=1 w3=1 x1=128 x2=255 x3=255
MSLUT7:     00404222 mslut7=4211234
MSLUT6:     49295556 mslut6=1227445590
MSLUT5:     b5bb777d mslut5=3048961917
MSLUT4:     fbffffff mslut4=4227858431
MSLUT3:     10104222 mslut3=269500962
MSLUT2:     24492929 mslut2=608774441
MSLUT1:     4a9554aa mslut1=1251300522
MSLUT0:     aaaab554 mslut0=2863314260
IHOLD_IRUN: 00061f1f ihold=31 irun=31 iholddelay=6
GLOBALSCALER: 0000009f globalscaler=159
========== Write-only registers ==========

But when I try homing the printer is resetted with the following error:

Unable to write tmc spi 'stepper_z' register GLOBALSCALER

This error seems to be common with the TMC5160 as shown here or here.

I even tried using UART mode as done with the TMC2226 before, but I could not access the driver.

How can I solve this issue?

I would be glad for any help and thanks in advance!

(my printer config file is attached here: printer.cfg (10.2 KB))

Please attach the klippy.log to your next post. It was asked for.

It does not work, as you may see in the output there is 0xff everywhere.
That most likely means that MISO is not connected.
Klipper by default pulls up SPI inputs.

Sorry this is my log file…
klippy.log (1.4 MB)

Ok, got to know, is at least my software setup right?

Ok, got to know, is at least my software setup right?

It looks like so:

[tmc5160 stepper_z] # SPI!
#uart_pin: P1.8
cs_pin: P1.8
spi_software_miso_pin: P0.5
spi_software_mosi_pin: P1.17
spi_software_sclk_pin: P0.4
interpolate: False
run_current: 1.900
stealthchop_threshold: 999999
#diag1_pin: P1.27
sense_resistor: 0.075

Yes, the pins look right…
Is there something I need to modify on my TMC5160 board to achieve a connection?
I have this one.

  1. There is nothing to solder on these modules.
  2. It is not rare for the TMC5160 to be dead on arrival.
  3. Try removing the BDsensor physically and its configuration to see if it makes a difference. There are reports that they might not be “getting along well”.

Thanks for the hints, I will try this later on! Although it doesn’t sound pretty good…
The TMC5160 also has UART mode when pulling both pins to GND, wouldn’t this be better? (just the CS pin is used then as with the other drivers)
Can I then just use the “tmc2209” driver to run it successfully?

As far as I am aware:

  • I reviewed the TMC5160 specification and it appears that UART can be used to control motion, but it is not entirely clear. For example, chapter 23.1 provides an example of generating steps via SPI but only shows how to get status information via UART.
  • Additionally, I believe that Klipper does not support UART on the TMC5160. Only SPI is implemented.

I am not an expert in this area, so take this with a grain of salt.

1 Like

That doesn’t sound good, but I will give it a try…

I could resolve the issue concerning the connection. I had to add jumpers to get SPI connection, sorry for missing this.

I have another issue: when I increase the run_current above 1.2A the following error occurs while homing:

TMC 'stepper_z' reports error: GSTAT:      00000001 reset=1(Reset)
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown

I don’t get this error when setting the current to 1.2A or below and the homing works fine.

Is it possible that the TMC5160 itself overheats (not the onboard MOSFETs)?

Do you have heatsinks installed? Have you tried active cooling? It’s usually not a heat-related error.
Also see TMC 'stepper' reports GSTAT: 00000001 reset=1(Reset)

Yes I have a heatsink installed and i even added heat pads and this still occurs.
When this is not temperature related, then maybe the voltage drops because the currents exceed the boards maximum designed current.
I will investigate the voltage drop and either add a decoupling capacitor or supply the driver externally…