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: