(solved) G28 Error: Bad command



  • I am getting G28 Error: Bad command: ''' Now home Z using the Z probe''' everytime I home my printer, Also if I try home Z axis only I get this below. I am using a mini differential ir height sensor.

    G28 Z

    Error: Bad command: ''' Home Z using the Z probe mounted on the X carriage'''
    Error: G0/G1: insufficient axes homed

    ; Configuration file for Duet WiFi (firmware version 1.21)
    ; executed by the firmware on start-up
    ;
    ; generated by RepRapFirmware Configuration Tool v2 on Mon Dec 10 2018 01:47:39 GMT+0000 (GMT)

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

    ; Network
    M550 P"iDEX" ; Set machine name
    M552 S1 ; Enable network
    M587 S"xx" P"xx" ; 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 S0 ; Drive 0 goes reverse
    M569 P1 S0 ; Drive 1 goes reverse
    M569 P2 S1 ; Drive 2 goes forwards
    M569 P3 S0 ; Drive 3 goes reverse
    M569 P4 S1 ; Drive 4 goes reverse
    M569 P5 S0 ; Drive 5 goes reverse

    M584 X0 Y1 Z2 U3 E4:5 ; Drive map X Y Z U E axis

    M350 X16 Y16 Z16 U16 E16:16 I1 ; Configure microstepping with interpolation
    M92 X160 Y160 Z1600 U160 E512.96:512.96 ; Set steps per mm
    M566 X600 Y600 Z12 U600 E120:120 ; Set maximum instantaneous speed changes (mm/min)
    M203 X18000 Y18000 Z180 U18000 E1500:1500 ; Set maximum speeds (mm/min)
    M201 X3000 Y3000 Z100 U3000 E10000:10000 ; Set accelerations (mm/s^2)
    M906 X950 Y1300 Z1300 U950 E1200:1200 I30 ; Set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Axis Limits
    M208 X375 Y390 U422 Z320 S0 ; Set axis maxima
    M208 X-60 Y10 U0 Z0 S1 ; Set axis minima

    ; Endstops
    M574 X1 Y1 Z0 U2 S0 ; Set active low endstops

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

    ; Z-Probe
    M574 Z0 S2 ; Set endstops controlled by probe
    M558 P1 H5 F120 T6000 ; Set Z probe type to unmodulated and the dive height + speeds
    G31 P500 X0 Y0 Z1.258 ; Set Z probe trigger value, offset and trigger height
    M557 X30:375 Y50:390 S82 ; Define mesh grid

    ; Heaters
    M307 H0 B0 S1.00 ; Disable bang-bang mode for the bed heater and set PWM limit
    M305 P0 T100000 B4138 R4700 ; Set thermistor + ADC parameters for heater 0
    M143 H0 S120 ; Set temperature limit for heater 0 to 120C
    M305 P1 T100000 B4138 R4700 ; Set thermistor + ADC parameters for heater 1
    M143 H1 S280 ; Set temperature limit for heater 1 to 280C
    M305 P2 T100000 B4138 R4700 ; Set thermistor + ADC parameters for heater 2
    M143 H2 S280 ; Set temperature limit for heater 2 to 280C

    ; Fans
    M106 P0 S0 I0 F500 H1 T45 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned on
    M106 P1 S1 I0 F500 H2 T45 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on
    M106 P2 S1 I0 F500 H2 T45 ; Set fan 2 value, PWM signal inversion and frequency. Thermostatic control is turned on

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

    M563 P1 D1 H2 X3 ; Define tool 1
    G10 P1 X0 Y0 U0 Z0 ; Set tool 1 axis offsets
    G10 P1 R0 S0 ; Set initial tool 1 active and standby temperatures to 0C

    M563 P2 D0:1 H1:2 X0:3 ; Define tool 2 Ditto Printing
    G10 P2 X100 Y0 U-100 Z0 ; Set tool 2 axis Ditto Printing offsets
    G10 P2 R0 S0 ; Set initial tool 2 active and standby temperatures to 0C
    M567 P2 E1:1 ; Set mix rtio 100% on both extruders

    ; Automatic power saving
    M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; Set voltage thresholds and actions to run on power loss

    ; Custom settings are not configured

    ; 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

    ; homex.g
    ; called to home the X axis
    ;
    ; 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 F3600 ; move quickly to X axis endstop and stop there (first pass)
    G1 X5 F6000 ; go back a few mm
    G1 S1 X-10 F360 ; move slowly to X axis endstop once more (second pass)
    G1 Z-5 F6000 S2 ; lower Z again
    G90 ; absolute positioning

    ; homeu.g
    ; called to home the U axis
    ;
    ; 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 U422 F3600 ; move quickly to U axis endstop and stop there (first pass)
    G1 U-5 F6000 ; go back a few mm
    G1 S1 U10 F360 ; move slowly to U axis endstop once more (second pass)
    G1 Z-5 F6000 S2 ; lower Z again
    G90 ; absolute positioning

    ; homey.g
    ; called to home the Y axis
    ;
    ; 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 Y-390 F2000 ; move quickly to Y axis endstop and stop there (first pass)
    G1 Y5 F6000 ; go back a few mm
    G1 S1 Y-10 F360 ; move slowly to Y axis endstop once more (second pass)
    G1 Z-5 F6000 S2 ; lower Z again
    G90 ; absolute positioning

    ''' 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

    Solve See in the end of this .



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

    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

    Fix the "Now home Z using the Z probe" line with a ; at the beginning of the line

    Same in the other homing files. The firmware doesn't know what a quoted text line is.



  • Hey Stephen Thanks, That fix the first error.

    If I move Z axis down 5mm or 10mm and then try home Z axis only, I get this below. I am using a mini differential IR height sensor. I can home X Y U fine. But Z axis only home when I home all axis. Don't know if this is how it suppose works.

    G28 Z

    Error: Bad command: ''' Home Z using the Z probe mounted on the X carriage'''
    Error: G0/G1: insufficient axes homed



  • You need to add S2 to moves of axis that haven't been homed yet. In your case it might just be easier to always home x and y first.



  • Ok, After I home X Y U & Z axis, Everything looks ok, no errors in log, But if I move Z axis down say 10mm and try homing Z axis I get this G28 Z , Error: G0/G1: insufficient axes homed . I am just trying to make sure that Z axis is ok.



  • 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?



  • @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.



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



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



  • @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?



  • ; 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



  • 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
    


  • @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



  • 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.



  • @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



  • Thank you. This was driving me nuts.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.