2 steppers slowing and jamming each other

I am using two steppers with and AccellStepper library. My problem is, that when both steppers are moving they are blocking each other.

Here is code:

#include <AccelStepper.h>
const int driverPUL = 7;    // PUL- pin
const int driverDIR = 6;    // DIR- pin
const int driverENA = 5;    // ENA- pin
const int driver2PUL = 4;    // PUL- pin
const int driver2DIR = 3;    // DIR- pin
const int driver2ENA = 2;    // ENA- pin
// Define some steppers and the pins the will use
// Define a stepper and the pins it will use
AccelStepper stepper1(1, driverPUL, driverDIR); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
// Define a stepper and the pins it will use
AccelStepper stepper2(1, driver2PUL, driver2DIR); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5

void setup()
void loop()

When stepper2 is running, stepper1 can't get as fast as it should go. When stepper2 starts to slow down stepper1 starts jumping in speed and even jams if it goes too fast. And when stepper2 is fully stopped, stepper1 goes faster then before.

I need to run both steppers asynchronously at high speeds but this is big problem.

Thanks for advices.

That points to your power supply having too low of voltage and being unable to supply the current peaks your project requires.

Which board/processor are you using? On a standard arduino (16MHz ATmega) accelStepper needs about 200µs to compute the next step. With two steppers it needs 400µs. That limits the possible maximum speed.

I am using Arduino Mega

AccelStepper on Arduino Mega will not reach the speeds you want. 6000.0 is even too fast with a single stepper.

Do you think it is possible without Accelstepper,if yes what do you recommend?

You could try without a library and manage the step timing yourself. Calculate the step interval for each stepper and use the blink without delay technique to manage the timing. You'll need micros rather than millis of course.

Running at lower speeds, you can test your resulting code, but I suspect that you'll also need to manage acceleration to get the speed you're looking for.

AccelStepper only works to about 4000 steps/second on 8 bit AVR microcontrollers. This is because it uses floating point, which is emulated
(slowly) on such hardware.

And this applies in total to all steppers together.

@zokinko: If you can get by with a maximum of 5000 steps/sec per stepper, you could try my MobaTools.
Normally with 8-bit AVR's the maximum steprate is limited to 2500 steps/sec per stepper - but for up to 6 steppers. With 2 steppers it can be tuned to 5000 Steps/sec per stepper ( by a define in MobaTools.h ).

Don't forget that there are plenty of other devices you can program with the Arduino IDE both from Arduino and other vendors that are orders of magnitude faster than what you're using.

I found SpeedyStepper library which looks like it can handle speeds I need. If final solutions won't be good enough I will try different device.

Thank you all for advices.