Stealthchop模式下stallgurad4 DIAG输出设置
SG_RESULT(0x41),读出负载值。
SG_THRS(0x40),输出门限值, SG_RESULT <= SG_THRS*2
TCOOLTHRS(0x14),DIAG输出使能。STEP<= TCOOLTHRS
在速度下限达到时,DIAG使能,当SG_RESULT <= SG_THRS*2,DIAG中断口输出高电平。
//====================================================================================================//
// ACTUAL SETTINGS FOR TMC2209 (created: 2021/01/14 17:32:12) //
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv//
TMC2209_SPIWriteInt(0x00, 0x000000C0); // writing value 0x000000C0 = 192 = 0.0 to address 0 = 0x00(GCONF)
TMC2209_SPIWriteInt(0x03, 0x00000000); // writing value 0x00000000 = 0 = 0.0 to address 1 = 0x03(SLAVECONF)
TMC2209_SPIWriteInt(0x04, 0x00000000); // writing value 0x00000000 = 0 = 0.0 to address 2 = 0x04(OTP_PROG)
TMC2209_SPIWriteInt(0x07, 0x00000000); // writing value 0x00000000 = 0 = 0.0 to address 3 = 0x07(FACTORY_CONF)
TMC2209_SPIWriteInt(0x10, 0x00071F03); // writing value 0x00071F03 = 466691 = 0.0 to address 4 = 0x10(IHOLD_IRUN)
TMC2209_SPIWriteInt(0x11, 0x00000014); // writing value 0x00000014 = 20 = 0.0 to address 5 = 0x11(TPOWERDOWN)
TMC2209_SPIWriteInt(0x13, 0x00000000); // writing value 0x00000000 = 0 = 0.0 to address 6 = 0x13(TPWMTHRS)
TMC2209_SPIWriteInt(0x14, 0x000003E8); // writing value 0x000003E8 = 1000 = 0.0 to address 7 = 0x14(TCOOLTHRS)
TMC2209_SPIWriteInt(0x22, 0x00000000); // writing value 0x00000000 = 0 = 0.0 to address 8 = 0x22(VACTUAL)
TMC2209_SPIWriteInt(0x40, 0x00000096); // writing value 0x00000096 = 150 = 0.0 to address 9 = 0x40(SGTHRS)
TMC2209_SPIWriteInt(0x42, 0x00000000); // writing value 0x00000000 = 0 = 0.0 to address 10 = 0x42(COOLCONF)
TMC2209_SPIWriteInt(0x6C, 0x14000053); // writing value 0x14000053 = 335544403 = 0.0 to address 11 = 0x6C(CHOPCONF)
TMC2209_SPIWriteInt(0x70, 0xC10D1624); // writing value 0xC10D0024 = 0 = 0.0 to address 12 = 0x70(PWMCONF)
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^//