Stepper motor turning only in one direction, stalling in opposite direction

Hello,

I am controlling a high-torque stepper motor (23Y204S from Anaheim Automation with 8 lead-wire) using a microstepping driver (MBC15081) and Arduino. The winding wiring is connected as bipolar series connection. The Arduino was programmed and the motor works fine in one direction, however, it stalls when trying to rotate in the opposite direction (it is possible to feel the pulsing/jerking) and it does not rotate. I am currently using the driver in the sinking mode and it says that to control the direction of the rotation, it is necessary to change the signal from Logic '1' to Logic '0' and vice-versa. As you can see in the code below, in the forward motion (when directionPin is HIGH) the motor rotates, but in the reverse direction (when directionPin is LOW - in the code below it is highlighted with "stars" ****) the motor stalls. Please share your feedback about this. Thank you.

Arduino Code:

P.S: The Serial.Read is receiving data from Visual Studios. Does not affect the problem here.

int clk = 27;
int directionPin = 34;
int MS2 = 42; //dip switches for step setting
int MS1 = 43;
int power = 35; // ON/OFF

const int revSteps[] = {3200, 800, 400, 200};
const int MS2switch[] = {LOW, LOW, HIGH, HIGH};
const int MS1switch[] = {LOW, HIGH, LOW, HIGH};

void setup()
{
Serial.begin(9600);
pinMode(clk, OUTPUT);
pinMode(directionPin, OUTPUT);
pinMode(MS2, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(power, OUTPUT);
}

void loop()
{

while(Serial.available() > 0)
{
char cat;
cat = Serial.read();

if(cat == '1') //Forward
{
digitalWrite(power, HIGH); //Turn motor ON
digitalWrite(directionPin, HIGH); //counter clockwise
digitalWrite(MS2, MS2switch[0]); //full/half/quarter/eighth of step
digitalWrite(MS1, MS1switch[0]); // ""
for(int x=0; x < revSteps[3]; x++)
{
digitalWrite(clk, HIGH);
delayMicroseconds(3000);
digitalWrite(clk, LOW);
delayMicroseconds(3000);
}
digitalWrite(power, LOW); //turn off motor
}

else if(cat == '2') //Backward
{
digitalWrite(power, HIGH); //Turn motor ON
digitalWrite(directionPin, LOW); //clockwise - DOES NOT WORK *************************************************
digitalWrite(MS2, MS2switch[0]); //controlling speed of motor
digitalWrite(MS1, MS1switch[0]); // ""
for(int x=0; x < revSteps[3]; x++)
{
digitalWrite(clk, LOW);
delayMicroseconds(3000);
digitalWrite(clk, HIGH);
delayMicroseconds(3000);
}
digitalWrite(power, LOW); //turn off motor
}
}

}

You have not said whether the load on the motor is different when in "reverse" - for example lowering a weight in forward and raising it in reverse.

If the load is the same in both directions then please post links to the datasheets for your motor and for your motor driver.

To make it easy for people to help you please modify your post and use the code button </>
codeButton.png

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to my text editor. The text editor shows line numbers, identifies matching brackets and allows me to search for things like all instances of a particular variable or function.

Also please use the AutoFormat tool to indent your code consistently for easier reading.

...R
Stepper Motor Basics
Simple Stepper Code

Can you show how its all connected up? Convince us its correctly setup as series connected bipolar!