Hi!!
I have successfully connected a TMC2208 driver to a stepper motor for a project I am working on. However, it seems like even if I set the pins which control the microstepping setting to the highest option (so to get 1/256 microstepping), I only get 1/16 (so a total of 3200 steps per rotation). I am using a shield which is not for the TMC2208 driver, but even if I breadboard the driver and manually set the MS1 and MS2 pins to HIGH, I still only get 1/16 microstepping.
I have tried using no library and AccelStepper and they both give the same result. I am counting the number of steps based on the following code. Am I missing something? Is it that the driver interpolates and some steps are simply not accounted for in the Arduino IDE?
#include <AccelStepper.h>
// Define stepper motor connections
#define STEP_PIN 2
#define DIR_PIN 4
// Set the number of steps per revolution and microstepping mode
const long STEPS_PER_REV = 3200; // Full steps per revolution
bool done = false;
// Create an instance of AccelStepper
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
void setup() {
Serial.begin(115200);
// Set the maximum speed and acceleration of the stepper motor
stepper.setMaxSpeed(0.25 * STEPS_PER_REV); // 0.2 rotations per second
stepper.setAcceleration(2.0 * STEPS_PER_REV); // 2 rotations per second squared
// Set the initial position and enable the stepper motor
stepper.setCurrentPosition(0);
stepper.enableOutputs();
}
void loop() {
// Move the stepper motor for 20 rotations
if (!done) {
stepper.move(-20 * STEPS_PER_REV);
stepper.setSpeed(0.25 * STEPS_PER_REV);
done = true;
}
// Update the stepper motor
stepper.runSpeedToPosition();
}