Home JGAurora A5 & A3S Modifications & Upgrades

Upgrade to TMC2208 Stepper Drivers

2»

Comments

  • Enrique RiriEnrique Riri Posts: 37🌟 Super Member 🌟

  • compman2compman2 Posts: 19Member
    edited May 2019
    I am in the middle of a conversion to TMC2130's on my JGAurora A5.  I have run into a number of issues getting them to work. I have them on all x,y,z,e0.  It has been a huge learning curve to even get them close to functional.  I have one outstanding issue that I am perplexed by.  I can't get movement on the Z axis.  I ran a m122 and got the results below.  The strange thing is that there seems to be some really weird numbers on the z axis.  Reference threshold, stallguard, sgresult.  I have sensorless homing disabled.  The other thing that seems odd is that the Y axis and E0 axis have the same register value.  Is that normal?

    SENDING:M122
                                     X                 Y                 Z                E0
    Enabled                   false            false            false           false
    Set current               800              800             800             800
    RMS current            795              795              795             795
    MAX current            1121            1121            1121           1121
    Run current              25/31          25/31           25/31          25/31
    Hold current            12/31           12/31           12/31          12/31
    CS actual                12/31           12/31           12/31          12/31
    PWM scale              35                26                18               40
    vsense                    1=.18           1=.18            1=.18          1=.18
    stealthChop             true              true              true             true
    msteps                    16                 16                6                 16
    tstep                       1048575       1048575      1048575      1048575
    pwm
    threshold              98                  98                  4294967295                 263
    [mm/s]                 100.85           100.85            0.00             30.06
    OT prewarn         false               false               false            false
    OT prewarn has 
    beem triggered     false               false              false           false
    off time                 5                     5                   5                 5
    blank time            24                   24                  24               24
    hysteresis
    -end                     2                     2                    2                  2
    -start                    3                     3                    3                  3
    Stallguard thrs     0                     0                    0                  0
    DRVSTATUS       X                    Y                    Z                  E0
    stallguard                                                         X
    sg_result              0                    0                    55                 0
    fsactive
    stst                       X                    X                   X                   X
    olb                        X
    ola                        X
    s2gb
    s2ga
    otpw
    ot
    Driver registers: X = 0xE0:0C:00:00
                              Y = 0x80:0C:00:00
                              Z = 0x81:0C:00:37
                            E0 = 0x80:0C:00:00

    My journey so far is this.  I created the harness which I have checked and it is correct.  I used the standard MOSI(D51),MISO (D50) and CLK(D52) pins on the board.  I used pin D40 for CS x axis, D64 for CS y axis, D42 for CS z axis, D44 for E0.   I made the changes in pins_ramps.h to match.  Flashed the firmware and on startup it would call the kill proceedure.  I removed all the CS connections to see if that was the issue.  Same result.  I then removed the connections MOSI,MISO, CLK.  It then booted. At one point I was able to boot into the firmware and test movement.  I was able to get X and Z to move but no Y (Didn't test E0).  I restarted and the error returned and I never got it to boot without erroring out.

    I researched this more and saw that some people were having issues with Marlin 1.1.8 and SPI and timing issues.  Because Marlin 1.1.9 allowed the defining of the communication pins I downloaded the community 1.1.9 Beta 2 and made the pin changes necessary to move all the communication to AUX-2.  Pins defined as follows.  (This allows all the pins to be on the AUX-2 Connector which is tidy)

    CS X     63                                 MOSI     42
    CS Y     59                                 MISO     44
    CS Z     40                                 CLK        66
    CS E0   44

    I made the changes in pins_RAMPS.h for the CS pins, and modified configuration_adv.h to use software spi and assigned the pins.  I made the changes in configuration.h to  I flashed this firmware and low and behold no errors on bootup.  I could get X and Y to move but not Z.  I checked cabling again and saw that the CS line in the connector wasn't seated correctly.  I re-seated it and that is when I got the M122 output above.  I have switched drivers on the Z and E0 axis with the same results.  I switched drivers back and seated the cables well on the drivers, verified orientation.  i have confirmed that the extruder stepper motor moves, so now I only have the issue with z axis.  There are times that I can get the z axis to move slightly if it is down.  Never any movement up.  I tried increasing the current to 1000 and 1200 but the same result.  My next steps are to try a M502 then M500 and a cold boot followed by a M122 to see if the diagnostics report looks more normal.  I have also considered moving the SPI back to the standard hardware based pins.  MOSI 51, MISO 50, CLK 52 to see if that would work better.  I guess my ultimate fallback would be to put the A4988 drivers back for Z and E0.  I may also switch the drivers on Z and E0 again now that I am communicating and see if Z works and E0 fails.  This would point to a driver issue.  It has been a longer journey that I expected.  If there are any sage words of advice I welcome them.  I need to get my beast back in action.  Too many projects too little time.

    pins_RAMPS.h
    //
    // Steppers
    //
    #define X_STEP_PIN         54
    #define X_DIR_PIN          55
    #define X_ENABLE_PIN       38
    #ifndef X_CS_PIN
      #define X_CS_PIN         63 //default 53
    #endif

    #define Y_STEP_PIN         60
    #define Y_DIR_PIN          61
    #define Y_ENABLE_PIN       56
    #ifndef Y_CS_PIN
      #define Y_CS_PIN         59 //default 49
    #endif

    #define Z_STEP_PIN         46
    #define Z_DIR_PIN          48
    #define Z_ENABLE_PIN       62
    #ifndef Z_CS_PIN
      #define Z_CS_PIN         40 //default 40
    #endif

    #define E0_STEP_PIN        26
    #define E0_DIR_PIN         28
    #define E0_ENABLE_PIN      24
    #ifndef E0_CS_PIN
      #define E0_CS_PIN        64 //default 42
    #endif

    #define E1_STEP_PIN        36
    #define E1_DIR_PIN         34
    #define E1_ENABLE_PIN      30
    #ifndef E1_CS_PIN
      #define E1_CS_PIN        44
    #endif

    /**
     * Default pins for TMC software SPI
     */
    #if ENABLED(TMC_USE_SW_SPI)
      #ifndef TMC_SW_MOSI
        #define TMC_SW_MOSI    42     //default 66
      #endif
      #ifndef TMC_SW_MISO
        #define TMC_SW_MISO    44     //default 44
      #endif
      #ifndef TMC_SW_SCK
        #define TMC_SW_SCK     66      //default 64
      #endif
    #endif



    Configuration.h
    #define X_DRIVER_TYPE  TMC2130         //default A4988
    #define Y_DRIVER_TYPE  TMC2130         //default A4988
    #define Z_DRIVER_TYPE  TMC2130         //default A4988
    //#define X2_DRIVER_TYPE A4988
    //#define Y2_DRIVER_TYPE A4988
    //#define Z2_DRIVER_TYPE A4988
    #define E0_DRIVER_TYPE TMC2130        //default A4988

    // @section machine

    // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
    #define INVERT_X_DIR false            //default true
    #define INVERT_Y_DIR true             /default false
    #define INVERT_Z_DIR true             //default false

    // @section extruder

    // For direct drive extruder v9 set to true, for geared extruder set to false.
    #define INVERT_E0_DIR false                //default true
    #define INVERT_E1_DIR false
    #define INVERT_E2_DIR false
    #define INVERT_E3_DIR false
    #define INVERT_E4_DIR false

    Configuration_adv.h
    // @section tmc_smart

    /**
     * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to
     * the hardware SPI interface on your board and define the required CS pins
     * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
     * You may also use software SPI if you wish to use general purpose IO pins.
     *
     * You'll also need the TMC2130Stepper Arduino library
     *
     * To use TMC2208 stepper UART-configurable stepper drivers
     * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor.
     * To use the reading capabilities, also connect #_SERIAL_RX_PIN
     * to PDN_UART without a resistor.
     * The drivers can also be used with hardware serial.
     *
     * You'll also need the TMC2208Stepper Arduino library
     */
    #if HAS_TRINAMIC

      #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
      #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
      #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256

      #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
      #define X_MICROSTEPS        16  // 0..256

      #define Y_CURRENT          800
      #define Y_MICROSTEPS        16

      #define Z_CURRENT          800
      #define Z_MICROSTEPS        16

      #define X2_CURRENT         800
      #define X2_MICROSTEPS       16

      #define Y2_CURRENT         800
      #define Y2_MICROSTEPS       16

      #define Z2_CURRENT         800
      #define Z2_MICROSTEPS       16

      #define E0_CURRENT         800
      #define E0_MICROSTEPS       16

      #define E1_CURRENT         800
      #define E1_MICROSTEPS       16

      #define E2_CURRENT         800
      #define E2_MICROSTEPS       16

      #define E3_CURRENT         800
      #define E3_MICROSTEPS       16

      #define E4_CURRENT         800
      #define E4_MICROSTEPS       16

      /**
       * Use software SPI for TMC2130.
       * The default SW SPI pins are defined the respective pins files,
       * but you can override or define them here.
       */
      #define TMC_USE_SW_SPI
      #define TMC_SW_MOSI       42
      #define TMC_SW_MISO       44
      #define TMC_SW_SCK        66

      /**
       * Use Trinamic's ultra quiet stepping mode.
       * When disabled, Marlin will use spreadCycle stepping mode.
       */
      #define STEALTHCHOP

      /**
       * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
       * like overtemperature and short to ground. TMC2208 requires hardware serial.
       * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
       * Other detected conditions can be used to stop the current print.
       * Relevant g-codes:
       * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
       * M911 - Report stepper driver overtemperature pre-warn condition.
       * M912 - Clear stepper driver overtemperature pre-warn condition flag.
       * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
       */
      #define MONITOR_DRIVER_STATUS

      #if ENABLED(MONITOR_DRIVER_STATUS)
        #define CURRENT_STEP_DOWN     50  // [mA]
        #define REPORT_CURRENT_CHANGE
        #define STOP_ON_ERROR
      #endif

      /**
       * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD.
       * This mode allows for faster movements at the expense of higher noise levels.
       * STEALTHCHOP needs to be enabled.
       * M913 X/Y/Z/E to live tune the setting
       */
      #define HYBRID_THRESHOLD

      #define X_HYBRID_THRESHOLD     100  // [mm/s]
      #define X2_HYBRID_THRESHOLD    100
      #define Y_HYBRID_THRESHOLD     100
      #define Y2_HYBRID_THRESHOLD    100
      #define Z_HYBRID_THRESHOLD       3
      #define Z2_HYBRID_THRESHOLD      3
      #define E0_HYBRID_THRESHOLD     30
      #define E1_HYBRID_THRESHOLD     30
      #define E2_HYBRID_THRESHOLD     30
      #define E3_HYBRID_THRESHOLD     30
      #define E4_HYBRID_THRESHOLD     30

      /**
       * Use stallGuard2 to sense an obstacle and trigger an endstop.
       * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
       * X, Y, and Z homing will always be done in spreadCycle mode.
       *
       * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
       * Higher values make the system LESS sensitive.
       * Lower value make the system MORE sensitive.
       * Too low values can lead to false positives, while too high values will collide the axis without triggering.
       * It is advised to set X/Y/Z_HOME_BUMP_MM to 0.
       * M914 X/Y/Z to live tune the setting
       */
      //#define SENSORLESS_HOMING // TMC2130 only

      #if ENABLED(SENSORLESS_HOMING)
        #define X_HOMING_SENSITIVITY  8
        #define Y_HOMING_SENSITIVITY  8
        #define Z_HOMING_SENSITIVITY  8
      #endif

      /**
       * Enable M122 debugging command for TMC stepper drivers.
       * M122 S0/1 will enable continous reporting.
       */
      #define TMC_DEBUG



    Post edited by compman2 on
  • GandyGandy Posts: 89🌟 Super Member 🌟
    Hi,

    just wanted to share my experiences with the upgrade to TMC2208. My printer is basically a V9 but still with the meanwell power supply (making it a V8.5?), running the Marlin 1.1.x-bugfix branch.

    A few days ago I finished my upgrade to FYSETC TMC2208 v1.2 drivers on all axes, including the extruder. Before replacing the drivers, I made sure to document Vref on all of them, which actually seem to have been adjusted by JGAurora. Maybe sharing this information here also helps others:

    MotorVref,A4988Imax,A4988Irms,A4988Irms,TMC2208
    X510 mV 638 mA452 mA460 mA
    Y491 mV 614 mA435 mA440 mA
    Z878 mV1098 mA778 mA780 mA
    E0526 mV658 mA466 mA480 mA

    (Irms,TMC2208 denote the settings I chose for the drivers based on the Irms,A4988 values derived from the measurements)

    Since I'm operating all the TMC2208s in UART mode, I adjusted the Vref on the drivers to roughly 1.5V as per Da Hai's recommendations. Doing so I realized just how finicky those potis are, so maybe choosing UART and software controlled Irms settings is really the better option. Escpecially considering the overheating issue at increased Irms settings:
    • at 800 mA, the extruder motor soon exceeds 53°C, where the PLA I was printing with got so soft that the extruder gear lost all its grip on the filament.
    • at 620 mA, the motor still reached 47°C after 2hours of printing
    • at 480 mA, the motor stayed well below 40°C even after 12 hours of printing (Marlin 1.1.9 w/ linear advance 1.5, s-curve acceleration an juction deviation enabled, printing speed 70mm/s, cura slicer)
    I've done several prints up to several hours with these settings now, never seeing any indications of layer shifts or extrusion problems. As it never runs too hot, there's no need for an additional fan on the extruder motor.

    Hope this helps, cheers,
    Andy.
    Thanked by 1Samuel Pinches
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Thanks for sharing your experience Andy! :smiley:
  • Charly3Charly3 Posts: 35🌟 Super Member 🌟
    Here´s my second report as announced after changing the first 2208 a couple of month ago.

    Have 8x 2208 (FYSETC Version) now on both A5 on all axes and extruders in standalone mode. Voltage is about 1,5V on each. Here I go with Tom Sanlander, wo doesn´t really care about voltages but cares about motorheat. Working Temp of Motors is about 50°-60° Celsius and there´s no layer skipping at all  - even while printing 0,6 or 0,8 mm nozzles (with titan extruder and volcano heaterblock)  with up to 150 mm/sec on prints lasting for 5 days.


    Now I´d like to start some experiments with UART Mod and there are two upcoming questions:

    1.

    I´ve set up an 2208 UART Version of Marlin 1.1.9 -  it compiles but (with all the mods installed) gives a warning:

    Sketch uses  225364 Bytes (88%) ... there may be stability problems...

    Does anyone have experiences in this? Will it be a serious problem?

    2.

    Im not shure about babystepping other than 16. There are some hints about adjusting when activating 255, but what to adjust and how to determin the values?

    Reg. Charly
    Thanked by 1Samuel Pinches
  • Enrique RiriEnrique Riri Posts: 37🌟 Super Member 🌟
    edited June 2019
    I still had the same message issue on compil:
    "Sketch uses  225364 Bytes (88%) ... there may be stability problems…"
    But it doesn't affect the normal work for me.
    After few months now and a lot of trials and readings, I down the vref drivers around 1v. (less warm with stepper motors), and works like a charm. The only last improvements I made: replace all metal bearings by IGUS linear ones, replace extruder with a BMG clone one (take care here, there are different quality plastics). 
    TMC2130 or TMC2208 ? After trying both, I personnally choice TMC2208. Just take care between V1 and V2, the cabling with the 1k resistor is not the same .
    That's it for the moment. 
    Post edited by Enrique Riri on
  • Der_MuckDer_Muck Posts: 265🌟 Super Member 🌟
    Isnt the 88% sketch use problem because of the print record setting in the firmware?  You have to turn it off, it collects to much data you dont need.
  • Charly3Charly3 Posts: 35🌟 Super Member 🌟
    Thanks Enrique for sharing your experience.

    I´ve got it running now for a while and my issues are:

    x/y/z are working fine. But driver for E0 won´t register. Swapped 2208 (V1) and cabeling (and tried different Pins for E0) can´t get it running in UART.

    Second Problem: On the first E0 access by touch panel, z will lower 10 mm in parallel.

    Third Problem: G-Start code does UBL with preheated bed and afterwards raises nozzle temp. If nozzle temp in g-code is lower than in model code every now and then nozzle temp is closed and printer is waiting for the temperature infinitely.

    Any experience, solutions in this
  • Joshua LoosJoshua Loos Posts: 7Member
    @Gandy when you did the settings of the current for your stepperdrivers via software did you just use the M906 E480, 
    M906 X460, etc, etc? 
    or did you calculate the current using the RMS values in your table? setting them as follows

    M906 X650, M906 E679
  • GandyGandy Posts: 89🌟 Super Member 🌟
    @Joshua Loos the values in the first column of the table, Vref,A4988, are the voltages I measured on my actual drivers. From that I calculated the values in the second column, Imax,A4988, using the formula stated in the MKS datasheet (p.21):

    4988 Green: Drive current algorithm: i = vref /0.8

    Since this is Imax and the TMC requires Irms, I divided those values by the square root of 2 to yield column 3, Irms,A4988. Since setting the Vref values is not a terrible accurate process in the first place, I rounded those values for column 4, Irms,TMC2208.

    In the end, I transferred the values from column 4 with the M906 command:
    M906 X460 Y440 Z780 E480

    Some time later I took those values to the Marlin Configuration_adv.h file and installed the fresh compile on the A5 so to not loose them to some random M502 lateron.

  • netzmarknetzmark Posts: 107🌟 Super Member 🌟
    I have E450 for TMC2208 and motor is much to hot after 20 minutes printing. Do you have stealthchop activated for E?
  • GandyGandy Posts: 89🌟 Super Member 🌟
    I had stealthchop activated in general, but I also used TMC_ADV to have E0 in spreadcycle:
    ```
    #define TMC_ADV() { stepperE0.en_spreadCycle(true); }
    ```
    I also lowered the current to 470, eventually. You may have to experiment a bit to find your own best current. The motor should never get too hot to touch.
    Thanked by 1Samuel Pinches
  • netzmarknetzmark Posts: 107🌟 Super Member 🌟
    At the begining I had E800 and in effect filament melted in the bowden.
    I have lowered it to E450 and it is still very hot - I've added extra small cooler to fix it, but this is not the good solution in my oppinion. 2208 should work not worse that 4998.

    But having declaration
    #define E0_HYBRID_THRESHOLD     30mm/s
    and printing/retracting with speed 100mm/s (I use 100) means an extruder's printing in spreadcycle always.
    I will try how this work with forced stealthchop.

  • RogerRoger Posts: 4Member
    Hi guys :)
    I have instlaled TMC2208 on X and Y but i cant find marlin 1.1.9 custom JGA5 link are dead (https://jgmakerforum.com/discussion/259/beta-jgaurora-a5-firmware-1-1-9c
    So i get the 1.1.8 custom for JGA5 i reverse code invert_x and y but i cant change  :
    #define X_DRIVER_TYPE  TMC2208
    #define Y_DRIVER_TYPE  TMC2208
    
Sign In or Register to comment.