Klipper state: Shutdown Running TMC5160 BTT Octopus 1.1

RPI4 (b)
BigTreeTech Octopus v1.1

Cannot get TMC5160 running on Klipper, Printer runs fine in Marlin Firmware.

Tried searching for days, read every thing possible.
All Firmware updated, Klipper, Moon ,Mainsail, Klipper Screen, System

running in console : FORCE_MOVE STEPPER=stepper_x DISTANCE=10 VELOCITY=5
Klipper state: Shutdown

Klipper Log:

Sending MCU ‘mcu’ printer configuration…
Configured MCU ‘mcu’ (1024 moves)
TMC stepper_x failed to init: Unable to write tmc spi ‘stepper_x’ register GLOBALSCALER
TMC stepper_y failed to init: Unable to write tmc spi ‘stepper_y’ register GLOBALSCALER
TMC stepper_z failed to init: Unable to write tmc spi ‘stepper_z’ register GLOBALSCALER
TMC stepper_z1 failed to init: Unable to write tmc spi ‘stepper_z1’ register GLOBALSCALER
TMC stepper_z2 failed to init: Unable to write tmc spi ‘stepper_z2’ register GLOBALSCALER

New Install so I am trying to move each axis to verify direction movement, before trying to do a Home. Klipper log https://github.com/Klipper3d/klipper/files/8857465/klippy.log

DUMP_TMC stepper=stepper_x

04:03:43
TSTEP: ffffffff tstep=1048575
04:03:43
PWM_AUTO: ffffffff pwm_ofs_auto=255 pwm_grad_auto=255
04:03:43
PWM_SCALE: ffffffff pwm_scale_sum=255 pwm_scale_auto=-1
04:03:43
OTP_READ: ffffffff otp_fclktrim=31 otp_s2_level=1 otp_bbm=1 otp_tbl=1
04:03:43
MSCURACT: ffffffff cur_a=-1 cur_b=-1
04:03:43
MSCNT: ffffffff mscnt=1023
04:03:43
LOST_STEPS: ffffffff lost_steps=1048575
04:03:43
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
04:03:43
FACTORY_CONF: ffffffff factory_conf=31
04:03:43
DRV_STATUS: ffffffff sg_result=1023 s2vsa=1 s2vsb=1 stealth=1 fsactive=1 csactual=255 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
04:03:43
GSTAT: ffffffff reset=1(Reset) drv_err=1(ErrorShutdown!) uv_cp=1(Undervoltage!)
04:03:43
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
04:03:43
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
04:03:43
========== Queried registers ==========
04:03:43
TPOWERDOWN: 0000000a tpowerdown=10
04:03:43
PWMCONF: c40c001e pwm_ofs=30 pwm_autoscale=1 pwm_autograd=1 pwm_reg=4 pwm_lim=12
04:03:43
COOLCONF: 00000000
04:03:43
TPWMTHRS: 0000005f tpwmthrs=95
04:03:43
IHOLD_IRUN: 00061f1f ihold=31 irun=31 iholddelay=6
04:03:43
GLOBALSCALER: 000000b8 globalscaler=184
04:03:43
========== Write-only registers ==========

Be sure to check

https://www.klipper3d.org/TMC_Drivers.html#i-keep-getting-unable-to-write-tmc-spi-stepper_x-register-errors

Who manufactured the step-sticks?
Have you tried placing them in your board one by one to see if one might be faulty and dragging down the rest? Obviously good ones should be able to properly respond to DUMP_TMC

Thanks Sineos I will remove all drives and test at one spot. what weird is I can switch back to the Marlin firmware.bin and print .

@Sineos can you tell me how Klipper knows my board? Octopus 1.1? or all STM32F446ZET6 pin outs the same?

All STM32F446ZET6 have the same set of pins. Pins have different functions assigned to them. Some can be used for PWM, some are just digitial IO, some are able to measure analogue values (ADC) etc. Another set of pins have special bus functions like SPI, I2C, UART etc associated with them.

For example:

  • PA1, PA2 and PA8 are PWM capable pins, so they could be used for controlling heatbed, fans, hotends or LEDs, etc
  • PF3 and PF4 are analogue to digital (ADC) capable pins, so they could be used for measuring temperatures (which reads an analogue resistance value or rather the voltage drop over such resistors)

