Post Go back to editing

Limit movements to Fullstep or initialize position to a fullstep

Category: Software
Product Number: TMC5130

Hello everyone,

I inherited a project from a colleague. In the project we are using an TMC5130.
During the operation of our device we need to turn off the motor current. The stepper motor will then fall back into the nearest fullstep, but only in some cases. 
It is not acceptable, that motor moves in some situations, this is why we decided to only set the position in multiples of 256 to make sure we are already in a fullstep before we turn off the motor.

Does the TMC5130 have an operation mode, in which it will only move to fullstep positions?
During our init process we set the current Position of the TMC5130 to 0, can we somehow make sure this position is a fullstep. Or can we get the current microstep and set the position accordingly?

This is our init routine:
  tmc_write(VSTART, 0);
  tmc_write(VMAX, 0);
  tmc_write(RAMPMODE, 1);
  tmc_write(XACTUAL, 0); //How can we make sure this position is a fullstep
  tmc_write(XTARGET, 0);
  tmc_write(RAMPMODE, 0);
  tmc_write(CHOPCONF, 0x00000000);
  tmc_write(IHOLD_IRUN, 0x00001200);
  tmc_write(TPOWERDOWN, 0x0A);
  tmc_write(GCONF, 0x00000006);
  tmc_write(TPWMTHRS, 50);
  tmc_write(PWMCONF, 0x00050480);
  tmc_write(VSTART, 0);
  tmc_write(A1, 65535);
  tmc_write(V1, 660764);
  tmc_write(AMAX, 32767);
  tmc_write(DMAX, 65535);
  tmc_write(D1, 65535);
  tmc_write(VSTOP, 10);
  tmc_write(TZEROWAIT, 0);

Thanks and regards,

Marcel Kummer.