I have been using the release version of this library in combination with the TMC2300-BOB. The breakout board is connected to a RPi Pico which is being programmed via USB/Arduino IDE.
So far I have been able to control the stepper via the legacy- as well as the UART-interface. The issue I came across is, that when I try to set the driver micro-steps inside the setup part of the code, the motor won't start turning until I unplug the motor-supply once. After plugging it back in the motor starts turning. The driver responds just fine with e.g. the micro-step- or RMS-values.
If I don't try to set the micro-steps during the setup-part the motor starts without any unplugging. What strikes me as weird, is that the motor runs considerably cooler (with the same current, same speed/ramp) even though the driver reports back the same micro-stepping rate.
I'm probably just doing something wrong, but I haven't been able to wrap my head around what exactly the issue is here. The motor running cooler might have something to do with the autoscaling?
Please see the attached code-snipped I used to ramp the motor up and down:
#include <TMCStepper.h>
#define EN_PIN 4 // Enable
#define SERIAL_PORT Serial1 // HardwareSerial port
#define DRIVER_ADDRESS 0b00 // TMC2209 Driver address according to MS1 and MS2
#define R_SENSE 0.15f // Match to your driver
bool shaft = false; // ONLY NEEDED FOR CHANGING DIRECTION VIA UART, NO NEED FOR DIR PIN FOR THIS
TMC2300Stepper driver(SERIAL_PORT, R_SENSE, DRIVER_ADDRESS);
int accel = 0;
void setup() {
SERIAL_PORT.begin(115200); // INITIALIZE UART to TMC2300
Serial.begin(115200);
delay(500);
Serial.println(F("Serial Initialized"));
pinMode(EN_PIN, OUTPUT);
digitalWrite(EN_PIN, LOW);
driver.begin(); // Initialize driver
driver.GSTAT(0b111); // Reset error flags
driver.enable_drv(true); // Unnecessary as 1 is default
driver.TCOOLTHRS(0x3FF); // 10bit max
driver.rms_current(200); // Set motor RMS current
Serial.print("current set to:");
Serial.println(driver.rms_current());
digitalWrite(EN_PIN, HIGH);
driver.microsteps(32); // <--- this requires a supply "reset" to let the motor start
driver.pwm_autoscale(true); // Needed for stealthChop
}
void loop() {
uint16_t msread=driver.microsteps();
Serial.print(F("Read microsteps via UART to test UART receive : "));
Serial.println(msread);
Serial.println("TMC2300 UART-Control");
delay(3000);
accel=200;
Serial.print("accel:");
Serial.println(accel);
long int spd = 42000;
Serial.print("spd:");
Serial.println(spd);
for (long int i = 0; i <=spd; i = i + accel){
driver.VACTUAL(i); //SET SPEED OF MOTOR
delay(100);
}
delay(10000);
for (long int i = spd; i >=0; i = i - accel){
driver.VACTUAL(i); //SET SPEED OF MOTOR
delay(100);
}
delay(200);
Serial.println(driver.rms_current());
shaft = !shaft; // REVERSE DIRECTION
driver.shaft(shaft); // SET DIRECTION
}
Greetings,
I have been using the release version of this library in combination with the TMC2300-BOB. The breakout board is connected to a RPi Pico which is being programmed via USB/Arduino IDE.
So far I have been able to control the stepper via the legacy- as well as the UART-interface. The issue I came across is, that when I try to set the driver micro-steps inside the setup part of the code, the motor won't start turning until I unplug the motor-supply once. After plugging it back in the motor starts turning. The driver responds just fine with e.g. the micro-step- or RMS-values. If I don't try to set the micro-steps during the setup-part the motor starts without any unplugging. What strikes me as weird, is that the motor runs considerably cooler (with the same current, same speed/ramp) even though the driver reports back the same micro-stepping rate.
I'm probably just doing something wrong, but I haven't been able to wrap my head around what exactly the issue is here. The motor running cooler might have something to do with the autoscaling?
Please see the attached code-snipped I used to ramp the motor up and down: