TMC2209 with a SAMD chip

I've been trying to get the TMC2209 to work with a SAMD chip and this thread has been the most useful resource. I'm able to drive step and direction but I can't receive which I need to in order to use the StallGuard feature.

I'm using an Adafruit HUZZAH32 for my microcontroller. Here are the pinouts for the HUZZAH:

And for the TMC2209:

And here is how my circuit is actually wired up:

I'm trying to use UART as shown here:

Finally here is the code I'm running:

#include <TMCStepper.h>

#define EN_PIN    12 //enable (CFG6)
#define DIR_PIN   27 //direction
#define STEP_PIN  33 //step

//#define SW_RX            0 // TMC2208/TMC2224 SoftwareSerial receive pin
//#define SW_TX            1 // TMC2208/TMC2224 SoftwareSerial transmit pin
#define SERIAL_PORT Serial1 // TMC2208/TMC2224 HardwareSerial port
#define DRIVER_ADDRESS 0b00 // TMC2209 Driver address according to MS1 and MS2
#define R_SENSE 0.11f

TMC2209Stepper driver(&SERIAL_PORT, R_SENSE, DRIVER_ADDRESS);
//TMC2209Stepper driver(SW_RX, SW_TX, R_SENSE, DRIVER_ADDRESS);

void setup()
{
  //set pin modes
  pinMode(EN_PIN, OUTPUT);
  digitalWrite(EN_PIN, HIGH); //deactivate driver (LOW active)

  pinMode(DIR_PIN, OUTPUT);
  digitalWrite(DIR_PIN, LOW); //LOW or HIGH

  pinMode(STEP_PIN, OUTPUT);
  digitalWrite(STEP_PIN, LOW);

  digitalWrite(EN_PIN, LOW); //activate driver

  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }



    SERIAL_PORT.begin(115200);


}

void loop()
{
//  auto versionX = driver.version();
//  if (versionX != 0x21) {
//    Serial.println("Driver X communication issue");
//  }

  Serial.println(driver.SG_RESULT(), DEC);
  
  //make steps
  digitalWrite(DIR_PIN, HIGH);     // Turn left
  for (int i = 0; i < 200; i++) {
    digitalWrite(STEP_PIN, HIGH);
    delay(1);
    digitalWrite(STEP_PIN, LOW);
    delay(1);
  }
  delay(100);

  digitalWrite(DIR_PIN, LOW);     // Turn left
  for (int i = 0; i < 600; i++) {
    digitalWrite(STEP_PIN, HIGH);
    delay(1);
    digitalWrite(STEP_PIN, LOW);
    delay(1);
  }
  delay(100);
}

I'm using the TMCStepper Library (like others in the thread). And have not yet been able to get basic communication set up as described in this issue.

Feeling pretty stuck on this one because I can't see where I deviate from the successful examples discussed in the thread so far.

Split from an older topic

There is a 1k-resistor that creates a connection from TX to Rx.
Is this really according to the specification on how to communicate with a TMC2209-stepper-driver?

I can't say that I have worked with thousands of different serial devices but to me this 1k-resistor looks pretty akward.

Did you look up the datasheet of the TMC2209 if this is correct?
best regards Stefan

PMFJI
This figure is taken from the TMC2209 datasheet.
The TMC2209 requires such a connection for UART with uses 1-wire.

Aha. OK learned something new.
Did you try to use one of the example-codes from the TMCStepper-library?

I have looked up the adafruit documentation

It says that

The TX pin is the output from the module. The RX pin is the input into the module. Both are 3.3V logic

So my guessing is in the TMC-2209-Datasheet the naming of the Rx/Tx-pins is based on the view of the microcontroller.
This would mean that you have to connect the wire from the HUZZA32-board from IO-pin named Rx which is the third one from right to left

While you have connected it to the second (which is the Tx-Pin)
Though it might be possible that you have it connected right.
As long as a picture is taken from not direct above it is hard to see

So I added green numbers 3,2,1 that count the wholes of the bread-board
and red numbers 3,2,1 that count the wholes of the Huzza32-female-header

So please clear up which description is correct by a precise description using the colored numbers.

Do you happen to have an additional virtual-com-port USB-to-serial-converter you could connect to the TMC-2209
or do you have a logic analyser that could be used for analysing?

best regards Stefan

Thanks Stefan! You've got a good eye I also paused while doing the wiring because it was somewhat unclear how things lined up. It's wired as your last annotated picture suggests (3 to 3, 2 to 2) with the wire to the TMC going from the RX pin. I have tried some of the example programs from the library but no luck. I should have access to some better troubleshooting equipment in a few weeks. What would you recommend I check for?

There are 8 channel logic analysers for around $10

You can use them with a freeware called Zadic PulseView.
PulseView can record the bitbanging of a lot of buses like onewire I2C, UART etc. and decode it!

and a USB virtual comport. I recommend one with a micro USB-connector that could be connected with any USB-smartphone-data-cable

You could use the virtual-comport to send commands towards the TMC2209 to see if it reacts then. And you could connect the Rx-Pin in parallel to your arduino to read the signals send towards the TMC2209 or towards the Arduino.

Not the ones with a USB-A plug soldered to the PCB. Those will tend to bend and brake the plug

most professional would be a two channel or four channel digital storage oscilloscope but they are quite expensive
best regards Stefan