Thank wolframore for your input.
I've checked out those information. My problem was I was being to stubborn to make it work as a drop-in for A4988. But upon rewiring and using the TMC2208 library I was able to make the driver work. But now I'm faced with new problems. I am unable to make the driver choose microstepping using code. With the two MS1 and MS2 pins, I can only make it have only 8 microstepping, where I want at least 16-32 microstepping. I cant seem to figure it out.
Here is a code that I'm trying out right now. Although I'm defining to use the MSTEP register using the mstep_reg_select function, the driver seems to be using a default microstepping.
Can you, or anyone point me to a good source where I can get some examples of how to configure the driver properly?
CODE:
// Running on Nano v3
#define EN_PIN 10 // LOW: Driver enabled. HIGH: Driver disabled
#define STEP_PIN 7 // Step on rising edge
#define MS1 11
#define MS2 12
#define DIR_PIN 6
#include <TMC2208Stepper.h>
TMC2208Stepper driver = TMC2208Stepper(&Serial);
#include <AccelStepper.h>
AccelStepper stepper(1, STEP_PIN, DIR_PIN);
void setup() {
//Serial.begin(115200); // Init used serial port
//while(!Serial); // Wait for port to be ready
// Prepare pins
pinMode(EN_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
digitalWrite(EN_PIN, HIGH); // Disable driver in hardware
//pinMode(DIR_PIN, OUTPUT);
// Prepare pins
//pinMode(MS1, OUTPUT); //setting the MS1 and MS2 this way works up to 8 mictrosteps
//pinMode(MS2, OUTPUT);
//digitalWrite(MS1, HIGH);
//digitalWrite(MS2, HIGH);
driver.pdn_disable(1); // Use PDN/UART pin for communication
driver.mstep_reg_select(1); // TRYING TO SET THE MICROSTEPS LIKE THIS, BUT TO NO AVAIL!!
driver.microsteps(0);
driver.I_scale_analog(0); // Adjust current from the registers
driver.rms_current(500); // Set driver current 500mA
driver.toff(0x2); // Enable driver
digitalWrite(EN_PIN, LOW); // Enable driver
stepper.setMaxSpeed(1000);
stepper.setAcceleration(1000);
stepper.moveTo((200 * 16) * 1); //200 for the stepper's original steps/revolution, 16 is the microsteps and 1 is the number of turns
}
void loop() {
// If at the end of travel go to the other end
if (stepper.distanceToGo() == 0)
stepper.moveTo(-stepper.currentPosition());
stepper.run();
}