Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Duet 3 StealthChop 2 Tuning for Nema23

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    7
    44
    4.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dc42undefined
      dc42 administrators
      last edited by

      I will try the same settings. What is your steps/mm ?

      Duet WiFi hardware designer and firmware engineer
      Please do not ask me for Duet support via PM or email, use the forum
      http://www.escher3d.com, https://miscsolutions.wordpress.com

      fractalengineerundefined 2 Replies Last reply Reply Quote 0
      • fractalengineerundefined
        fractalengineer @dc42
        last edited by fractalengineer

        @dc42 appreciate it; 160steps/mm

        In fact here's my last workingish config.g

        ; General Setup - RailCore RRF on a SBC for Duet3
        G21										; Work in millimetres
        G90										; Send absolute coordinates...
        M83										; ...but relative extruder moves
        
        ; Debugging
        M111 S0									; Debug (S0 is off; S1 is on)
        M929 P"eventlog.txt" S1					; start logging to file eventlog.txt
        M915 X Y S10 F0 R1						; log motor stalls (added 5/4/2019)
        
        
        ; Stepper configuration
        M569 P0 S1 D3							; Drive 0 X / Rear
        M569 P1 S0 D3							; Drive 1 Y / Front
        M569 P2 S1 D3							; Drive 2 Z Front Left
        M569 P3 S1 D3							; Drive 3 Z Rear Left
        M569 P4 S1 D3							; Drive 4 Z Right
        M569 P5 S0 D3							; Drive 5 Extruder
        
        ; Trinamic Drive Tuning
        ; Tune tpwmthrs (V) so stealthchop runs at appropriate speeds
        ; and tune thigh (H) to avoid shifting into fullstep mode
        M569 P0 V30   H23                                    ; X            - Set tpwmthrs so StealthChop runs up to 70mm/sec (try V47)
        M569 P1 V30   H23                                    ; Y            - Set tpwmthrs so StealthChop runs up to 70mm/sec
        M569 P2 V15   H5                                    ; Z Right      - Set tpwmthrs so StealthChop runs up to 15.6mm/sec
        M569 P3 V15   H5                                    ; Z Left Rear  - Set tpwmthrs so StealthChop runs up to 15.6mm/sec
        M569 P4 V15   H5                                    ; Z Left Front - Set tpwmthrs so StealthChop runs up to 15.6mm/sec
        M569 P5 V125  H5                                    ; E            - Set tpwmthrs so StealthChop runs up to 7.2mm/sec
        
        ; Stealthchop parameters
        M915 P0 S3 F1 H153 T1 R0				
        M915 P1 S3 F1 H153 T1 R0
        
        
        ; Axis configuration
        M669 K1									; Corexy mode
        M584 X0 Y1 Z2:3:4 E5					; Map X to drive 0 Y to drive 1, Z to drives 2, 3, 4, and E to drive 5
        
        
        ; Leadscrew locations
        M671 X-10:-10:333  Y22.5:277.5:150 S7.5
        
        
        ; Steppers Settings
        M350 X16 Y16 Z16 I1						; Set 16x microstepping for axes with interpolation
        M350 Z16 I1
        M350 E16 I0								; Set 8x microstepping for Flex3Drive extruder interpolation OFF
        M906 X1820 Y1820 Z1008 E420 I35			; Set motor currents (mA) and motor idle factor (%) // X/Y 65% of rated 2800mA
        M84 S30 								; Idle timeout 30s
        M201 X1600 Y1600 Z100 E120				; Accelerations (mm/s^2) (Was 2500)
        M203 X24000 Y24000 Z900 E2400			; Maximum speeds (mm/min) 
        M566 X800 Y800 Z100 E6					; Maximum jerk speeds mm/minute 
        M208 X290 Y303 Z325						; Set axis maxima and high homing switch positions (adjust to suit your machine)
        M208 X-27 Y0 Z0 S1						; Set axis minima and low homing switch positions (adjust to make X=0 and Y=0 the edges of the bed)
        M92 X160 Y160 Z1600 E4130				; Steps/mm
        
        ; End Stops
        M574 X1 S1 P"io0.in"					; Map the X endstop to io1.in
        M574 Y1 S1 P"io3.in"					; May the Y endstop to io2.in
         
        
        ; Define Bed
        M140 H0
        M557 X5:290 Y30:300 P8:8 				; Probe from X=5 to 290, Y=30 to 300mm with 8x8 points
        
        
        ; Thermistors
        M308 S0 P"temp0" Y"thermistor" A"Keenovo" T100000 B4240 H0 L0 						; Bed thermistor - connected to temp0
        M308 S1 P"temp1" Y"thermistor" A"Mosquito" T4606017 B5848 C5.548428e-8 H0 L0			; Dyze 500c thermistor - connected to e0_heat
        
        
        ; Define Heaters
        M950 H0 C"out0" T0						; Bed heater is on out0
        M950 H1 C"out1" T1						; Hotend heater is on out1
        
        
        ; Heater model parameters
        M307 H0 A158.5 C366.7 D2.1 S1.0 V24.0 B0 	; Keenovo duet 3 configuration
        M307 H1 A324.0 C114.3 D4.4 S1.0 V23.9 B0    ; Heating process parameters for 24V a system
        
        
        ; Heater Fault Parameters
        M570 H1 P10 T15 S180					; Hotend allows 10sec for anomaly, permits 15deg excursion, abandons print after 180s
        M143 S350								; Set max hotend temperature			
        
        
        ; Fans
        M950 F0 C"out5"							; Hotend fan on "out5" connector
        M106 P0 S1.0 H1 T75 					; Enable thermostatic mode for hotend fan (S225)
        M950 F1 C"out4"							; Layer fan on "out4" connector
        M106 P1 S0 								; Layer Fan
        
        
        ; Tool definitions
        M563 P0 D0 H1 F1                       	; Define tool 0
        G10 P0 S0 R0                        	; Set tool 0 operating and standby temperatures
        
        
        ; BLTouch
        M558 P9 C"io7.in" H5 R1 F120 T6000 A5 S0.02 B1			; Define the bltouch input on io7.in
        M950 S0 C"io7.out"										; Define the bltouch servo on io7.out
        G31 X Y25 Z1.95 P25 										; Set the offsets for the bltouch
        
        
        ; Duet3 Cooling
        M308 S2 Y"drivers" A"DRIVERS"  			; Configure sensor 2 as temperature warning and overheat flags on the TMC2660 on Duet
        M308 S3 Y"mcu-temp" A"MCU"				; Configure sensor 3 as thermistor on pin e1temp for left stepper
        M950 F2 C"out6" Q100 					; Create fan 2 on pin fan2 and set its frequency                        
        M106 P2 C"ElectroBox" H1 L0.0 X1.0 B0.3 T70:160 			; Set fan 2 value
        
        ; Filament Sensor
        M591 D0 P7 C"io6.in" S0 E50 L1.25 R25:175 A1
        
        T0										; Select first hot end
        
        ; Mesh Bed Compensation
        G29 S1 									; Load height map from SD card
        M376 H3									; Set taper height 3mm
        
        ; Dynamic Acceleration Adjustment
        M593 F52
        
        ; Logging
        M929 P"eventlog.txt" S1 				; start logging to file eventlog.txt
        

        Thanks David

        Railcore II ZL

        1 Reply Last reply Reply Quote 0
        • fractalengineerundefined
          fractalengineer @dc42
          last edited by

          @dc42 Ok a few more observations from today's experiments:

          • The motors don't seem to like hanging around the V setting speed; movements gets either in StealthC with hiccups, or in SpreadC with hiccups, or just stalls/seizes altogether.

          • Changing the V value doesn't fix this weird zone; it just moves it around

          • Turning M569 do D2 makes it smoother at those speeds; no more hiccup, just regular screamy Spreadcycle

          • Even then, In SpreadCycle mode they still stall at relatively low speed; 160mm/s even on X/Y moves

          • These stalls don't happen right upon movement start; it builds up over the length of the -long- move. That means, the speed of 160mm/s doesn't change over the duration of the movement, but it tracks well in the beginning, then stalls at the end

          Hope that helps

          Railcore II ZL

          1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators
            last edited by dc42

            Thanks for the extra info.

            @fractalengineer said in Duet 3 StealthChop 2 Tuning for Nema23:

            Even then, In SpreadCycle mode they still stall at relatively low speed; 160mm/s even on X/Y moves

            These stalls don't happen right upon movement start; it builds up over the length of the -long- move. That means, the speed of 160mm/s doesn't change over the duration of the movement, but it tracks well in the beginning, then stalls at the end

            Barring the TMC5160 drivers doing odd things, or air resistance increasing substantially at the end of the move, that suggests that the motors are not powerful to overcome frictional forces.

            • Are you sure that the mechanism isn't tending to bind at high speeds?
            • Does the same happen with both pure X and pure Y moves?
            • What are the maximum speeds before reduction in torque predicted by the motor EMF calculator now?
            • Does the torque/speed curve for the motors (if available) show anything odd at those speeds?
            • Please confirm that in spreadCycle mode you have thigh set high enough so that coolStep won't be operating at those speeds.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            fractalengineerundefined 3 Replies Last reply Reply Quote 0
            • fractalengineerundefined
              fractalengineer @dc42
              last edited by

              @dc42

              • Well again the steppers are running free; nothing connected to them

              • And yes all the observations were made with a manual gcode that goes from origin to top left corner to front right and back to origin

              • Maximum speed according to EMF Calc should be at least 220mm/s

              @fractalengineer said in Duet 3 StealthChop 2 Tuning for Nema23:

              @dc42 Thank you.

              Okay well the EMF calc is giving yet a faster slipping speed in cartesian:

              21a60d3c-0881-4a40-a29b-d4375aaa8cae-image.png

              And the steppers are running free right now; zero friction as the belts are off

              • Thigh is set to 5 usually which makes 999mm/s

              • I'll see if I can get the curve

              Railcore II ZL

              Phaedruxundefined 1 Reply Last reply Reply Quote 0
              • fractalengineerundefined
                fractalengineer @dc42
                last edited by

                @dc42 that one is for the previous 8.5mH steppers that had the same issues but at sightly higher speed
                fae51366-307b-400d-a380-157435cd188e-image.png

                Railcore II ZL

                1 Reply Last reply Reply Quote 0
                • fractalengineerundefined
                  fractalengineer
                  last edited by

                  a8f73877-d0bc-4280-94b0-057c73b13c9b-image.png

                  I made this little sheet; according to my calculation 120mm/s makes RPM and 1200pps

                  That should still be well within the envelope of this stepper?

                  Even twice that much pobably

                  Railcore II ZL

                  1 Reply Last reply Reply Quote 0
                  • Phaedruxundefined
                    Phaedrux Moderator @fractalengineer
                    last edited by

                    @fractalengineer said in Duet 3 StealthChop 2 Tuning for Nema23:

                    Well again the steppers are running free; nothing connected to them

                    Have you tried connecting them to a load to see how they behave?

                    Z-Bot CoreXY Build | Thingiverse Profile

                    fractalengineerundefined 1 Reply Last reply Reply Quote 0
                    • fractalengineerundefined
                      fractalengineer @Phaedrux
                      last edited by

                      Hi @Phaedrux , yes mounting them was the first thing I did upon reception; when the problem occured I removed the belts to insulate the gantry binding possibility and kept testing this way to prevent crashing it due to the stalls

                      Railcore II ZL

                      1 Reply Last reply Reply Quote 1
                      • fractalengineerundefined
                        fractalengineer @dc42
                        last edited by

                        @dc42 did you get any insights from the torque curve?

                        Is there any chance of getting these steppers to work or is it just that the Duet3 can't drive Nema23?

                        Railcore II ZL

                        1 Reply Last reply Reply Quote 0
                        • evan38109undefined
                          evan38109
                          last edited by evan38109

                          I've been able to get some nice, big Moons MS23HA8L4360 NEMA23 steppers working well this weekend. I've tested them up to 400mm/sec with acceleration at 4000mm/sec², and suspect they could go higher if I drop microstepping down to x16.

                          Config looks like:

                          ; Drives
                          M569 P0.1 S1 D3                              ; Y / Front    0.1 goes forwards   0.9° Moons MS23HA8L4360*
                          M569 P0.2 S0 D3                              ; X / Rear     0.2 goes backwards  0.9° Moons MS23HA8L4360*
                          ...
                          M350 X32 Y32 Z32 E32 I1                      ; configure microstepping with interpolation
                          
                          ; Steps on X & Y
                          ;   = steps per rotation / (pulley teeth * belt spacing) * microstep multiplier
                          ;     0.9° degree stepper has 400 steps per rotation, 1.8° stepper has 200
                          M92 X{400 / (18 * 2) * 32} Y{400 / (18 * 2) * 32} Z6400.00 E1674.00  ; set steps per mm
                          
                          ; Motor current
                          ;   = Max stepper rating in milliamps * 0.8
                          ;     Adjust multiplier as desired. Lower is quieter, while higher means more torque, noise, and heat.
                          ;     ...but never over 1.0! (and even over 0.8 may lead to excess heat)
                          M906 X{3600 * 0.8} Y{3600 * 0.8} Z{2000 * 0.8} E1100 I30           ; set motor currents (mA) and motor idle factor in per cent
                          M84 S30                                                            ; Set idle timeout
                          
                          ; Speeds
                          M203 X24000.00 Y24000.00 Z480.00 E3600.00    ; set maximum speeds (mm/min)
                          M201 X4000.00  Y4000.00  Z80.00  E1500.00    ; set accelerations (mm/s^2)
                          
                          ; Jerk and accelerations
                          ; M566 X500.00   Y500.00   Z20.00  E1500.00    ; set maximum jerk (instantaneous speed changes) (mm/min)
                          M566 X300.00   Y300.00   Z20.00  E1500.00   ; set maximum jerk (instantaneous speed changes) (mm/min)
                          M204 1000 T2000                              ; use 1000mm/s² acceleration for print moves and 2000mm/s² for travel moves
                          
                          ; Trinamic Drive Tuning
                          ; Tune tpwmthrs (V) so stealthchop runs at appropriate speeds
                          ; and tune thigh (H) to avoid shifting into fullstep mode
                          M569 P0.1 V40   H5                                    ; X            - Set tpwmthrs so StealthChop runs up to 105.5mm/sec
                          M569 P0.2 V40   H5                                    ; Y            - Set tpwmthrs so StealthChop runs up to 105.5mm/sec
                          ...
                          M915 X Y T20000                                       ; Set CoolStep threshold super low
                          

                          One thing I've noticed is that using M915 T... with low values to disable CoolStep leads to some nasty, loud noises. I suspect the current reduction that CoolStep does is beneficial in reducing back EMF.

                          1 Reply Last reply Reply Quote 1
                          • fractalengineerundefined
                            fractalengineer
                            last edited by

                            @evan38109 Yo Evan

                            Thanks a lot for this; very clever config file.

                            Looks like increasing Coolstep did help with speeds; I can go up to about 300mm/s before it stalls,

                            However Stealthchop doesn't seem to be running at any speed; it's all SpreadCycle now

                            Railcore II ZL

                            dc42undefined 1 Reply Last reply Reply Quote 0
                            • fractalengineerundefined
                              fractalengineer
                              last edited by

                              Okay looks like lowering the M915 T value to the 50s reenables Stealthchop

                              Now the Stealthchop seizure speed is up to just below 100mm/s

                              I'm still confused as to how to setup the switch from StealthC to SpredC; looks like it's always choppy and noisy around the transition speed

                              Railcore II ZL

                              T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
                              • T3P3Tonyundefined
                                T3P3Tony administrators @fractalengineer
                                last edited by

                                @fractalengineer said in Duet 3 StealthChop 2 Tuning for Nema23:

                                StealthC to SpredC; looks like it's always choppy and noisy around the transition speed

                                the datasheet mentions that the transition between the two should be set to a speed that manages the Jerk caused by phase shift. Higher speed transition = more noticeable transition.

                                https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5160A_Datasheet_Rev1.14.pdf

                                see page 65

                                www.duet3d.com

                                fractalengineerundefined 1 Reply Last reply Reply Quote 0
                                • fractalengineerundefined
                                  fractalengineer @T3P3Tony
                                  last edited by

                                  @T3P3Tony Hi Tony,

                                  Yep I do remember reading that in the datasheet and I can reproduce this specific "caklonk" jerk when switching from M569 D3 to D2 or by changing M915 T value

                                  What I'm referring to is more of a crackling sound around the transition speed

                                  Here's how it runs currently; fastest speed is only 240mm/s

                                  https://youtu.be/JcHISSwKVD8

                                  Railcore II ZL

                                  1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators @fractalengineer
                                    last edited by

                                    @fractalengineer said in Duet 3 StealthChop 2 Tuning for Nema23:

                                    Looks like increasing Coolstep did help with speeds; I can go up to about 300mm/s before it stalls,
                                    However Stealthchop doesn't seem to be running at any speed; it's all SpreadCycle now

                                    Coolstep and spreadCycle are not compatible. In some ways, coolStep is a more primitive version of stealthChop.

                                    It sounds to me that the motor back EMF may still be too high for the supply voltage you are using. This can be a problem when using 0.9deg motors.

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    fractalengineerundefined 1 Reply Last reply Reply Quote 0
                                    • fractalengineerundefined
                                      fractalengineer @dc42
                                      last edited by

                                      @dc42 But the EMF calculator says back EMF is green (17.6V out of the near 30V supplied) and these steppers can still go at least twice faster than the speed they are currently running...

                                      Would plugging capacitors in parallel to VIN help with absorbing some of that back EMF?

                                      Railcore II ZL

                                      1 Reply Last reply Reply Quote 0
                                      • evan38109undefined
                                        evan38109
                                        last edited by

                                        For posterity --

                                        I was misunderstanding how CoolStep interacted with the other modes. Thank you for clarifying.

                                        I've now gotten in the habit of just effectively disabling CoolStep with M915 X Y Z E T1. I've not been able to find any situations on either of my printers where CoolStep works materially better than SpreadCycle. (That's not to say they don't exist, I just haven't found them!)

                                        1 Reply Last reply Reply Quote 1
                                        • SputnikOC3dundefined
                                          SputnikOC3d
                                          last edited by

                                          I was pointed to this thread from another by DC42 - where it indicated the OP solved an issue by making some changes. I see a lot of hchanges et al ... but it caps out at 42 posts and I dont see the OP indicating a resolution ?

                                          Almost all these StealthChop to Spreadcycle motor banging threads - Have No Resolution defined in the threads ... Troublesome.

                                          Is there a resolution?

                                          ibashundefined 1 Reply Last reply Reply Quote 0
                                          • ibashundefined
                                            ibash @SputnikOC3d
                                            last edited by

                                            So for folks trying to understand how tpwmthrs is calculated, and especially how to convert it to mm/s...

                                            1. 12,000,000 / (256 * tpwmthrs) = steps / second
                                            2. You need steps per mm from M92... be careful with units...
                                            3. Then multiply mm/step * step/second

                                            Using evan38109's config as an example:

                                            M350 X32 Y32 Z32 E32 I1                      ; configure microstepping with interpolation
                                            M92 X{400 / (18 * 2) * 32} Y{400 / (18 * 2) * 32} Z6400.00 E1674.00  ; set steps per mm
                                            

                                            They're using 32 microstep units, and M92 gives microsteps per mm.

                                            1. 400 / (18 * 2) * 32 = 355.55 microsteps / mm
                                            2. 355.55 / 32 = 11.11 steps / mm

                                            So for 40 tpwmthrs...

                                            (1 mm / 11.11 steps) * (12,000,000 / (256 * 40)) = 105.5mm/s


                                            1. The 12,000,000 comes from the clock frequency, tpwmthrs is in units of clock period
                                            2. Check out the datasheet: https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2160A-datasheet_Rev1.06.pdf
                                            1 Reply Last reply Reply Quote 1
                                            • fractalengineerundefined fractalengineer referenced this topic
                                            • NeoDueundefined NeoDue referenced this topic
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA