Post Go back to editing

TMC5160 board self disables on first movement

Category: Hardware
Product Number: TMC5160

hello,

im having some trouble debugging a fault.

when the tmc5160 is connected to spi and registers are setup for a nema23 size motor given 20 volts and 4 amp max .

when sent a target position the driver disables , it trys to move one step and just disable's . at times it accels to a speed but on deccel disables and at times after not being sent a target positon again auto disables.

the spi connection is not lost as i can still read registers but the motor does not move and is disabled thereafter.

i can get it to work at a much lower current and drvStrengh settings but im not pulling all the amps it can handle and am confused as to why the board is disableling.

im using this code library https://github.com/tommag/TMC5160_Arduino

i have set registers up at boot as such, with such settings the driver enables, attempts to move and disables almost immediately.

TMC5160::PowerStageParameters powerStageParams;
TMC5160::MotorParameters motorParams;
powerStageParams.drvStrength = 3;
powerStageParams.bbmTime = 24;
powerStageParams.bbmClks = 0;
motorParams.globalScaler = 190;
motorParams.irun = 31;
motorParams.ihold = 15;
motorParams.pwmOfsInitial = 29;
motorParams.pwmGradInitial = 0;

as another example if i set drvstrengh to 2 and globalscaler to a lower value the motor moves and works without disabling.

TMC5160::PowerStageParameters powerStageParams;
TMC5160::MotorParameters motorParams;
powerStageParams.drvStrength = 2;
powerStageParams.bbmTime = 24;
powerStageParams.bbmClks = 0;
motorParams.globalScaler = 120;
motorParams.irun = 31;
motorParams.ihold = 15;
motorParams.pwmOfsInitial = 29;
motorParams.pwmGradInitial = 0;

i am printing drvStatus but i get no error's during the moment it disables to suggest a problem.


TMC5160_Reg::DRV_STATUS_Register drvStatus = {0};
drvStatus.value = motor.readRegister(TMC5160_Reg::DRV_STATUS);

Serial.print("stallGuard2 result: " + String(static_cast<bool>(drvStatus.sg_result)));
Serial.print(", short to supply A: " + String(static_cast<bool>(drvStatus.s2vsa)));
Serial.print(", short to supply B: " + String(static_cast<bool>(drvStatus.s2vsb)));
Serial.print(", stealthChop: " + String(static_cast<bool>(drvStatus.stealth)));
Serial.print(", Full step active: " + String(static_cast<bool>(drvStatus.fsactive)));
Serial.print(", Actual motor current: " + String(static_cast<bool>(drvStatus.cs_actual)));
Serial.print(", stallGuard2 status: " + String(static_cast<bool>(drvStatus.stallguard)));
Serial.print(", overtemperature flag: " + String(static_cast<bool>(drvStatus.ot)));
Serial.print(", overtemperature pre-warning flag: " + String(static_cast<bool>(drvStatus.otpw)));
Serial.print(", short to ground A: " + String(static_cast<bool>(drvStatus.s2ga)));
Serial.print(", short to ground B: " + String(static_cast<bool>(drvStatus.s2gb)));
Serial.print(", open load A: " + String(static_cast<bool>(drvStatus.ola)));
Serial.print(", open load B: " + String(static_cast<bool>(drvStatus.olb)));
Serial.print(", standstill indicator: " + String(static_cast<bool>(drvStatus.stst)));

any help to understand why the motor is disabling would be great.