L297 + L298 circuit not working

I have paired up L297 and L298 together to make a bipolar stepper driver. My schematics are :

I have hooked up the step and direction pin number 4 and 5 respectively on Arduino. I am using a 5V power supply from a DC adaptor

The code I’m using is(sorry for bad indentation) :

#define stepPin 4
    #define dirPin 5

     void setup() {
     Serial.begin(9600);
        Serial.println("Starting stepper exerciser.");

         pinMode(stepPin, OUTPUT);
          pinMode(dirPin, OUTPUT);

            digitalWrite(dirPin, HIGH);
                    digitalWrite(stepPin, LOW);
                          }

               void loop() {
               int i, j;

                      for (i=1000; i>=200; i-=100) {
Serial.print("Speed: ");
Serial.println(i);

for (j=0; j<2000; j++) {
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(i);
  digitalWrite(stepPin, LOW);
  delayMicroseconds(i);
}

delay(500);
digitalWrite(dirPin, !digitalRead(dirPin));

for (j=0; j<2000; j++) {
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(i);
  digitalWrite(stepPin, LOW);
  delayMicroseconds(i);
}

delay(1000);
Serial.println("Switching directions."); 
digitalWrite(dirPin, !digitalRead(dirPin));
       }
         }

I am using NEMA17 bipolar 5V motors , the data sheet can be found here : http://www.eminebea.com/en/product/rotary/steppingmotor/hybrid/standard/data/17pm-j.pdf

Motor specs are http://www.eminebea.com/en/product/rotary/steppingmotor/hybrid/standard/

I have also tried L297 with L293d , but the things aren’t working the way they should.

Those low voltage motors are intended for a chopper-style motor driver, like the Pololu A4988, and won't work well with the L298 circuit. As the data sheet covers a number of different models, which motor do you have? Alternatively, what is the coil resistance?

Do you have BAR Reset and ENABLE tied high?

This circuit is a chopper driver, look up the datasheet on the L297, it PWM the drive lines in response to current sensed from the H-Bridge motor grounds.

The L297/:298 combo can be used as a chopper driver, but it is not required to function in that way and many people do not use the current sensing functionality. What are the values of RS1 and RS2? Did you take into account that the L298 H-bridge can drop up to 4 volts internally?

Have you set correctly Vref versus Imotor maximall value ?
L297 Frequency oscillator value is it correct versus the max speed motor ?

RS1 and RS2 are current shunts in the emitter circuits of the lower half of each bridge. I have no I dea what value the OP has set them to, they should be in the .05 to .1 ohm range.