AccelStepper Library, A4988 Stepper Motor Driver Issues

I am working on a project that will re-purpose a cheap laser engraver to move an ultrasonic sensor with a joystick when in "manual mode" and run a predefined routine when in "auto mode". The circuit board has a Nano and two A4988 drivers on it. I plan on using the AccelStepper library to control both stepper motors. The motor is a 200 step motor and the A4988 is set to 16th step (which is controlled by the circuit board). I am starting out small and just trying to get the steppers to work the way I want them to. When I try the following code, it takes almost 3 seconds for the stepper to complete one full turn. If I understand steppers and the library correctly, at the MAX_SPEED of 6400, it should complete 2 full turns in 1 second. Is that correct? I have changed both the MAX_SPEED (as low as 100 and as high as 20000) and I can't get quicker than 1 rev in 3 seconds. What am I missing/doing wrong?

#include <AccelStepper.h>

#define STEP_PIN        2
#define DIR_PIN         5
#define ENABLE_PIN      8
#define MAX_SPEED       6400
#define MAX_ACCEL       500


AccelStepper stepper(STEP_PIN, DIR_PIN);


void setup() 
{
    pinMode(ENABLE_PIN, OUTPUT);
    digitalWrite(ENABLE_PIN, LOW);

    stepper.setCurrentPosition(0);
    stepper.setMaxSpeed(MAX_SPEED);
    stepper.setAcceleration(MAX_ACCEL);
}


void loop() 
{
        stepper.moveTo (100);
        stepper.setSpeed(MAX_SPEED);
        stepper.run();
        
        stepper.moveTo (-100);
        stepper.setSpeed(MAX_SPEED);
        stepper.run();
}

Thanks,
Justin

From the AccelStepper documentation

Performance
The fastest motor speed that can be reliably supported is about 4000 steps per second at a clock frequency of 16 MHz on Arduino such as Uno etc. Faster processors can support faster stepping speeds.

Thanks for the response! Is there other library out there that can handle higher steps per second and still have acceleration functionality?

Not that I know of.

You could get higher speed by reducing microsteps. Low microsteps for speed, high microsteps for precision.

This thread has an example, by Robin2, of simple acceleration code that may be of interest (see reply #7).

The code in the link in Reply #3 is an extension of this Simple Stepper Code. I believe some Forum users have obtained high step rates with it.

And if you use the digitalWriteFast library it should be possible to get higher rates. Note, however that with it you will probably need an explicit time interval for a step pulse.

...R
Stepper Motor Basics