|
|
@ -48,7 +48,11 @@ int umain(int argc, char const *argv[]) { |
|
|
|
port_tmc_extern_clk_enable(); |
|
|
|
// tmc4361motor1.init();
|
|
|
|
|
|
|
|
TMC4361AImpl::TMC4361AConfig_t *tmc4361aconfig = TMC4361AImpl::createDeafultTMC4361AConfig(); |
|
|
|
TMC4361AImpl::TMC4361AConfig_t *tmc4361aconfig = TMC4361AImpl::createDeafultTMC4361AConfig(); |
|
|
|
tmc4361aconfig->base_config.fs_per_rev = 200; |
|
|
|
tmc4361aconfig->encoder_config.diff_enc_in_disable = false; |
|
|
|
tmc4361aconfig->encoder_config.enc_in_res = 4000; |
|
|
|
tmc4361aconfig->close_loop_config.enable_closed_loop = true; |
|
|
|
|
|
|
|
tmc4361motor1.initialize(MOTOR_1_TMC4361A_CHANNEL, TMC4361A::IC_TMC2160, tmc4361aconfig); |
|
|
|
tmc2160motor1.initialize(MOTOR_1_TMC2160_CHANNEL, &tmc4361motor1); |
|
|
@ -61,6 +65,13 @@ int umain(int argc, char const *argv[]) { |
|
|
|
tmc2160motor1.enableIC(true); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief |
|
|
|
* PPS = 1000000 |
|
|
|
* RPS = 1000000/200/256 |
|
|
|
* RPM = 1000000/200/256*60 |
|
|
|
*/ |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 通过读取Version寄存器来判断芯片是否正常 |
|
|
|
*/ |
|
|
|
int32_t ic4361Version = tmc4361motor1.readICVersion(); |
|
|
@ -70,7 +81,7 @@ int umain(int argc, char const *argv[]) { |
|
|
|
|
|
|
|
tmc4361motor1.setMaximumAcceleration(300000); |
|
|
|
tmc4361motor1.setMaximumDeceleration(300000); |
|
|
|
tmc4361motor1.moveTo(41370340, 500000); |
|
|
|
tmc4361motor1.moveTo(41370340, 1000000); |
|
|
|
|
|
|
|
while (true) { |
|
|
|
port_do_debug_light_state(); |
|
|
|