Great title, I know. I have a driver board connected to a really small stepper motor. When I run it in step / dir mode it works.

But as soon as I connect either SCLK or MOSI the motor turns at double the rate, TMCs CS is low it turns in full speed and when CS is high the motor acts completely up, turns into the end stops, changes direction half way...

The serial output is always 1, I guess the chip simply does not send any data. With a pull-up I get all ones and when removing it I get either 0 or random nonsense.

I can't for the life of me figure out anything. It simply behaves completely weird and I have no idea whatsoever, why that thing simply does not work with the most basic "hello world" of motion controllers.

Thing I don't get. Why does the motor turn faster when connecting something? Why does the chip don't output any data at all? Why does it turn back and forth wildly?

My connections are all correct, I don't have open signal lines, my connections are not flaky and the power supply is perfectly fine.

I run the show on a Teensy 2.0++ with Arduino, since I want to understand the driver before working with a real language. The Library is TMC2130Stepper

TMC2130 Datasheet

SilentStepStick Datasheet

There is no schematic. It's simply the step interface, power supply and the ISP interface...

Arduino Code

#include <TMC2130Stepper.h>

#define PIN_LED PIN_D6
#define PIN_STP PIN_F0
#define PIN_DIR PIN_F1
#define PIN_EN  PIN_B5
#define PIN_CS  PIN_B4

TMC2130Stepper stepper = TMC2130Stepper(PIN_EN, PIN_DIR, PIN_STP, PIN_CS);

bool dir = true;

void setup() {
  pinMode(PIN_STP, OUTPUT);
  pinMode(PIN_DIR, OUTPUT);
  pinMode(PIN_EN, OUTPUT);
  pinMode(PIN_CS, OUTPUT);
  pinMode(MISO, INPUT);



  digitalWrite(PIN_LED, HIGH);

void loop() {
  digitalWrite(PIN_STP, HIGH);
  digitalWrite(PIN_STP, LOW);
  uint32_t ms = millis();
  static uint32_t last_time = 0;
  if ((ms - last_time) > 2000) {
    if (dir) {
      Serial.println("Dir -> 0");
      digitalWrite(PIN_DIR, dir);
    } else {
      Serial.println("Dir -> 1");
      digitalWrite(PIN_DIR, dir);
    dir = !dir;
    Serial.println(stepper.GCONF(), BIN);
    last_time = ms;

sketchy breadboard setup

I'm not the biggest fan of imgur, but it's not too important, just some additional view.

Without SPI, works great

With SPI, obviously does not work

  • 2
    \$\begingroup\$ We seem to be missing the schematic, link to the datasheets and maybe some code? \$\endgroup\$ – Transistor Jan 25 at 19:25
  • \$\begingroup\$ Added as requested \$\endgroup\$ – Julian F. Weinert Jan 25 at 19:37
  • \$\begingroup\$ It's simply boilerplate example stuff. Nothing custom, nothing weird. Just a simple test to get the driver somewhat running. The code is directly from the libraries author (with pinModes added, since it didn't work without) \$\endgroup\$ – Julian F. Weinert Jan 25 at 19:38
  • \$\begingroup\$ I'd be interested in seeing a schematic of the whole setup, and maybe even a photo. \$\endgroup\$ – pgvoorhees Jan 25 at 19:44
  • \$\begingroup\$ It's just a breadboard with nothing but these two modules. I'll post a photo in a moment. I'm aware of the issues with breadboards and tried a few different locations and routed the wires differently without any effect whatsoever \$\endgroup\$ – Julian F. Weinert Jan 25 at 19:56

When things don't make sense, then it's time to RTFM. According to the TMC2130 datasheet, the spi pins (and others) are configuration inputs.

Section 24 of the datasheet explains.

To select edit[SPI] standalone mode, you need to ground the SPI_MODE pin.

  • \$\begingroup\$ "To activate standalone mode, tie pin SPI_MODE to GND. SPI is off." That means to select stand alone mode you need to tie SPI_MODE to ground. I'm planning to use it either in step/dir mode (which uses SI for configuration). Refer to section 1, operation mode 1 \$\endgroup\$ – Julian F. Weinert Jan 26 at 1:16
  • 1
    \$\begingroup\$ yes, I did state the spi_mode backwards. dyslexia rules KO? \$\endgroup\$ – Kartman Jan 26 at 2:18
  • \$\begingroup\$ Thanks, that was the push in the right direction. The board was apparently shipped in standalone mode. Now I understand the changes in speed, since I had config pins instead of an SPI input. I removed the jumper and after some tinkering and yet another misplaced pin I got it to run! I'd like to accept your answer if you correct it. \$\endgroup\$ – Julian F. Weinert Jan 26 at 2:18
  • \$\begingroup\$ And thanks for your patience ;-) \$\endgroup\$ – Julian F. Weinert Jan 26 at 2:20
  • \$\begingroup\$ we've all been there. Do I get the answer vote? \$\endgroup\$ – Kartman Jan 26 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.