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

    (solved) G28 Error: Bad command

    Scheduled Pinned Locked Moved
    General Discussion
    4
    16
    2.2k
    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.
    • Phaedruxundefined
      Phaedrux Moderator
      last edited by

      If you compare the example homing files here: https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCartesianPrinter#Section_Homing_files to what you have you'll see what I mean about missing S2 from your G1 moves that try to move an axis before it's been homed.

      Also take care with G90 and G91 to ensure you're in the right coordinate mode for the moves you want to be doing. Do you want to go to Z5, or just move the bed by 5mm?

      Z-Bot CoreXY Build | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • deckingmanundefined
        deckingman @Karim
        last edited by

        @karim Are you saying that if you home all, everything works fine but if you just want to home Z you get the error? It's a long time since I checked but it always used to be the case that you have to home X and Y before you can home Z, which makes sense if you use a probe.

        Ian
        https://somei3deas.wordpress.com/
        https://www.youtube.com/@deckingman

        1 Reply Last reply Reply Quote 0
        • Stephen6309undefined
          Stephen6309 @Karim
          last edited by

          @karim They way I fixed my homing files: In each added S2 to all movements that didn't involve the endstops, the S1 lines.

          1 Reply Last reply Reply Quote 0
          • Karimundefined
            Karim
            last edited by

            Here a video explaining what I am trying to say. This might be ok,
            https://youtu.be/BKMrRjuZcC8

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

              @karim So the homeall button turns red when you hit home z to indicate that the machine is no longer fully homed. If the home z were able to complete successfully, the homeall button would turn back to homed state.

              Can you post the contents of homez.g as it is now?

              Z-Bot CoreXY Build | Thingiverse Profile

              1 Reply Last reply Reply Quote 0
              • Karimundefined
                Karim
                last edited by

                ; Home Z using the Z probe mounted on the X carriage'''
                G91
                G1 Z4 F200 ; raise head 4mm to keep it clear of the bed
                G1 U429 F2000 ; make sure the U carriage is out of the way
                G90
                G1 X245 Y200 F2000 S2 ; move to bed centre for probing
                G30 ; probe the bed and set Z height

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

                  And if you change it to this, what happens?

                  G91
                  G1 Z4 F200 S2 ; raise head 4mm to keep it clear of the bed
                  G1 U429 F2000 S2 ; make sure the U carriage is out of the way
                  G90
                  G1 X245 Y200 F2000 S2 ; move to bed centre for probing
                  G30 ; probe the bed and set Z height
                  

                  Z-Bot CoreXY Build | Thingiverse Profile

                  1 Reply Last reply Reply Quote 0
                  • Karimundefined
                    Karim
                    last edited by

                    @phaedrux said in G28 Error: Bad command: ''' Now home Z using the Z probe''':

                    G1 U429 F2000 S2 ; make sure the U carriage is out of the way

                    G1 U429 F2000 S2 ; make sure the U carriage is out of the way
                    S2 Make the U Axis goes into the endstop. Replace S2 to S1 fix that.

                    Now Z axis works but something wired now, look at the video when homing Z axis, X axis move about 20mm then Z home.

                    https://youtu.be/Her4tOeW25w

                    ;Home Z
                    G91
                    G1 Z4 F200 S2 ; raise head 4mm to keep it clear of the bed
                    G1 U422 F2000 S1 ; make sure the U carriage is out of the way
                    G90
                    G1 X245 Y200 F2000 S2 ; move to bed centre for probing
                    G30 ; probe the bed and set Z height

                    ; homeall.g
                    ; called to home all axes
                    ;
                    ; generated by RepRapFirmware Configuration Tool v2 on Sat Dec 01 2018 16:55:23 GMT-0800 (Pacific Standard Time)
                    G91 ; relative positioning
                    G1 Z5 F6000 S2 ; lift Z relative to current position
                    G1 S1 X-435 Y-400 U422 F3000 ; 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-10 Y-10 U10 F360 ; move slowly to X and Y axis endstops once more (second pass)

                    ;Now home Z using the Z probe'''
                    G1 X245 Y200 F2000 S2 ; move to bed centre for probing
                    G30 ; probe the bed and set Z height

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

                      As I said before, you need to pay attention to G90 and G91

                      G90 moves to the absolute position on the bed
                      G91 moves the amount relative to the current location

                      So for your home all it looks like you're still in relative positioning when you should be in absolute positioning to place the print head for probing Z

                      ; homeall.g
                      ; called to home all axes
                      ;
                      ; generated by RepRapFirmware Configuration Tool v2 on Sat Dec 01 2018 16:55:23 GMT-0800 (Pacific Standard Time)
                      G91 ; relative positioning
                      G1 Z5 F6000 S2 ; lift Z relative to current position
                      G1 S1 X-435 Y-400 U422 F3000 ; 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-10 Y-10 U10 F360 ; move slowly to X and Y axis endstops once more (second pass)
                      
                      G90 ; absolute positioning
                      ;Now home Z using the Z probe'''
                      G1 X245 Y200 F2000 S2 ; move to bed centre for probing
                      G30 ; probe the bed and set Z height
                      

                      That should get your print head into the same location for both homeall and homez. Now that may not be the position you expect it to be in, but you can modify that by just changing the coordinates for both.

                      I suspect that your X endstop position is actually a bit off the side of the bed.

                      Z-Bot CoreXY Build | Thingiverse Profile

                      1 Reply Last reply Reply Quote 0
                      • Karimundefined
                        Karim
                        last edited by

                        @karim said in G28 Error: Bad command: ''' Now home Z using the Z probe''':

                        ;Home Z
                        G91
                        G1 Z4 F200 S2 ; raise head 4mm to keep it clear of the bed
                        G1 U422 F2000 S1 ; make sure the U carriage is out of the way
                        G90
                        G1 X245 Y200 F2000 S2 ; move to bed centre for probing
                        G30 ; probe the bed and set Z height

                        I think I got now. Machine Status shows X185 Y210
                        ;Home Z
                        G91
                        G1 Z4 F200 S2 ; raise head 4mm to keep it clear of the bed
                        G1 U422 F2000 S1 ; make sure the U carriage is out of the way
                        G90
                        G1 X185 Y210 F2000 S2 ; move to bed centre for probing
                        G30 ; probe the bed and set Z height

                        1 Reply Last reply Reply Quote 0
                        • Karimundefined
                          Karim
                          last edited by

                          Thank you. This was driving me nuts.

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