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

    CNC G28 with High End stop

    Scheduled Pinned Locked Moved
    General Discussion
    4
    11
    701
    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.
    • gwilson152undefined
      gwilson152
      last edited by

      I know I'm probably missing something simple here. I have a new CNC build which is going great, and I love the Duet WiFi. It's y second one, and is really amazing.

      So, the issue... this is my first CNC build. I downloaded the github Duet CNC post processor for Fusion 360. In my first tests, I had my z axis end stop at the low end, but there are some physical limitations that I was running into with placing the end stop. In addition, my first tests resulted in collision with the stock, as it would run G28, not lift the cutter, and then move to the first position.

      So, as I was making the brackets today for my z axis today, I decided to locate it at the high end. I changed everything accordingly, and homing works great. But now, when I run the job, it runs G28 and sets the end stop at the high end to zero, then proceeding to collide with the end stop when the job moves forward.

      I'm sure I am not understanding either the post processing, how I should be configuring the machine, or something else.

      Note: as I am manually controlling the spindle at the moment, I have not put the duet into "CNC Mode". Is this required for some reason?

      Thank you sincerely,
      Grant

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

        @gwilson152 said in CNC G28 with High End stop:

        I changed everything accordingly

        Perhaps not?

        Did you change the endstop configuration in config.g?
        How did you change your homing files?

        Z-Bot CoreXY Build | Thingiverse Profile

        1 Reply Last reply Reply Quote 0
        • A Former User?
          A Former User
          last edited by

          show us your endstop config at least the M574 part.

          Should have Z2 instead of Z1 i think, or maybe you're missing Z completely due an issue with the web config tool?

          1 Reply Last reply Reply Quote 0
          • gwilson152undefined
            gwilson152
            last edited by

            I feel like an idiot. I DID find the issue. Super simple. I have never asked for forum help up to this point in my life, and I chose this issue. Such is life.

            The problem was in the homing configuration. I was relying on the configurator too much. I did not consider that G28 was running the homeall script. I only updated the homez script. After hitting the end stop, it was setting Z0 in the homing scripts, so I fixed that in the G92 command.

            I could have solved the issue with the end stop being at the low end by adding a subsequent command to lift the cutter in the homing files. Obviously. What a doofus.

            I got that fixed, but then decided it would be really nice to have a prompt to manually zero the bit after it found the end stop, as my surface height may change a lot. I did the following in the script:

            ; homeall.g
            ; called to home all axes
            ;
            ; generated by RepRapFirmware Configuration Tool v2 on Sat Apr 06 2019 08:38:03 GMT-0600 (Mountain Daylight Time)
            G91 ; relative positioning
            G1 Z50 F6000 S2 ; lift Z relative to current position
            G1 S1 X-645 Y-920 F1800 ; move quickly to X and Y axis endstops and stop there (first pass)
            G1 X5 Y5 F6000 ; go back a few mm
            G1 S1 X-645 Y-920 F360 ; move slowly to X and Y axis endstops once more (second pass)
            G1 S1 Z190 F1800 ; move Z up stopping at the endstop
            G90 ; absolute positioning
            G92 Z175 ; set Z to axis minimum (you may want to adjust this)
            G91 ; relative positioning
            G1 Z-50 F1800 ; move Z Down 50

            M291 P"Set Manual Z Height" S2 X1 Y1 Z1
            G92 Z0
            G90
            M292 P0

            This all works wonderfully when manually selecting "Home All", but when G28 is called from a job, it gives me the prompt and does not allow me to manually move the axis while the job is waiting for the homing to complete. If I just click okay, the job is stuck in a paused state that requires me to reboot in order to regain control. If I could nail this part down, it would resolve any issues I am having heretofore.

            One thought I have had is that maybe there is a command to set an offset in the same manner instead of setting Z0 manually.

            Thanks again for your help!

            dc42undefined 1 Reply Last reply Reply Quote 0
            • gwilson152undefined
              gwilson152
              last edited by

              In case it is helpful, here is my config.g

              ; Configuration file for Duet WiFi (firmware version 1.21)
              ; executed by the firmware on start-up
              ;
              ; generated by RepRapFirmware Configuration Tool v2 on Sat Apr 06 2019 08:38:03 GMT-0600 (Mountain Daylight Time)

              ; General preferences
              G90 ; Send absolute coordinates...
              M83 ; ...but relative extruder moves

              ; Network
              M550 P"ThinkBox CNC" ; Set machine name
              M551 P"" ; Set password
              M552 S1 ; Enable network
              M587 S"DRIVE Upstairs 2.4GHz" P"" ; Configure access point. You can delete this line once connected
              M586 P0 S1 ; Enable HTTP
              M586 P1 S0 ; Disable FTP
              M586 P2 S0 ; Disable Telnet

              ; Drives
              M569 P0 S1 ; Drive 0 goes forwards
              M569 P1 S1 ; Drive 1 goes forwards
              M569 P2 S0 ; Drive 2 goes backwards
              M584 X0 Y3:4 Z2
              M350 X16 Y16 Z16 I1 ; Configure microstepping with interpolation
              M92 X640.00 Y640.00 Z640.00 ; Set steps per mm
              M566 X900.00 Y900.00 Z900.00 ; Set maximum instantaneous speed changes (mm/min)
              M203 X1800.00 Y1800.00 Z1800.00 ; Set maximum speeds (mm/min)
              M201 X500.00 Y500.00 Z500.00 ; Set accelerations (mm/s^2)
              M906 X2400.00 Y2400.00 Z2400.00 I50 ; Set motor currents (mA) and motor idle factor in per cent
              M84 S30 ; Set idle timeout

              ; Axis Limits
              M208 X0 Y0 Z0 S1 ; Set axis minima
              M208 X640 Y915 Z185 S0 ; Set axis maxima

              ; Endstops
              M574 X1 Y1 Z2 S0 ; Set active low and disabled endstops

              ; Z-Probe
              M558 P0 H50 F120 T6000 ; Disable Z probe but set dive height, probe speed and travel speed
              M557 X15:600 Y15:800 S20 ; Define mesh grid

              ; Heaters
              M140 H-1 ; Disable heated bed

              ; Fans

              ; Tools
              M563 P0 D H ; Define tool 0
              G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
              G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C

              ; Automatic saving after power loss is not enabled

              ; Custom settings

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

                @gwilson152 said in CNC G28 with High End stop:

                M291 P"Set Manual Z Height" S2 X1 Y1 Z1
                G92 Z0
                G90
                M292 P0
                This all works wonderfully when manually selecting "Home All", but when G28 is called from a job, it gives me the prompt and does not allow me to manually move the axis while the job is waiting for the homing to complete. If I just click okay, the job is stuck in a paused state that requires me to reboot in order to regain control. If I could nail this part down, it would resolve any issues I am having heretofore.

                I think can see why that is happening. I will fix it in the next firmware release. Meanwhile, the following might work around it (I haven't tested it). Move all the code in homeall.g that does movement prior to the M291 command into a separate macro file in /sys. In homeall.g, call that file using M98, then do the M291 and subsequent commands.

                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

                1 Reply Last reply Reply Quote 0
                • gwilson152undefined
                  gwilson152
                  last edited by

                  I appreciate the incredibly quick responses. I will do that and report back in case it may help others. I have more projects to execute in the future and will be an avid supporter of Duet. I love your hardware.

                  1 Reply Last reply Reply Quote 0
                  • gwilson152undefined
                    gwilson152
                    last edited by gwilson152

                    I gave it a shot, and that didn't affect the behavior. This is what I did...

                    I moved all of the homing commands into homeall-init.g, and changed my homeall.g to this:

                    M98 P"homeall-init.g"
                    M291 P"Set Z Height" S2 X1 Y1 Z1
                    G92 Z0
                    M292 P0

                    I am still unable to move any axis with this config. I also tried dumping the M291, G92, and M292 commands in homez-manual.g and only using homeall.g as follows:

                    M98 P"homeall-init.g"
                    M98 P"homez-manual.g"

                    That also did not work. So, as a matter of testing, I changed homez-manual.g to:

                    ;M291 P"Set Z Height" S2 X1 Y1 Z1
                    ;G92 Z0
                    ;M292 P0

                    M291 P"TESTING" S2
                    M292 P0

                    When I click okay in this case, the job does continue as expected. It is only when I call the jog controls in the script that it gets stuck where I cannot move the motors, or even cancel the job.

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

                      Thanks for trying. I've looked a little further, and I can see why that workaround doesn't work. In brief, the G28 command locks the movement system. The owner of the lock is the channel that executed G28 - which in this case is the SD card. When you try to jog the axes, the source of the jog command (usually DWC or PanelDue) needs to lock the movement system, but can't because it is already owned by the SD card channel. I need to change the firmware to release the lock when M291 is used.

                      The only way I can see around it until I make that change is to put the M291 and related commands in a separate macro, and call it after the G28 command instead of from within homeall.g.

                      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

                      1 Reply Last reply Reply Quote 0
                      • gwilson152undefined
                        gwilson152
                        last edited by

                        Thank you for your excellent explanation, and for being so proactive in improving the Duet. I see why it has become such a great platform! For those who might be interested in the workaround for this until the firmware is released, I added a "useG28Post" definition to the Fusion 360 post processor in the tool change operation definition by doing this...

                        Under user-defined properties, added:

                        properties = {
                          ...
                          useG28Post: true,
                          ...
                        }
                        

                        Under propertyDefinitions added:

                        useG28Post: {title:"G28Post Manual Z", description:"Calls M291 Manual Tool Height Calibration", type:"boolean"},
                        

                        and I changed:

                        if(properties.homeOnToolChange){
                        	writeBlock(gFormat.format(28));         
                        }
                        

                        to:

                        if(properties.homeOnToolChange){
                        	writeBlock(gFormat.format(28));
                            if (properties.useG28Post){
                                        writeBlock('M98 P"g28post.g"');        }
                        }
                        

                        Then create your g28post.g macro in the /sys/ directory.

                        Until dc42 is able to update the firmware, this should allow you to overcome this limitation and do a manual home any time G28 is called, as well as enable/disable in the post process options of Fusion. Hope this will help somebody.

                        Thanks again!
                        -Grant

                        1 Reply Last reply Reply Quote 0
                        • gwilson152undefined
                          gwilson152
                          last edited by

                          Well, it looks like I'll have to wait for the firmware update. I posted the last reply too soon, and should have run the test first. The changes to Fusion's post worked fine, and the beginning of the output is as follows:

                          ;1001
                          ;T1 D=6.35 CR=0 - ZMIN=0.501 - FLAT END MILL
                          G90
                          G21

                          ;ADAPTIVE1
                          M5
                          M291 P"Insert Tool 1, D=6.35" R"Tool Change" S2
                          T1
                          G28
                          M98 P"g28post.g"
                          M3 S10000
                          G54

                          Same problem. I also changed it to put the M291 command directly in the GCode file instead of calling a macro. Same problem. Bummer!

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