Problems with high RPM with NEMA-17 Stepper Motor

You should know that a NEAM-17 tells you nothing about the motor other than the size of the mounting hole.

Please tell us about what motor you have and how you are driving it.