Tic T249 Returning to safe start for unknown reason

I have 2 T249’s that are seemingly randomly setting their safe start violation bits. In the control center I am not seeing any Vin, Serial, etc. errors that are expected if it’s power or data problems. The Tic Control Center only shows counts coming from safe start violations and ERR line High from the other Tic. The Tic does not seem to be resetting, as the up time exceeds multiple hours.

Tic Settings:
tic_settings_for_forum.txt (1.4 KB)

I am using the sample arduino code I2C Multi, with the only changes to comment out all movements, add exit safe start to the timeout command call, and change tic numbering from 14/15 to 13/14. Here is a copy of the code:

Admittedly, my I2C bus is ridiculously long, but I’d expect if this was causing the error, that I would see serial errors as well. I plan to add pull-up resistors per the I2C manual tech note, but having trouble finding a good way to estimate bus capacitance. Please let me know if my assumption is flawed and I should do this right away.

Note: I know that I can disable the safe start, but I like the safety feature it adds and would prefer to have it work than disable it.

Pictures of wiring

// This example shows how to send I2C commands to two Tic Stepper
// Motor Controllers on the same I2C bus.
//
// Each Tic's control mode must be set to "Serial/I2C/USB".  The
// serial device number of one Tic must be set to its default
// value of 14, and the serial device number of another Tic must
// be set to 15.
//
// The GND, SCL, and SDA pins of the Arduino must each be
// connected to the corresponding pins on each Tic.  You might
// consider connecting the ERR lines of both Tics so that if
// either one experiences an error, both of them will shut down
// until you reset the Arduino.
//
// See the comments and instructions in I2CSpeedControl.ino for
// more information.

#include <Tic.h>

TicI2C tic1(13);
TicI2C tic2(14);

void setup()
{
  Wire.begin();
  delay(20);

  tic1.exitSafeStart();
  tic2.exitSafeStart();
}

void resetCommandTimeout()
{
  tic1.resetCommandTimeout();
  tic2.resetCommandTimeout();
  tic1.exitSafeStart();
  tic2.exitSafeStart();
}


void delayWhileResettingCommandTimeout(uint32_t ms)
{
  uint32_t start = millis();
  do
  {
    resetCommandTimeout();
  } while ((uint32_t)(millis() - start) <= ms);
}

void loop()
{
//  tic1.setTargetVelocity(2000000);
//  tic2.setTargetVelocity(0);
  delayWhileResettingCommandTimeout(1000);

//  tic1.setTargetVelocity(0);
//  tic2.setTargetVelocity(1000000);
  delayWhileResettingCommandTimeout(1000);

//  tic1.setTargetVelocity(-1000000);
//  tic2.setTargetVelocity(0);
  delayWhileResettingCommandTimeout(1000);

//  tic1.setTargetVelocity(0);
//  tic2.setTargetVelocity(-2000000);
  delayWhileResettingCommandTimeout(1000);
}

Hello.

It looks like you are constantly running the “Exit Safe Start” command, which defeats the point of that feature. In general, you should only send the “Exit safe start” command as a direct response to a user action, such as pressing a button. That way, if an error happens and your motor stops, it will only start moving again in response to the user’s action.

Partially for that reason and partially just to simplify the system, could you change your code so it only calls exitSafeStart once at the beginning to see if the problem keeps happening?

Also, how long are your I2C wires?

Brandon

Hi Brandon,

The problems started when I originally only had “exit safe start” in setup, but the TICs would re-enter it randomly between 0.5 and 15 or so seconds later. I put that in loop to do some testing of the actual hardware without being limited by software.

I2C wires are 6" Arduino to breadboard, then 24" breadboard to tic1 and 36" breadboard to tic2 (I know, very long for I2C, but I’d expect errors on lost data instead of randomly setting safe start, but maybe I am not thinking through how safe start is implemented and why it would happen as a result).

There is also an I2C LCD Shield from adafruit atop the arduino.

Thank you for the additional information. With I2C lines that long, you might try setting the I2C speed to 10kHz (low speed), as documented on Arduino’s Wire.setClock() reference page

Just to be sure, can you verify that the only error that has a non-zero “Count” value in the “Status” tab of the Tic Control Center is the “Safe start violation” error (i.e. all of the others show up as " - ")?

Also, could you try removing the connection between the ERR pins on your Tics to see if that changes anything?

Brandon