It is up to the manufacturer of your board, which pins he uses for which function or if at all.
So, one manufacturer might choose to assign PA8 to a hotend and provide the needed connectors, while another uses PA1 for the same purpose.

Klipper uses its cfg file to determine just that: Which pin is used to control which aspect of the printer.

Thanks I needed to know that. I found my issue, going back to Marlin firmware, I issued a M122, it showed the driver connection error, I had a TMC2226 uart driver in the extruder spot, that working driver stopped marlin from showing TMC Connection error on the display. I replaced the tmc2226 with a LV8729 thinking the TMC2226 Uart driver may not work with the TMC5160 spi drivers. it did not fix the connection error, but marlin firmware when boot shows the TMC connection error now on the screen. but yet marlin lets you run, and print . I guess marlin firmware sets the drives to standalone. Now to see why the 5160 not working with spi.

Good day!
So, I bought Mellow FLY-SHT42 and FLY-UTOC-3 boards, connected them. At the same time, I updated the firmware on all MCUs.
At the moment the configuration is:

RPi 3B+ => USART => BTT GTR 1.0 + BTT M5
and to the same RPi 3B+ => USB => FLY-UTOC-3 => CAN => FLY-SHT42

BTT GTR 1.0 has two drivers (X and Y) BTT TMC5160 v1.2 connected via SPI.

Before installing the “moving” of the head on the FLY-SHT42, everything worked fine, I decided to minimize the number of wires. :slight_smile:

Now the error “TMC stepper_x failed to init: Unable to write tmc spi ‘stepper_x’ register GLOBALSCALER” and “TMC stepper_y failed to init: Unable to write tmc spi ‘stepper_y’ register GLOBALSCALER” appears periodically.

You can get rid of it after long and painful reboots (power off and on) of the 3D printer.
I did an experiment, deleted all the settings associated with FLY-SHT42, i.e. in fact, Klipper did not see this MCU, but the error remained.

How to fix?

klippy.log (177.8 KB)

Refer to: TMC drivers - Klipper documentation and TMC 'extruder' reports error: GSTAT: 00000001 reset=1(reset - #39 by Sineos

Most likely some hardware issue

In general, I continued my “experiments”: :slight_smile:

  • completely disconnected FLY-SHT42 from FLY-UTOC-3 (4 CAN wires) and removed the can0 interface on RPi… and the error remained;
  • disconnected motors X and Y from BTT GTR 1.0… the error is in place;
  • changed connection mode (changed jumpers) of X and Y drivers from SPI to UART… same error;
  • replaced two BTT TMC5160 v1.2 (X and Y) with BTT TMC2209 v1.2… the error is GONE.

So, it turns out that on the day I installed FLY-SHT42 in a 3D printer, the software SPI disappeared on the BTT GTR 1.0, or did two BTT TMC5160 v1.2 fail SIMULTANEOUSLY?

The most interesting thing is that on the same pins, but only in UART mode, BTT TMC2209 v1.2 works fine… by the way, it works fine, but on hardware SPI, and MAX31855K ​​wired to BTT GTR 1.0

P.S. To eliminate the problem with BTT GTR 1.0, I will connect the Mellow FLY PT100 thermistor board to the driver’s free space, which uses the same software SPI as BTT TMC5160 v1.2… and something tells me that it will work without problems.

From the documentation as linked above:

Note that if the driver is on a shared SPI bus with multiple devices then be sure to fully configure every device on that shared SPI bus in Klipper. If a device on a shared SPI bus is not configured, then it may incorrectly respond to commands not intended for it and corrupt the communication to the intended device. If there is a device on a shared SPI bus that can not be configured in Klipper, then use a static_digital_output config section to set the CS pin of the unused device high (so that it will not attempt to use the SPI bus). The board’s schematic is often a useful reference for finding which devices are on an SPI bus and their associated pins.

This means other SPI devices on the same SPI bus that are not fully configured / incorrectly configured / have issues with certain SPI modes can indeed spoil your fun.