Cant handle multiple dm542t drivers at the same time

Hi, I am facing a strange issue, I have 2 dm542t drivers connected to the arduino giga, but I am not able to control them in the same time. Kinda. I wrote a simple cartesian coordinate stepper class, I am able to control the movement on 2 axes at the same time until the direction is not high for both drivers in the same time, so relative movement like the following work:

  • -500,-500

  • 500,-500

  • -500,500

As soon as I hit something where both of the directions are HIGH, so for example (500,500), nothing works. As soon as I have four outputs high it is not working, to make sure that the code is not the issue I have tried to hardcode these steps in the loop, I tried to use outputs which are not on the same, or on the same port, and I got the same result. Other then the 2 driver I have 4 limit switches connected to the arduino. Have anybody faced an issue like this, I am just lost now.

To test out everything I wrote this test code, and removed the belts and limit switches so I can check on the movement freely.

int count = 0;

void setup()
{
  pinMode(23,OUTPUT);
  pinMode(24,OUTPUT);
  pinMode(26,OUTPUT);
  pinMode(27,OUTPUT);
}

void loop()
{
  if(count == 0)
  {
    // works
    // digitalWrite(24,LOW);
    // digitalWrite(27,LOW);

    // works
    // digitalWrite(24,LOW);
    // digitalWrite(27,HIGH);

    //works
    // digitalWrite(24,HIGH);
    // digitalWrite(27,LOW);

    // not working
     digitalWrite(24,HIGH);
    digitalWrite(27,HIGH);
    // docs specify min 5us direction setup time
    delayMicroseconds(6);
  }
  if(count < 50)
  {
    digitalWrite(23,HIGH);
    // docs specify at least 2.5 us pulse width
    delayMicroseconds(4);
    digitalWrite(23,LOW);
    digitalWrite(26,HIGH);
    // docs specify at least 2.5 us pulse width
    delayMicroseconds(4);
    digitalWrite(26,LOW);
  }
  count++;
  delay(50);
}

Diagram:

The code is a very weird.
Your count value quickly increased above 50 and the code stops working. There is nothing in the sketch that could reverse the incontrolable increasing of count variable.

that is ok, I wanted to see if the 50 steps are done in any direction, and the steppers should run 50 steps in this code (this was just a test code there was no intention for direction change, or infinite stepping), which they do, but none of them is running if the direction is HIGH for both drivers.

Edit: between each step is a 50ms delay so 50steps are running for 2.5sec.

Edit: I commented out the code which I compiled and uploaded separately to the arduino, thats how I tried running different directions.

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