Alright - I went for the ESP32 because my budget is a bit limited.
I used the code, posted below, and it works - but it still seems to be limited, in terms of speed. It is from this thread.
What I'm curious about still, though, is how to access the 30,000 step-pulses-per-second. The basic code below seems to do nothing if the baud-rate is increased. Can anyone help me to find more details about increasing the speed?
Thanks!
#include "FastAccelStepper.h"
#include <TMCStepper.h>
#define STEP_PIN 2
#define DIR_PIN 15
#define RXD2 16
#define TXD2 17
#define SHAFT true
#define SERIAL_PORT_2 Serial2 // TMC2208/TMC2224 HardwareSerial port - pins 16 & 17
#define DRIVER_ADDRESS_1 0b00 // TMC2209 Driver address according to MS1 and MS2
#define R_SENSE 0.11f // E_SENSE for current calc, SilentStepStick series use 0.11
FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;
TMC2209Stepper driver(&SERIAL_PORT_2, R_SENSE, DRIVER_ADDRESS_1); // Create TMC driver
int current = 1500;
int stall = 10;
int accel = 8000;
int max_speed = 19000;
int tcools = (3089838.00 * pow(float(max_speed), -1.00161534)) * 1.5; //*64 after max speed
int motor_microsteps = 16;
int motor_steps_per_rev = 200;
void setup() {
pinMode(DIR_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
// INTITIALIZE SERIAL0 ITERFACE
Serial.begin(115200);
delay(500);
Serial.println(F("---------------------------------------------------"));
Serial.println(F("UART0 serial output interface intitialized @ 115200"));
// INITIALIZE SERIAL2 UART FOR TMC2209
SERIAL_PORT_2.begin(115200); // INITIALIZE UART TMC2209, SERIAL_8N1, 16, 17
Serial.println(F("UART2 interface for TMC2209 intitialized @ 115200"));
Serial.println(F("---------------------------------------------------"));
//TMCSTEPPER SETTINGS
driver.begin();
driver.pdn_disable(true); // Use PDN/UART pin for communication
driver.toff(5); // [1..15] enable driver in software
driver.blank_time(24); // [16, 24, 36, 54]
driver.I_scale_analog(false); // Use internal voltage reference
driver.rms_current(current); // motor RMS current (mA) "rms_current will by default set ihold to 50% of irun but you can set your own ratio with additional second argument; rms_current(1000, 0.3)."
driver.mstep_reg_select(true);
read_ms();
driver.microsteps(motor_microsteps); //note that MicroPlyer will interpolate to 256
read_ms();
driver.TCOOLTHRS(tcools);
driver.seimin(1); // minimum current for smart current control 0: 1/2 of IRUN 1: 1/4 of IRUN
driver.semin(0);
driver.iholddelay(3); // 0 - 15 smooth current drop
driver.shaft(SHAFT);
driver.intpol(true); // interpolate to 256 microsteps
driver.SGTHRS(stall);
driver.pwm_autoscale(true); // Needed for stealthChop
driver.en_spreadCycle(false); // false = StealthChop / true = SpreadCycle, Spreadcycle can have higher RPM but is louder
driver.internal_Rsense(false);
driver.TPWMTHRS(0);
engine.init();
stepper = engine.stepperConnectToPin(STEP_PIN);
stepper->setDirectionPin(DIR_PIN);
stepper->setAutoEnable(true);
stepper->setSpeedInHz(max_speed);
stepper->setAcceleration(accel);
}
//***********************************************************************
void read_ms() {
uint16_t msread = driver.microsteps();
Serial.print("Microsteps: ");
Serial.println(msread);
}
//***********************************************************************
void loop() {
driver.microsteps(16);
read_ms();
driver.VACTUAL(19000); //SET SPEED OF MOTOR
delay(3000); // MOTOR MOVES 2 SEC THEN STOPS
driver.VACTUAL(0); //STOP MOTOR BY SETTING SPEED TO 0
delay(1000);
driver.microsteps(0);
read_ms();
driver.VACTUAL(-19000); //SET SPEED OF MOTOR
delay(3000); // MOTOR MOVES 2 SEC THEN STOPS
driver.VACTUAL(0); //STOP MOTOR BY SETTING SPEED TO 0
delay(1000);
}