ArduinoGeneral

TB6600 problem with Arduino MEGA : "lost sync with device " issue

userHead Account cancelled 2017-08-14 23:59:48 2051 Views0 Replies
Hi,

We are currently using a TB6600 stepper motor driver with an Arduino Mega in a project for robotics purpose. We are using ROS and the Arduino ackage to control the stepper motor driver. We are using the sample code provided here : https://www.dfrobot.com/wiki/index.php ... U:_DRI0043.

After tests, it seems that the stepper motor tends to flicker as we reduce the delayMicroseconds parameter. Our issue is that our system somewhat loses connection with the Arduino board and restart it after a few seconds. When this happens, the line "lost sync with device, ... restarting" appears on the terminal. we are using the robot in 32 microstep mode.

Here is the code we're using :

void doSteering(double k, int sign)
{
pulse_save = 0;
k = proportional_coefficient* k; // 30 degrees of 360, (6400/360 * 30)/204 (204 is pulses at 1.0 command signal)
int pulses = abs(k * sign - currentAngle);
int pulseSign = (k * sign - currentAngle < 0) ? -1 : 1;


if (pulses > 6400) pulses = 6400;

if (pulseSign < 0) digitalWrite(steerDirPin, LOW);
else digitalWrite (steerDirPin, HIGH);

// Causing lost sync with device replace delays
for (int i = 0; i < pulses; i++) //Forward 5000 steps
{
pulse_save = pulse_save + 1;
digitalWrite(steerEnaPin, HIGH);
digitalWrite(steerPulPin, HIGH);
delayMicroseconds(150);
digitalWrite(steerPulPin, LOW);
delayMicroseconds(150);
}

currentAngle += pulses * pulseSign;

}




Any suggestions appreciated.

Thanks !