Arduino coding on MKS Gen L board with DRV8825

Hi, I'm sorry with my poor english :frowning:

I wanna ask something, I making 6axis robot arm with MKS Gen L V1.0(Atmega2560 chip) board.

I used marlin, repetier(driver, motor work well.), but I want to code directly on Arduino code.

With DRV8825 stepper driver, I used

const int dirPin = 55;
const int stepPin = 54;
const int stepsPerRevolution = 200;
 
void setup()
{
  // Declare pins as Outputs
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
}
void loop()
{
  // Set motor direction clockwise
  digitalWrite(dirPin, HIGH);
 
  // Spin motor slowly
  for(int x = 0; x < stepsPerRevolution; x++)
  {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
  delay(1000); // Wait a second
  
  // Set motor direction counterclockwise
  digitalWrite(dirPin, LOW);
 
  // Spin motor quickly
  for(int x = 0; x < stepsPerRevolution; x++)
  {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }
  delay(1000); // Wait a second
}

https://how2electronics.com/control-stepper-motor-with-drv8825-driver-arduino/

but it doesn't work. I set pin number correctly, I check power on board 24V.

I think main problem is that after enter DRV8825, no current to stepper motor.

I check EN/STEP/DIR/GND pins with multimeter, its okay!
But when I check 4 pins that after driver, it has no current.

So, maybe there are problem with Driver code or pins.

Are there any setting with CS_PIN or ENABLE_PIN ?
At above code, it has only dir/step pin with no enable pin.

I'm missing something with MKS board setting.. ㅠㅠ help me

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.