Multiple Devices on SPI Bus not working (TMC Steppers and Display)

Must be a difference on how Klipper is displaying the config in the klippy.log.

my .cfg file has:

[static_digital_output disable_sdcard]
pins: !PC5,!PD10,PB26,PB29,PB27
1 Like

Did you try to set all your “CS” pins (display + 5 x steppers) to high in the “static_digital_output” section?

If I put the Cs pins in the static_digital_output section, then Klipper fails due to multiple pins being assigned.

Did you also try it with the aliases?

Setup as all high, all low, and a mix of display high/TMC low and display low/TMC high, no difference.


[duplicate_pin_override]
pins:exp1_3,exp1_4,exp1_5,x_cs,y_cs,z_cs,e0_cs,e1_cs

#Prevents communication issues with SPI drivers
[static_digital_output disable_sdcard]
pins: !PC5,!PD10,!exp1_3,!exp1_4,!exp1_5,!x_cs,!y_cs,!z_cs,!e0_cs,!e1_cs

Bummer.

IMHO go with the KISS principle. Display + 1 stepper, no macros, no aliases, and cross your fingers!

Good luck, hcet14

I’ve already started to move the config down to an Arduino MEGA and see if one stepper and display can work.

That will validate the board design and let me focus on Grand Central board.

1 Like

Just configured up an Arduino MEGA 2560 with just a display and one TMC2130.
Same issue persists.

ATM, I’ll assume that this display requires full use of SPI.

Maybe another community member has some experience with this display and can comment.

Ok, please post your klippy.log

klippy(12).zip (5.2 MB)

mcu name is: mega

Klipper can’t write to a certain TMC 22130 register.

Check for the correct CS port address, the correct cabling and for the driver may be faulty.

@EddyMI3D Yes, that is the problem. When using both an SPI display with TMC2130’s, only the display works correctly. Disconnect the display, and the TMC’s all work correctly. Move the Display to use “software SPI” and both work correctly.

The TMC’s and the display share the same SPI bus.

1 Like

In your aliases section in line 115530 of your last klippy.log you use e.g. PL2 (your mcu (mega) pin connected to CS from your x stepper) two times.

Line 115540 ar47=PL2
Line 115582 x_cs=PL2

Configuration reference - Klipper documentation says “These aliases may not be used with stepper motor pins”. My impression is you just broke that rule.
That’s why

If you try my suggestion, could you please start with a fresh “klippy.log”? It takes forever searching in that monster :wink:

You are correct.

I’m not finding this quote under board_pins.
https://www.klipper3d.org/Config_Reference.html?h=alias#board_pins

It is under multi_pin, which I’m not using. Based on documentation, a board_pins alias would be acceptable. The TMC’s work with no issues without a display as well. However, I might just try it just to make sure.

I did spend a couple hours looking at some newer board schematics and I’ve seen that the boards implement multiple SPI bus’. Some implement software SPI pins for either the drivers or display. One design had hardware SPI for onboard SD and Display with extra pins for software SPI on the step-sticks.

When I removed the MKS Mini display in favor of a RRD display, I noticed that the temp on the MCU declined by about 5 degrees C. My guess is that either Klipper is flooding the SPI bus for the display or the display requires high bandwidth over SPI. I’ll be attempting a setup under Marlin in the near future.

I have another idea and am sure that is the reason!

I think your SPI isn’t using the same clock. The SPI clock signal used by your display has also to be used by your TMC2130s IC’s on their “CLK” pin. The “CLK” pins of your TMC2130 SilentStepSticks are connected to GND. So they use their internal oscillators.

That would explain, why display alone and TMCs alone work fine. When display and TMCs are connected, just the display works.

All slaves on an SPI have to use the same clock!

You are correct on the TMC’s.

I’ll have to dig into the display, but my guess is that is relying on the SPI sclk for timing and there is probably no other option.

Regarding display and steppers on “one” SPI!

Yes. The TMCs get their commands to a wrong clock. So their timing is completely messed up.

I guess you have to reconfigure the SilentStepSticks. Right now they are probably in “standalone mode”. “SPI_MODE” pin tied to GND (changing that is easy). I don’t know if it is easily possible to connect the “CLK” pins to SPI clock signal.

Alternative use two SPIs.

For what it is worth, I agree with Sineos’ earlier comments. The SPI protocol is designed for devices on the same pcb - it is known to be sensitive when multiple devices are hooked up to the same set of wires - in particular when “flying wires” are used between pcbs.

It is possible that there is an issue with the samd code. In order to track down something like that it would be necessary to use a tool like a logic analyzer to determine what the problem is and what component is at fault. As Sineos indicated, that can be a lot of tedious work. This doc may have some minor relevance: CANBUS Troubleshooting - Klipper documentation

Cheers,
-Kevin

SilentStepSticks and the mainboard are not on the same pcb, but may be slaves of an SPI.

Agree, but the pictures of his assembly are promising.

I don’t think so.

I still go with that.

Ain’t a physical “might be working” SPI!

Kind regards,
hcet14

There is no requirement to have a synchronized clock to use multiple chips on the same spi bus. Indeed, it’s common to have chips running with different internal clocks.

I don’t know what the root cause of jjarosz’s issue is. If you also don’t know, please don’t make wild guesses - it can cause a notable amount of lost time for others.

-Kevin