Hi, I am working on project using NEMA 17 steppers and TMC2209 drivers. As a start I have been getting familiar with the steppers and drivers and just getting them to turn at different speeds by manually sending HIGH and LOW pulses to the step pin.
I am having an issue where the motors start, run and stop, seemingly at random. Sometimes there is a delay before they start moving, I have been able to turn the shaft manually (no resistance) and then it seems to "click" and starts turning again.
I cannot figure out what is causing this and am looking for any advice. My best guesses so far are (a) the stepper I got off amazon was cheep and simply doesnt work very well, or (b) the driver may be overheating and shutting down to protect itself as it is quite hot to the touch.
This is my code as of right now:
constexpr uint8_t PIN_DIR {1};
constexpr uint8_t PIN_STEP {2};
constexpr uint8_t PIN_PDN1 {3};
constexpr uint8_t PIN_PDN2 {4};
constexpr uint8_t PIN_MS1 {5};
constexpr uint8_t PIN_MS2 {6};
constexpr uint8_t PIN_EN {7};
constexpr uint8_t PIN_LED {8};
unsigned long stepInterval = 1000;
void setup() {
//set output pins from Teensy to TMC2209 driver
pinMode(PIN_DIR, OUTPUT);
pinMode(PIN_STEP, OUTPUT);
pinMode(PIN_PDN1, OUTPUT);
pinMode(PIN_PDN2, OUTPUT);
pinMode(PIN_MS1, OUTPUT);
pinMode(PIN_MS2, OUTPUT);
pinMode(PIN_EN, OUTPUT);
pinMode(PIN_LED, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(PIN_PDN1, HIGH);
digitalWrite(PIN_PDN2, HIGH);
digitalWrite(PIN_MS1, LOW);
digitalWrite(PIN_MS2, LOW);
digitalWrite(PIN_EN, LOW);
digitalWrite(PIN_DIR, HIGH);
digitalWrite(PIN_STEP, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
delayMicroseconds(stepInterval);
digitalWrite(PIN_STEP, LOW);
digitalWrite(LED_BUILTIN, LOW);
delayMicroseconds(stepInterval);
}