Browse Source

update

master
zhaohe 1 year ago
parent
commit
4a20951203
  1. 26
      components/tmc/ic/ztmc4361A.cpp

26
components/tmc/ic/ztmc4361A.cpp

@ -132,9 +132,9 @@ void TMC4361A::setAcceleration(float accelerationpps2) {
* AMAX [pps2] = AMAX / 237 ?? fCLK^2
*/
accelerationpps2 = to_motor_acc(accelerationpps2);
int32_t acc = (int32_t)accelerationpps2;
tmc4361_writeInt(TMC4361A_AMAX, acc << 2);
// accelerationpps2 = to_motor_acc(accelerationpps2);
// int32_t acc = (int32_t)accelerationpps2;
// tmc4361_writeInt(TMC4361A_AMAX, acc << 2);
}
void TMC4361A::setDeceleration(float accelerationpps2) {
/**
@ -147,9 +147,9 @@ void TMC4361A::setDeceleration(float accelerationpps2) {
* a[?v per clk_cycle]= AMAX / 2^37
* AMAX [pps2] = AMAX / 237 ?? fCLK^2
*/
accelerationpps2 = to_motor_acc(accelerationpps2);
int32_t acc = (int32_t)accelerationpps2;
tmc4361_writeInt(TMC4361A_DMAX, acc << 2);
// accelerationpps2 = to_motor_acc(accelerationpps2);
// int32_t acc = (int32_t)accelerationpps2;
// tmc4361_writeInt(TMC4361A_DMAX, acc << 2);
}
#define INIT_GPIO(m_pin, pin, ...) \
if (pin != PinNull) { \
@ -219,13 +219,13 @@ void TMC4361A::init() {
tmc4361_writeInt(0x6D, 0x80); // GCONF
tmc4361_writeInt(0x6C, 0x00); // 0x12200 diag1=index, pushpull, direct_mode = off --> SD mode
tmc4361_writeInt(0x20, 0x06); // s-ramp + pos mode
tmc4361_writeInt(0x2D, 0x100); // bow1
tmc4361_writeInt(0x2E, 0x100); // bow2
tmc4361_writeInt(0x2F, 0x100); // bow3
tmc4361_writeInt(0x30, 0x100); // bow4
tmc4361_writeInt(TMC4361A_AMAX, 10000); // amax
tmc4361_writeInt(TMC4361A_DMAX, 10000); // dmax
tmc4361_writeInt(0x20, 0x06); // s-ramp + pos mode
tmc4361_writeInt(0x2D, 0x80); // bow1
tmc4361_writeInt(0x2E, 0x100); // bow2
tmc4361_writeInt(0x2F, 0x80); // bow3
tmc4361_writeInt(0x30, 0x100); // bow4
tmc4361_writeInt(TMC4361A_AMAX, 1000); // amax
tmc4361_writeInt(TMC4361A_DMAX, 1000); // dmax
}
uint8_t TMC4361A::reset() {

Loading…
Cancel
Save