Stepper slow startup

I don't know where to put this questiona so I will here.
I have arduino nano clone with a4983 stepper driver. Problem is that motor is for few seconds runing slowly and noisy backwards and then changes direction and runs with normal speed.
Driver is running with 12V, slp and reset are shorted and everthyng Works after that initial type.
Motor is novimal 1.3A max and Vref is set abot 0.52-0.53V, and for moment I don't have capacitor on Vmot (can it be that)?
Program that is running for now it is:

const int ledPin = 13;
const int dirPin = 7;
const int stepperPin = 8;
const int homepolozaj = 2;
const int brzina1 = 3;
const int brzina2 = 4;
const int brzina3 = 5;
const int start = 6;
const int enable = 13;
byte stanje;
long brzina=100;

void setup() {
  pinMode (enable, OUTPUT); // gasi se
  digitalWrite (enable, HIGH); // gasim motor na pocetku
  pinMode(dirPin, OUTPUT); //smjer
  pinMode(stepperPin, OUTPUT);
  pinMode(homepolozaj, INPUT); // limitswitch - pin 2
  digitalWrite(homepolozaj, HIGH); // pali interni pullup
  pinMode(brzina1, INPUT); // prva brzina - pin 3
  digitalWrite(brzina1, HIGH); // pali interni pullup
  pinMode(brzina2, INPUT); // druga brzina - pin 4
  digitalWrite(brzina2, HIGH); // pali interni pullup
  pinMode(brzina3, INPUT); // treca brzina - pin 5
  digitalWrite(brzina3, HIGH); // pali interni pullup
  pinMode(start, INPUT); // start - pin 2
  digitalWrite(start, HIGH); // pali interni pullup
  pinMode(ledPin, OUTPUT); // ledica
  
  pocetak();
}

void loop() {
  tipkovnica();

}

void pocetak () {
  digitalWrite(dirPin, HIGH );  
  digitalWrite (enable, LOW);
  stanje = digitalRead(homepolozaj);  
  while (stanje == HIGH)
  {
    digitalWrite(stepperPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepperPin, LOW);
    delayMicroseconds(1000);
        digitalWrite(ledPin, LOW);
        stanje = digitalRead(homepolozaj);
  }
  digitalWrite(ledPin, HIGH);
 
  
}

void tipkovnica () {
  if (digitalRead(brzina1) == LOW)
{
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
}
  else if (digitalRead(brzina2) == LOW)
{
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
}
  else if (digitalRead(brzina3) == LOW)
{
   digitalWrite(ledPin, HIGH);
   delay(1000);
   digitalWrite(ledPin, LOW);
}
}

You need to ramp up the speed - use the AccelStepper library to make this easy?

Remember a motor cannot instantly change speed and you code assumes it can go from
stationary to 500 steps/s without any ramping.