# TMC2130 does not work properly

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);

Serial.begin(115200);
while(!Serial);

stepper.begin();
stepper.SilentStepStick2130(20);
stepper.stealthChop(1);

digitalWrite(PIN_LED, HIGH);
}

void loop() {
digitalWrite(PIN_STP, HIGH);
delayMicroseconds(200);
digitalWrite(PIN_STP, LOW);
delayMicroseconds(200);

uint32_t ms = millis();
static uint32_t last_time = 0;

if ((ms - last_time) > 2000) {
if (dir) {
Serial.println("Dir -> 0");
//stepper.shaft_dir(0);
digitalWrite(PIN_DIR, dir);
} else {
Serial.println("Dir -> 1");
//stepper.shaft_dir(1);
digitalWrite(PIN_DIR, dir);
}

dir = !dir;

Serial.println(stepper.GCONF(), BIN);
last_time = ms;
}
}


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

• We seem to be missing the schematic, link to the datasheets and maybe some code? – Transistor Jan 25 at 19:25
• Added as requested – Julian F. Weinert Jan 25 at 19:37
• 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) – Julian F. Weinert Jan 25 at 19:38
• I'd be interested in seeing a schematic of the whole setup, and maybe even a photo. – pgvoorhees Jan 25 at 19:44
• 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 – Julian F. Weinert Jan 25 at 19:56