Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Tic controller using serial commands

I thought I understood the General Status Variable bit values, but I am apparently still confused.

For purposes of discussion, I have 8 stepper motors, with 8 Tic controllers I am using a raspberry pi to issue serial commands to the tic controllers

I am trying to achieve two things:
Send a positioning command to one Tic controller, then when that positioning is complete, send a positioning command to to a second Tic controller, then the next and so on. If I just place the normal serial command for each controller in a for loop, all motors start moving at the same time (more or less) as the for loop is completed in a few ms. I’ve nominally solved this by checking that current position is equal to the set position: code snippet below:

for x in range(1,9):
    device_number = x   #None
    # port = serial.Serial(port_name, baud_rate, timeout=0.1, write_timeout=0.1)
    tic = TicSerial(port, device_number)
    # move axes and monitor position
    # *** this while loop delays transmission of tic commands until each axis is done ***
            while curr_pos != new_jaw[x]:
                curr_pos = tic.get_current_position()

this nominally works, but I am not sure how to do the same with the homing operation. I have this code, but it seems the position_uncertain_flag(): can have different values, but I don’t know which to look out for and what the value would be.

for x in range(1,9):
    device_number = x   #None
    tic = TicSerial(port, device_number)

# *** HOME ALL AXES ***
            errFlag = tic.get_position_uncertain_flag()
            while errFlag == "19":
                errFlag = tic.get_position_uncertain_flag()

I modified that function as such:

  def get_position_uncertain_flag(self):
    b = self.get_variables(0x01, 1)
    lstb = list(b)
    error_flag = str(lstb[0])
    return error_flag

The second issue is to power-off the tic controller, power it back up, and “tell it” where it is supposed to be (set_current_position() ), (command 0xEC )since I had prior to powering it off, recorded it’s position. Which other commands need to precede or follow that command? ie: tic.energize() tic.exit_safe_start()

  def set_current_position(self, target):
       ((target >>  7) & 1) | ((target >> 14) & 2) |
       ((target >> 21) & 4) | ((target >> 28) & 8),
       target >> 0 & 0x7F,
       target >> 8 & 0x7F,
       target >> 16 & 0x7F,
       target >> 24 & 0x7F)


Instead of checking the value of the entire byte returned for the “Misc flags 1” variable, I suggest bit masking the returned value to just consider bit 4, which is the “Homing active” bit. This bit should be 1 when the homing is still taking place and 0 when it is not.

The order in which you set the current position should not matter much (i.e. the motor does not have to be energized and it will still work before you exit safe start). If you are having some problems when doing that, you can post more details and I would be happy to try to offer some additional suggestions.


Thank you Brandon. I will give those a try.