Need help with tmc2208 and ramps 1.4

I want to test a setup for a project with nema 17 stepper motor connected to tmc2208 v3 in UART mode tmc is connected to ramps 1.4 which is mounted on a Arduino mega . I connected to the pdn_uart pin of tmc 2208 to gpio16 and gpio 17 for Rx and TX . There is a 1k resistor between TX and UART pin of tmc as tmc uses only one UART pin for both transmitting . I uploaded the code attached below but the stepper does not move when I supply around 11.2 v from Li ion battery . I checked the serial monitor which confirms that the UART connects are fine and the configurations are changing as per the code but the stepper does not move pls help me.

#include <TMCStepper.h>

// Define pins
#define EN_PIN    62  // Enable pin for Z-axis (A8 is digital pin 62 on Arduino Mega)
#define STEP_PIN  46  // Step pin for Z-axis
#define DIR_PIN   48  // Direction pin for Z-axis
#define SERIAL_PORT Serial2  // Use Serial2 for UART communication with TMC2208

// TMC2208 configuration
#define R_SENSE 0.11f  // Sense resistor value in ohms

// Create a TMC2208Stepper instance
TMC2208Stepper driver(&SERIAL_PORT, R_SENSE);

void setup() {
  // Initialize serial communication
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect
  }
  Serial.println("Starting...");

  // Initialize TMC2208 serial communication
  SERIAL_PORT.begin(115200);

  // Enable driver
  pinMode(EN_PIN, OUTPUT);
  digitalWrite(EN_PIN, LOW);  // Enable the driver

  // Small delay to ensure the driver is enabled
  delay(100);

  // Configure TMC2208
  driver.begin();            // Initiate pins and registers
  driver.toff(5);            // Enables driver in software
  driver.rms_current(900);   // Set RMS current to 900 mA
  driver.microsteps(8);      // Set microsteps to 8
  driver.pdn_disable(true);  // Disable using PDN pin for power down

  // Debugging: Confirm settings
  Serial.print("Current (mA): ");
  Serial.println(driver.rms_current());
  Serial.print("Microsteps: ");
  Serial.println(driver.microsteps());

  Serial.println("TMC2208 setup complete.");
}

void loop() {
  // Ensure the driver is enabled in the loop
  digitalWrite(EN_PIN, LOW);

  // Basic stepper motor test loop
  Serial.println("Starting motor movement...");
  digitalWrite(DIR_PIN, HIGH);  // Set direction
  for (int i = 0; i < 200; i++) {  // Move 200 steps
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(1000);  // Adjust delay to control speed
    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(1000);  // Adjust delay to control speed
  }
  Serial.println("Moved 200 steps forward.");
  delay(1000);  // Wait a second

  digitalWrite(DIR_PIN, LOW);  // Change direction
  for (int i = 0; i < 200; i++) {  // Move 200 steps back
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(1000);  // Adjust delay to control speed
    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(1000);  // Adjust delay to control speed
  }
  Serial.println("Moved 200 steps backward.");
  delay(1000);  // Wait a second

  // Check driver status
  checkDriverStatus();
}

void checkDriverStatus() {
  uint32_t drv_status = driver.DRV_STATUS();
  Serial.print("DRV_STATUS: ");
  Serial.println(drv_status, BIN);
}

Serial monitor :

Starting...
Current (mA): 887
Microsteps: 8
TMC2208 setup complete.
Starting motor movement...
Moved 200 steps forward.
Moved 200 steps backward.
DRV_STATUS: 11000000000011100000000000000000

If you used the plain RAMPS step-dir interface connections to your driver, does it work?

And please use the code formatting tags per the forum guidelines.

1 Like

Firstly I ment to buy a driver that was like that but I didnt pay attention while buying or rather didnot know there exists types . The UART one has a soldered pad on the underside which is not present in the normal one and I am not skilled enough to desolder that so I am just trying to work with it and even learn about the serial communication part on the way .

I could give it a try if u want but I don't know if I can do that with the one I have

The image reference of the soldered pad

I could see that you made an attempt to use code tags but it did not work out. I've fixed it for you.

Code tags are three backticks (```) on their own line before and after the code.

```
Your code here
```

gives

Your code here
1 Like

https://learn.watterott.com/silentstepstick/pinconfig/tmc2208/


The solder pads just connect one of the chip pins to the board pins, (what are MS3 and !RST on RAMPS) and, depending on the soldering and the jumpers set on the RAMPS board could short the UART pin to ground. Either way, you should still be able to control them pin-mode (non-UART) without unsoldering the pin.

Pics? does the driver even have a pin(s) for the UART going down into the RAMPS board socket? If so you could cut it/them off so they don't hook up to the RAMPS circuitry.

Trying pin-mode control will check if all the non-uart functionality works

1 Like

Ty for that I'll remember that from now on

I could try that but before that I just wanted to confirm that according to my serial monitor reading the UART connection is working fine as the current limit and microstepping is changing as per the code .
The problem seems to be with the movement part . I think the UART connection seems to be fine . I don't think I need to modify that.

Another thing I discovered while checking with the multimeter that the enable pin on tmc keeps fluctuating between 0volts to 3 .5 volts . Idk why as the code sets it to low . Could this be the problem

I have the bigtreetech tmc 2208 v3 uart I'll attach a link for their GitHub below idk how to attach a pic.Bigtreetech tmc 2208