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);
}
}