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
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.