Browse Source

update

master
zhaohe 1 year ago
parent
commit
e86c7fff19
  1. 47
      components/tmc/ic/ztmc4361A.cpp

47
components/tmc/ic/ztmc4361A.cpp

@ -235,12 +235,59 @@ uint8_t TMC4361A::reset() {
zchip_clock_early_delayus(1000);
SET_PIN(m_resetPin, true);
tmc4361_writeInt(TMC4361A_RESET_REG, 0x525354);
zchip_clock_early_delayus(1000);
tmc4361_writeInt(TMC4361A_RESET_REG, 0);
/**
* @brief ??
*
*/
for (uint32_t add = 0; add < TMC4361A_REGISTER_COUNT; add++) {
if (!TMC_IS_RESETTABLE(m_registerAccessTable[add])) {
continue;
}
tmc4361_writeInt(add, m_defaultRegisterResetState[add]);
}
uint8_t driver, dataLength;
uint32_t value;
// Setup SPI
switch (m_driver_ic_type) {
case IC_TMC2130:
case IC_TMC2160:
driver = 0x0C;
dataLength = 0;
break;
case IC_TMC2660:
driver = 0x0B;
dataLength = 0;
break;
default:
driver = 0x0F;
dataLength = 40;
break;
}
value = 0x44400040 | (dataLength << 13) | (driver << 0);
tmc4361_writeInt(TMC4361A_SPIOUT_CONF, value);
tmc4361_writeInt(TMC4361A_CURRENT_CONF, 0x00000003);
tmc4361_writeInt(TMC4361A_SCALE_VALUES, 0x00000000);
return 1;
#if 0
// Pulse the low-active hardware reset pin
stop();
SET_PIN(m_resetPin, false);
zchip_clock_early_delayus(1000);
SET_PIN(m_resetPin, true);
// 软件复位
tmc4361_writeInt(TMC4361A_RESET_REG, 0x525354);
zchip_clock_early_delayus(1000);
tmc4361_writeInt(TMC4361A_RESET_REG, 0);
init();
#endif
// 发送 0x4440128C to SPI_OUT_CONF 寄存器 0x04。
// 发送 0xEC 到 COVER_HIGH 寄存器 0x6D 及 0x000100C3 到 COVER_LOW 寄存器 0x6C。

Loading…
Cancel
Save