Category: Software
Product Number: TMC2226
使用外部STEP控制,这是我的初始化代码,在调试时发现堵转检测功能并不好用,并且无法触发DIAG输出。
TMC_param_t initStutct;
memset(&initStutct, 0, sizeof(initStutct));
initStutct.TPwmThrs = 0;
initStutct.TCoolThrs = 100;
initStutct.SGThrs = 200;
initStutct.configReg.bits.IScaleAnalog = 1; // 使用外部VREF
initStutct.configReg.bits.internalRsense = 0;
initStutct.configReg.bits.enSpreadCycle = 0;
initStutct.configReg.bits.shaft = 0;
initStutct.configReg.bits.indexOtpwl = 0;
initStutct.configReg.bits.indexStep = 0;
initStutct.configReg.bits.pdnDisable = 1; // 使用串口
initStutct.configReg.bits.mstepRegSelect = 1; // 使用细分寄存器
initStutct.configReg.bits.multistepFilt = 1;
initStutct.configReg.bits.testMode = 0;
initStutct.IrunReg.bits.Irun = 31; // 0 ~ 31;
initStutct.IrunReg.bits.Ihold = 5; // 0 ~ 31;
initStutct.IrunReg.bits.IholdDelay = 7;
initStutct.chopReg.bits.Toff = 3;
initStutct.chopReg.bits.hStrt = 5;
initStutct.chopReg.bits.TBL = 1;
initStutct.chopReg.bits.mres = MICROSTEP_16;
initStutct.chopReg.bits.intpol = 1;
initStutct.chopReg.bits.diss2g = 1;
initStutct.chopReg.bits.diss2vs = 1;
测试参数 TCoolThrs :10~10000 SGthrs: 0~255,都无法在240RPM时触发DIGA,已经撞上结构未轴未转动
