Has anyone tried to drive Stepper motor with Navio2? I'm getting some strange behavior

I’m using Servo example to drive my stepper motor through tb6600. Motor and pwm ranges works perfectly on Arduino but it works extremely slow on Navio2. I tried to change frequency in Servo example but it’s still too slow. Now I started to wonder is there a hardware limitation.

Any opinions and suggestions appreciated. Thanks.

Hi Kizilkaya,

How does your hardware setup look like?

Hi, at the simplest form, the driver(tb6600) has three inputs and one of them is Pulse. Normally connecting the other two pins (dir and ena) are not necessary. It works without them using my Arduino and generating PWM signals according to drivers manual. However if I connect pulse pin to the Navio2 (main rc out 6 ) it works really slow compared to the Arduino version. Increasing the frequency (set_frequency) gives a little speed up but not too much. Frequency stops effecting after around 400. I’ve tried to tune Servo MIN and MAX values but it doesn’t helped too much too. At the end of the day with different MIN MAX and frequency combinations motor works really slow compared to the Arduino even with the same hardware setup. I just started to wonder if the Navio2 is unable to control stepper motors. Or I’m failing to convert my code to Navio2.
Thanks a lot.

Here is example Arduino code that works as expected.

int PUL=7; //define Pulse pin
int DIR=6; //define Direction pin
int ENA=5; //define Enable Pin
void setup() {
  pinMode (PUL, OUTPUT);
  pinMode (DIR, OUTPUT);
  pinMode (ENA, OUTPUT);

}

void loop() {
  for (int i=0; i<6400; i++)    //Forward 5000 steps
  {
    digitalWrite(DIR,LOW);
    digitalWrite(ENA,HIGH);
    digitalWrite(PUL,HIGH);
    delayMicroseconds(30);
    digitalWrite(PUL,LOW);
    delayMicroseconds(30);
  }
  for (int i=0; i<6400; i++)   //Backward 5000 steps
  {
    digitalWrite(DIR,HIGH);
    digitalWrite(ENA,HIGH);
    digitalWrite(PUL,HIGH);
    delayMicroseconds(30);
    digitalWrite(PUL,LOW);
    delayMicroseconds(30);
  }
}

How is your Navio2 powered when you conduct a test?

Powered via Raspberry, but motors have separate power source.

Hi Kizilkaya,

Do you provide the power to the servo rail? It requires an external power supply as well as the motor drivers. You can check the connection scheme in this docs entry.

Please, share the hardware setup photos. It may ease the troubleshooting.