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

    Duet3D 1HCL - Closed Loop Controller Beta test

    Scheduled Pinned Locked Moved
    Hardware dev
    20
    209
    18.9k
    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.
    • supertb1undefined
      supertb1 @lirwin17
      last edited by

      @lirwin17
      since the change on the M569.1 line to P50.0 T2 C5 E5:10
      I am now getting closed loop enabled : yes
      on P50 V8 it is saying that the drive has an incorrect polarity
      V32 made the drive run off to the end of it's travel
      M569.6 P50.0 V64
      Warning: No new tuning errors have been found, but some existing tuning errors exist. The drive has not been zeroed. The drive has not had it's polarity checked. The drive has not had it's control checked. The encoder has not had it's count per revolution and V128 is the same result

      1 Reply Last reply Reply Quote 0
      • supertb1undefined
        supertb1 @T3P3Tony
        last edited by

        @t3p3tony said in Duet3D 1HCL - Closed Loop Controller Beta test:

        M569.6 P50.0 V31

        M569.6 P50.0 V31
        Warning: M569.6: One or more tuning errors occurred. The drive has been found to have an incorrect polarity.

        1 Reply Last reply Reply Quote 0
        • supertb1undefined
          supertb1 @T3P3Tony
          last edited by

          @t3p3tony does this mean that I need to switch the positive and negative wires?

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

            @supertb1 try the following:

            M569 P50.0 D4 S0

            Sorry that was wrong. I forgot you have the motor moving the correct way in open loop mode.

            @lirwin17 is the polarity error an encoder polarity? in which case switching A and B phases of the encoder would be right?

            www.duet3d.com

            1 Reply Last reply Reply Quote 0
            • lirwin17undefined
              lirwin17
              last edited by

              @supertb1

              does this mean that I need to switch the positive and negative wires?

              Sorry, this error message is a bit misleading - I'll change that. The polarity should be detected automatically, so a better error message may be "encoder polarity failed to be detected"

              Please could you follow the same instructions I gave to maxgyver above (here), although on the 'movement' checkboxes down the right hand side, please could you check 'polarity detection'

              We should then be able to take a look at the graph and see what's going on 🙂

              supertb1undefined 4 Replies Last reply Reply Quote 0
              • supertb1undefined
                supertb1 @lirwin17
                last edited by

                @lirwin17 50_2021-09-21_15.04.43.csv

                lirwin17undefined 1 Reply Last reply Reply Quote 0
                • supertb1undefined
                  supertb1 @lirwin17
                  last edited by

                  @lirwin17 is there another report with different variables I need to run for more information?

                  1 Reply Last reply Reply Quote 0
                  • supertb1undefined
                    supertb1 @lirwin17
                    last edited by

                    @lirwin17 50_2021-09-21_15.57.09.csv

                    1 Reply Last reply Reply Quote 0
                    • supertb1undefined
                      supertb1 @lirwin17
                      last edited by

                      @lirwin17 I'm not sure how to read these... it looks like coil A is out of step phase and coil B doesn't appear to be doing anything... target motor steps says there are 4 errors

                      1 Reply Last reply Reply Quote 0
                      • lirwin17undefined
                        lirwin17 @supertb1
                        last edited by lirwin17

                        @supertb1

                        is there another report with different variables I need to run for more information?

                        No, this is great 👍

                        I'm not sure how to read these...

                        There's docs coming soon, but for now I'll talk you through it

                        The first thing to say is that the raw encoder reading is 0 on both recordings - this means it doesn't seem to register the encoder as moving at all.
                        This is strange because I thought that you did M122 twice after manually turning a full rotation and the encoder's reading changed... Please could you confirm this is still the case
                        (See this post for more detailed information)
                        95f3e05a-299f-478b-85c8-b2217e7fea0a-image.png

                        supertb1undefined 3 Replies Last reply Reply Quote 0
                        • lirwin17undefined
                          lirwin17 @MaxGyver
                          last edited by

                          @maxgyver thank you for the update! Don't worry, I've not forgotten about increasing the max speed - it's actually next on my list!

                          was able to increase my acceleration and jerk significantly

                          Excellent that's what we like to hear 🎉

                          I have two motors on my Y axis. They are both wired to one 1HCL board, but only one has an encoder. It calibrates fine, and I did not spot a significant problem during printing. Only the recorded graphs were of no use on this axis (at least for me). Maybe something to keep in mind for future development

                          Hmm okay 🤔 do you mean that both motors are wired into the single driver output on the 1HCL? What exactly were the issues you were having with the recorded graph?

                          Furthermore, I have the impression that the drivers run in full step without any microstepping as soon as I switch to closed loop. It sounds very much like my very first printer. 😁 The prints also show a strong stepping pattern.

                          This is an interesting one haha - so with closed loop, we kinda lose all sense of microstepping, since the motors no longer move in discrete steps, but move as close to continuously as possible. This means that in theory, the microstepping is infinite... but the keyword here is 'continuously as possible', in reality the motor has to move some discrete distance per PID iteration, and this is a function of the frequency of the PID loop (constant) and the speed of the move (variable). If you do a very slow move, I'd expect you to be getting very small discrete moves per PID cycle (the equivalent of very high mocrostepping), whereas if we're pushing the boundary on how fast we can move, you'll get very large discrete moves per PID cycle (up to a full step).
                          You can actually measure the size of these discrete steps by taking a recording (with speed set to 'as fast as possible') and looking at the step phase variable, and the vertical distance between datapoints. A distance of 90 degrees means 1 step, you could work out an 'effective microstepping' from this, since you know the increments in which the motor moves.

                          The good news is though, as we increase the maximum speed, the 'effective microstepping' will also increase as well, so hopefully you'll see less of the stepping pattern as we do so 🙂

                          1 Reply Last reply Reply Quote 1
                          • supertb1undefined
                            supertb1 @lirwin17
                            last edited by

                            @lirwin17 M122 B50
                            Diagnostics for board 50:
                            Duet EXP1HCL firmware version 3.4.0beta3+1 (2021-09-14 15:07:31)
                            Bootloader ID: SAME5x bootloader version 2.4beta (2021-07-23)
                            Never used RAM 51472, free system stack 2592 words
                            Tasks: Move(notifyWait,0.0%,160) HEAT(notifyWait,0.0%,95) CanAsync(notifyWait,0.0%,70) CanRecv(notifyWait,0.0%,81) CanClock(notifyWait,0.0%,72) TMC(notifyWait,38.1%,344) CLSend(notifyWait,0.0%,148) CLData(notifyWait,0.0%,142) MAIN(running,59.9%,408) IDLE(ready,0.0%,39) AIN(notifyWait,2.0%,265), total 100.0%
                            Last reset 00:01:25 ago, cause: power up
                            Last software reset time unknown, reason: HardFault bfarValid precise, available RAM 51580, slot 2
                            Software reset code 0x0060 HFSR 0x40000000 CFSR 0x00008200 ICSR 0x00430803 BFAR 0x20030008 SP 0x2001eba8 Task MAIN Freestk 531 ok
                            Stack: 00000000 00000000 00000002 20030000 00030f39 0001b8f9 0001ea4c 41000000 bf800000 00000000 533c0605 04001200 a8888700 06420000 c2010829 19a21029 50708239 5d000040 2a60041c 54540122 04801201 41200000 41c27924 4142a3fe 20000010 0002699b 00000002
                            Closed loop enabled: yes, live status: 0x4, encoder type rotaryQuadrature, pre-error threshold: 5.000000, error threshold: 10.000000, reverse polarity: no, tuning: 0, tuning error: 0x1f, position 0, raw count = 0, collecting data: no, ultimateGain=0.000000, oscillationPeriod=0.000000, Control loop runtime (ms): min=0.000000, max=0.066667, avg=0.008000, Control loop frequency (Hz): min=7075.472168, max=18292.683594, avg=15625.000977
                            Driver 0: pos 0, 106.5 steps/mm, standstill, reads 8610, writesMoves scheduled 0, completed 0, in progress 0, hiccups 0, step errors 0, maxPrep 0, maxOverdue 0, maxInc 0, mcErrs 0, gcmErrs 0
                            Peak sync jitter -4/3, peak Rx sync delay 179, resyncs 0/0, no step interrupt scheduled
                            VIN: 24.3V, V12: 12.2V
                            MCU temperature: min 23.1C, current 25.4C, max 25.4C
                            Ticks since heat task active 157, ADC conversions started 84048, completed 84047, timed out 0, errs 0
                            Last sensors broadcast 0x00000000 found 0 162 ticks ago, loop time 0
                            CAN messages queued 728, send timeouts 0, received 744, lost 0, free buffers 37, min 37, error reg 0
                            dup 0, oos 0/0/0/0, bm 0, wbm 0, rxMotionDelay 0

                            Disconnected the motor coils and turn the motor by hand one full revolution by hand:
                            M122 B50
                            Diagnostics for board 50:
                            Duet EXP1HCL firmware version 3.4.0beta3+1 (2021-09-14 15:07:31)
                            Bootloader ID: SAME5x bootloader version 2.4beta (2021-07-23)
                            Never used RAM 51472, free system stack 2580 words
                            Tasks: Move(notifyWait,0.0%,160) HEAT(notifyWait,0.0%,95) CanAsync(notifyWait,0.0%,70) CanRecv(notifyWait,0.0%,81) CanClock(notifyWait,0.0%,72) TMC(notifyWait,38.4%,344) CLSend(notifyWait,0.0%,148) CLData(notifyWait,0.0%,142) MAIN(running,59.6%,380) IDLE(ready,0.0%,39) AIN(notifyWait,2.0%,265), total 100.0%
                            Last reset 00:05:31 ago, cause: power up
                            Last software reset time unknown, reason: HardFault bfarValid precise, available RAM 51580, slot 2
                            Software reset code 0x0060 HFSR 0x40000000 CFSR 0x00008200 ICSR 0x00430803 BFAR 0x20030008 SP 0x2001eba8 Task MAIN Freestk 531 ok
                            Stack: 00000000 00000000 00000002 20030000 00030f39 0001b8f9 0001ea4c 41000000 bf800000 00000000 533c0605 04001200 a8888700 06420000 c2010829 19a21029 50708239 5d000040 2a60041c 54540122 04801201 41200000 41c27924 4142a3fe 20000010 0002699b 00000002
                            Closed loop enabled: yes, live status: 0x4, encoder type rotaryQuadrature, pre-error threshold: 5.000000, error threshold: 10.000000, reverse polarity: no, tuning: 0, tuning error: 0x1f, position 4055, raw count = 4055, collecting data: no, ultimateGain=0.000000, oscillationPeriod=0.000000, Control loop runtime (ms): min=0.006667, max=0.086667, avg=0.008000, Control loop frequency (Hz): min=6756.756836, max=16304.347656, avg=15625.000977
                            Driver 0: pos 0, 106.5 steps/mm, standstill, reads 0, wriMoves scheduled 0, completed 0, in progress 0, hiccups 0, step errors 0, maxPrep 0, maxOverdue 0, maxInc 0, mcErrs 0, gcmErrs 0
                            Peak sync jitter -3/4, peak Rx sync delay 183, resyncs 0/0, no step interrupt scheduled
                            VIN: 24.3V, V12: 12.2V
                            MCU temperature: min 23.1C, current 26.3C, max 26.5C
                            Ticks since heat task active 205, ADC conversions started 324949, completed 324948, timed out 0, errs 0
                            Last sensors broadcast 0x00000000 found 0 210 ticks ago, loop time 0
                            CAN messages queued 2005, send timeouts 0, received 2218, lost 0, free buffers 37, min 37, error reg 0
                            dup 0, oos 0/0/0/0, bm 0, wbm 0, rxMotionDelay 0

                            1 Reply Last reply Reply Quote 0
                            • supertb1undefined
                              supertb1 @lirwin17
                              last edited by

                              @lirwin17 it is reading the encoder... raw count 4055 from zero.. .and it is a 4000 count encoder

                              1 Reply Last reply Reply Quote 0
                              • supertb1undefined
                                supertb1 @lirwin17
                                last edited by

                                @lirwin17 what would be the next step to trouble shoot

                                lirwin17undefined 1 Reply Last reply Reply Quote 0
                                • lirwin17undefined
                                  lirwin17 @supertb1
                                  last edited by

                                  @supertb1 hmm okay so it looks like the encoder is working...

                                  Perhaps that reading of 0 is correct - is the motor actually moving at all during the recording?

                                  If it's not, please could you check that the motor works in open loop mode - i.e. boot up the board and then run M569 P50.0 D3, and try to home the motor, move it, etc

                                  If it doesn't work in open loop mode, it's most likely an issue with the wiring, you could try plugging the motor into your main board and check that it works in there

                                  supertb1undefined 4 Replies Last reply Reply Quote 0
                                  • supertb1undefined
                                    supertb1 @lirwin17
                                    last edited by

                                    @lirwin17 I disconnected the motor and ran it from a separate stepper drive I have built from an Arduino and a A4988.. The motor works fine in both directions outside the system, I then reconnected the motor to the drive on the 1HCL took it out of close loop mode and homed the axis, moved the motor around.. with the M569 p50.0 D3 it seams as though it cut my steps in half and is making the motor oscillate loudly, but it moves. With the closed loop off the motor also oscillates but it does move.50_2021-09-22_10.54.21.csv
                                    Not sure what has happened but I ran a step maneuver and the drive moved about 5mm and returned some interesting results... let me know what you think

                                    lirwin17undefined 1 Reply Last reply Reply Quote 0
                                    • supertb1undefined
                                      supertb1 @lirwin17
                                      last edited by

                                      @lirwin17 here is my current config
                                      G4 S3 ;wait for expansion boards to start
                                      M569.1 P50.0 T2 C5 E5:10 ; Configure the 1HCL board at CAN address 50 with a quadrature encoder on the motor shaft that has 20 steps per motor full step.
                                      M569.1 P51.0 S1 T2 C20 E20 R100 I0 D0 ; Configure the 1HCL board at CAN address 51 with a quadrature encoder on the motor shaft that has 20 steps per motor full step.
                                      M569 P50.0 D4 S1 ; Configure the motor on the 1HCL at can address 50 as being in closed-loop drive mode (D4), Open loop (D2) and not reversed (S1) X axis
                                      M569 P51.0 D2 S1 ; Configure the motor on the 1HCL at can address 51 as being in closed-loop drive mode (D4), Open loop (D2) and not reversed (S1) Y axis
                                      M569 P0.0 S1 ; physical drive 0.0 goes forwards Z 1-2 axis
                                      M569 P0.4 S1 ; physical drive 0.4 goes forwards Extruder
                                      M584 X50.0 Y51.0 Z0.0:0.1 E0.4 ; set drive mapping
                                      M671 X-122.25:689.20 Y0:0 S3.0 ; leadscrews at left (connected to Z0) and right (connected to Z1) of X axis
                                      M350 X32 Y32 Z32 E16 I1 ; configure microstepping with interpolation
                                      M92 X106.5 Y257 Z795.00 E339.00 ; set steps per mm
                                      M566 X900.00 Y900.00 Z60.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
                                      M203 X6000.00 Y6000.00 Z180.00 E1200.00 ; set maximum speeds (mm/min)
                                      M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2)
                                      M906 X1000 Y3000 Z3000 E800 I30 ; set motor currents (mA) and motor idle factor in per cent
                                      M84 S30 ; Set idle timeout
                                      M917 X0 Y0 ; Set the closed loop axes to have a holding current of zero

                                      1 Reply Last reply Reply Quote 0
                                      • supertb1undefined
                                        supertb1 @lirwin17
                                        last edited by

                                        @lirwin17 and my current home X

                                        supertb1undefined 1 Reply Last reply Reply Quote 0
                                        • supertb1undefined
                                          supertb1 @supertb1
                                          last edited by

                                          @supertb1 ; homex.g
                                          ; called to home the X axis
                                          ;
                                          ; generated by RepRapFirmware Configuration Tool v3.2.3 on Mon Mar 08 2021 08:53:31 GMT-0600 (Central Standard Time)
                                          M569 P50.0 D0 ; Turn off closed loop

                                          G91 ; relative positioning
                                          G1 H2 Z5 F6000 ; lift Z relative to current position
                                          G1 H1 X-240 F3000 ; move quickly to X axis endstop and stop there (first pass)
                                          G1 H2 X5 F6000 ; go back a few mm
                                          G1 H1 X-240 F240 ; move slowly to X axis endstop once more (second pass)

                                          G90 ; absolute positioning
                                          G1 X50 F3000 ; Move to a known-safe position
                                          M400 ; Wait for the move to complete
                                          G4 P500 ; Wait for the motor to settle
                                          M569 P50.0 D4 ; Turn closed loop back on
                                          M569.6 P50.0 V31 ; Perform the tuning manoeuvres for a quadrature encoder
                                          G1 X0 ; Move back to X0

                                          G1 H2 Z0 F6000 ; lower Z again

                                          1 Reply Last reply Reply Quote 0
                                          • supertb1undefined
                                            supertb1 @lirwin17
                                            last edited by

                                            @lirwin17 in closed loop I tried to do a homing move and it returned a: 9/22/2021, 11:03:30 AM G28 X
                                            Warning: One or more tuning errors occurred. The drive has been found to have an incorrect polarity.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA