Hello,
I’ve got an Arduino Uno, a stepper motor driver (SilentStepStick with Trinamics TMC2100) and a small stepper motor. The motor works with a small test script, that sets the step pin manually to LOW and HIGH. But when I try to use the AccelStepper Library, it doesn’t work and I can’t figure out why.
Here’s the “manual” code, works really well:
#define EN_PIN 11 //enable (CFG6)
#define DIR_PIN 9 //direction
#define STEP_PIN 10 //step
#define CFG1_PIN 13
void setup()
{
pinMode(EN_PIN, OUTPUT);
digitalWrite(EN_PIN, HIGH); //deactivate driver (LOW active)
pinMode(DIR_PIN, OUTPUT);
digitalWrite(DIR_PIN, HIGH); //LOW or HIGH
pinMode(STEP_PIN, OUTPUT);
digitalWrite(STEP_PIN, LOW);
pinMode(CFG1_PIN, OUTPUT);
digitalWrite(CFG1_PIN, HIGH);
digitalWrite(EN_PIN, LOW); //activate driver
}
void loop()
{
//make steps
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(2000);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(2000);
}
Now here’s the AccelStepper script:
#include <AccelStepper.h>
#define DIR_PIN 9
#define STEP_PIN 10
#define EN_PIN 11
#define CFG1_PIN 13
AccelStepper stepper(1, STEP_PIN, DIR_PIN);
void setup() {
pinMode(CFG1_PIN, OUTPUT);
digitalWrite(CFG1_PIN, HIGH);
stepper.setPinsInverted(false, false, true);
stepper.setEnablePin(EN_PIN);
stepper.setSpeed(200);
}
void loop() {
stepper.runSpeed();
}
The stepper motor is powered, but it just doesn’t move at all. I tried varying speeds, inverted pins, etc. Nothing seems to work …
Maybe someone of you has a suggestion.
Thanks in advance,
- Bas3008