Stepper motor control for high speed

Hi there! Could someone help me ? I'm having a problem to control NEMA 23 stepper motor using arduino mega 2560, TB6600 driver and a 12V 10A power supply.
I can't get the electrical specs of the motor but it's 200 steps per revolution, its model is 23HS404-25. I bought it from one dealer who didn't have its data sheet and I can't find it on Google either.
The problem is the motor stalls only at 750 steps per second (roughly 3 revs/s) with no load and stop rotating, vibrate while getting very hot.
I'm using accelstepper library.

I need atleast 750RPM(12.5 rps)

What is the coil current setting on the driver?

What microstep setting?

Post your test code.

I've tried all settings but there was no difference.

int step_pin=3, dir_pin=2;
static int i=0;
static int steps=4000;
boolean is_running= true;
void setup() {
  
  // put your setup code here, to run once:
pinMode(step_pin, OUTPUT);
pinMode(dir_pin, OUTPUT);


}

void loop() {
 
  
  digitalWrite(dir_pin,HIGH);
 while(Serial){
  if(is_running)
   {
    
   digitalWrite(step_pin, HIGH);
  delayMicroseconds(750);
   digitalWrite(step_pin, LOW);
   delayMicroseconds(780);
   i++;
    if (i==steps){
    
    is_running=false; }
   }
    }



  
  
   

    
  /*delay(1000);
  // put your main code here, to run repeatedly:
digitalWrite(dir_pin,LOW);
for (i=0;i<steps;i++)
  {
digitalWrite(step_pin, HIGH);
  delayMicroseconds(350);
   digitalWrite(step_pin, LOW);
   delayMicroseconds(350);
  }
  delay(1000);*/
}

Blindly doing stuff without a clue as to what they do is not the ideal troubleshooting methodology.

THIS IS THE CODE
int step_pin=3, dir_pin=2;
static int i=0;
static int steps=4000;
boolean is_running= true;
void setup() {
  
  // put your setup code here, to run once:
pinMode(step_pin, OUTPUT);
pinMode(dir_pin, OUTPUT);


}

void loop() {
 
  
  digitalWrite(dir_pin,HIGH);
 while(Serial){
  if(is_running)
   {
    
   digitalWrite(step_pin, HIGH);
  delayMicroseconds(750);
   digitalWrite(step_pin, LOW);
   delayMicroseconds(780);
   i++;
    if (i==steps){
    
    is_running=false; }
   }
    }



  
  
   

    
  /*delay(1000);
  // put your main code here, to run repeatedly:
digitalWrite(dir_pin,LOW);
for (i=0;i<steps;i++)
  {
digitalWrite(step_pin, HIGH);
  delayMicroseconds(350);
   digitalWrite(step_pin, LOW);
   delayMicroseconds(350);
  }
  delay(1000);*/
}

A couple of tutorials that may help.
Stepper basics.
Simple stepper code.

TB6600 User Guide

What does the while(Serial) do? You do not open a serial port.

Actually I was trying to control the stepper through serial-by sending number of steps through serial. So, "while (serial)" is just a trash left while I was clearing unwanted stuff to leave only the code I tried to use, which gave me only 750 steps per second.
I mean I was trying to use the code with serial while I wasn't happy with the speed I got. So I want to be happy with the speed first then work on serial.

To achieve higher speeds you will have to introduce acceleration. No way around it. You can use a library like AccelStepper.

Before using this code which I wrote myself, I used accelstepper library too. It gave almost the same results: if I put speed more than 600 steps per second the motor stalls, vibrate like it is rotating but not, while getting hot.

THE CODE SHOULD LOOK LIKE THIS

int step_pin=3, dir_pin=2;
static int i=0;
static int steps=4000;
boolean is_running= true;
void setup() {
  
  // put your setup code here, to run once:
pinMode(step_pin, OUTPUT);
pinMode(dir_pin, OUTPUT);


}

void loop() {
 
  
  digitalWrite(dir_pin,HIGH);

  if(is_running)
   {
    
   digitalWrite(step_pin, HIGH);
  delayMicroseconds(750);
   digitalWrite(step_pin, LOW);
   delayMicroseconds(780);
   i++;
    if (i==steps){
    is_running=false;
     }
   
    }



  
  
   

    
  /*delay(1000);
  // put your main code here, to run repeatedly:
digitalWrite(dir_pin,LOW);
for (i=0;i<steps;i++)
  {
digitalWrite(step_pin, HIGH);
  delayMicroseconds(350);
   digitalWrite(step_pin, LOW);
   delayMicroseconds(350);
  }
  delay(1000);*/
}

Check out my tutorial in Multi-tasking in Arduino which has a complete high speed stepper example which is controlled by user commands and a sensor.
There is a detailed explanation of how to measure and increase the maximum speed of the stepper using the AccelStepper library

@mbise1997, your topic has been moved to a more suitable location on the forum.

12V is a pretty low voltage if you want performance from your stepper motor,
24V or 36V would fare a lot better. Motor speed and torque-at-speed are mainly
controlled by winding inductance and supply voltage - please post your motor's
datasheet link or product page.