Issue with spi on Arduino using tmc2130

Hi I am trying to use the tmc2130 to controle a stepper mottor. The issue is that my motor is way too hot if I use it with the standalone mode, see TMC2130 Datasheet. I would then like to use the spi + the step dir mode. There is a small jumper that needs to be soldered to use step/dir and by default its open for the spi mode, I belive that to have both it needs to be open. Here is the code I have tried but nothing seems to work.

/*
Initializes the library and turns the motor in alternating directions.
*/
#define EN_PIN 7    // Nano v3:	16 Mega:	38	//enable (CFG6)
#define DIR_PIN 6   //			19			55	//direction
#define STEP_PIN 5  //			18			54	//step
#define CS_PIN 10   //			17			64	//chip select

bool dir = true;


#include <TMC2130Stepper.h>
TMC2130Stepper TMC2130 = TMC2130Stepper(EN_PIN, DIR_PIN, STEP_PIN, CS_PIN);

void setup() {
  Serial.begin(9600);
  TMC2130.begin();                   // Initiate pins and registeries
  TMC2130.SilentStepStick2130(600);  // Set stepper current to 600mA
  TMC2130.stealthChop(1);            // Enable extremely quiet stepping
  digitalWrite(CS_PIN, HIGH);
  digitalWrite(EN_PIN, LOW);
}

void loop() {
  digitalWrite(STEP_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(STEP_PIN, LOW);
  delayMicroseconds(10);
  uint32_t ms = millis();
  static uint32_t last_time = 0;
  if ((ms - last_time) > 2000) {
    if (dir) {
      Serial.println("Dir -> 0");
      TMC2130.shaft_dir(0);
    } else {
      Serial.println("Dir -> 1");
      TMC2130.shaft_dir(1);
    }
    dir = !dir;
    Serial.println(TMC2130.GCONF(), BIN);
    last_time = ms;
  }
}

I have a small stepper motor that I power with a generator 12V and 150ma ( it's not the stepper that heats up, this one is just to test out the code), the current limit is also set to 150ma. If anyone has an idea why it doesnt work, I am all ears. Thank you.

Where did You find that? I find pins for step & dir input only.

This doesn't indicate 150 mA.

Hi @Railroader , Thank you for your answer, here is a picture of what I am talking about


If this is left open normally I have the spi mode, if I solder them together I should only have step/dir without spi. But the datasheet says I can have both ( page 5-6)

My bad, but even if I have 600mA instead of 150mA I limited it on my generator and on the potentiometer of the driver so I believe that it doesnt change much . I have changed it but nothing is happening.

Hi, @ju_lvd
Welcome to the forum.

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Can you post some images of your project?
So we can see your component layout.

Can you please post specs/data link to your stepper motor?

Tom.... :smiley: :+1: :coffee: :australia:

1 Like

Of course thank you, here is a picture and a drawing of my drawn circuit. My motor doesn't have a datasheet I could find but here is a link where i bought it : Stepper motor. I am aware that they say between 3 and 5 V for the nominal tension and that mine is 12V. I should not have a big affect on the output ( I say that because the people making stepper motor usually test them out using 24v )


Okay I have just discovered my mistake, I thought that Miso on the master had to be connected to Miso on the slave but that didnt work for me so I just switched the two and now it works ( so Miso from the master to the Mosi on the slave )

Well done. Thanks for telling.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.