teemuatlut / TMCStepper

MIT License
479 stars 188 forks source link

How to switch off stealthChop mode in library for TMC2209? #296

Open dmitryBorisenkoXioneer opened 3 months ago

dmitryBorisenkoXioneer commented 3 months ago

Please help me to find way to switch off stealthChop mode for TMC2209.

Driver working in UART mode.

My code initialization part:

 TMCdriver->begin();                                              // UART: Init SW UART (if selected) with default 115200 baudrate
 TMCdriver->toff(5);                                               // off time and driver enable
 TMCdriver->rms_current(_params.CURRENT_);    // Set motor RMS current
 TMCdriver->microsteps(_params.MICROSTEP_);  // Set microsteps
 TMCdriver->shaft(false);                                       // SET DIRECTION
 TMCdriver->en_spreadCycle(false);                      // SpreadCycle™ - highly dynamic motor control chopper
 TMCdriver->pwm_autoscale(true);                       // two modes of PWM regulation, Needed for stealthChop
struct driverParams {
    uint8_t EN_PIN_ = 40;
    uint8_t DRIVER_ADDRESS_ = 0b00;
    float R_SENSE_ = 0.11;  // The current sense resistor
    int CURRENT_ = 2000;
    uint8_t MICROSTEP_ = 2;  // 1/2, 1/4, 1/8, 1/16 - going up - less torque power, more precision
    float MAX_RPS_ = 4;
    float STEP_RPS_ = 0.05;
    int STEP_PAUSE_ = 100;
};