stepper Motor freezes after about 10 seconds

I am using a sparkfun stepper motor with the big easy driver shield powered by a 12V power source with 2 amps. I have no load on the motor and I have the potentiometer at slightly below half (as there is no load and I need to motor to spin for about 20 min without heating up) but for some reason when I run the code below it locks up and doesnt spin after about 10 seconds

any ideas?

//Declare pin functions on Arduino
#define stp 2
#define dir 3
#define MS1 4
#define MS2 5
#define MS3 6
#define EN  7

//Declare variables for functions

long previousTime;

void setup() {
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
  pinMode(MS1, OUTPUT);
  pinMode(MS2, OUTPUT);
  pinMode(MS3, OUTPUT);
  pinMode(EN, OUTPUT);
  resetBEDPins(); //Set step, direction, microstep and enable pins to default states
  digitalWrite(EN, LOW);
  
  digitalWrite(MS1, HIGH);
  digitalWrite(MS2, HIGH);
  digitalWrite(MS3, LOW);
  digitalWrite(dir, LOW);

  previousTime = millis();
}

//Main loop
void loop() {
  if (timePassed()) {
    oneStep();
  }
}

bool timePassed(){
  int now = millis();
  if (now > previousTime + 5) {
    previousTime = now;
    return true;
  } else {
    return false;
  }
}

void oneStep() {
  digitalWrite(stp,HIGH); //Trigger one step forward
  digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
}

void resetBEDPins() {
  digitalWrite(stp, LOW);
  digitalWrite(dir, LOW);
  digitalWrite(MS1, LOW);
  digitalWrite(MS2, LOW);
  digitalWrite(MS3, LOW);
  digitalWrite(EN, HIGH);
}

Show your wiring. You're not pulling the power for the stepper directly through the arduino are you? You've got transistors on all those lines? Or a stepper driver?

if (now > previousTime + 5)

That line is probably not an issue now but it's got a bug in it if the code ever runs to the millis rollover.

Write this way to be safe:

if (now - previousTime >= 5)

Post a link to the stepper motor or the data sheet. To what value did you set the current limit?

The Big Easy Driver is overrated, and unless you have set the current limit to less than about 1.4 A, it may be overheating and shutting down.

These links may help
Stepper Motor Basics
Simple Stepper Code

...R

This code is faulty.

bool timePassed(){
  int now = millis();
  if (now > previousTime + 5) {
    previousTime = now;
    return true;
  } else {
    return false;
  }
}

Firstly millis() returns unsigned long, not int, so you will see wraparound after a few tens of seconds.

Secondly as pointed out by Delta_G your test is broken for wraparound.

Here is how to do things properly:

bool timePassed(){
  if (millis() - previousTime >= 5) {
    previousTime += 5 ;
    return true;
  } else {
    return false;
  }
}

You declared previousTime as long, which is going to work, but unsigned long is more correct.

Robin2:
These links may help
Stepper Motor Basics
Simple Stepper Code

Was there something obvious that indicated a lack of understanding? I apologize if I poorly articulated my circumstances.

MarkT:
Firstly millis() returns unsigned long, not int, so you will see wraparound after a few tens of seconds.

Secondly as pointed out by Delta_G your test is broken for wraparound.
You declared previousTime as long, which is going to work, but unsigned long is more correct.

Thank you Mark and Delta_G, its turns out the if statement logic was faulty, after fixing it with your suggestion it run as long as I needed!

Was there something obvious that indicated a lack of understanding?

Yes, the following quote demonstrates that you don't understand 1) how to properly set the current limit, and 2) that stepping motors consume the same amount of power regardless of load, or whether they are even stepping.

I have the potentiometer at slightly below half (as there is no load and I need to motor to spin for about 20 min without heating up)

Ziayakens:
Was there something obvious that indicated a lack of understanding? I apologize if I poorly articulated my circumstances.

You will note that I started Reply #3 with "These links may help"

Also, when you have read 500 Forum Threads you will realize that many people do start questions with very little background knowledge. It is simpler to provide it than to start a long question and answer session to find out the OPs level of knowledge. Many are also very reluctant to answer simple questions.

...R

Many are also very reluctant to answer simple questions.

And many will take it all personally and act like total jerks about it. You'd be amazed how many people get their knickers in a knot over asking them for some basic information that they didn't include and don't think is important. "How dare you ask me if I connected the grounds don't you know who I am".