Trying to figure out what is giving the Bad Command error



  • I keep getting a Bad Command error when I start a print sliced in Cura, I don't get the same when I slice with Prusa.
    Here is the first part of my G-code, hopefully someone can point out the problem 🙄

    Thanks!

    ;FLAVOR:RepRap
    ;TIME:12738
    ;Filament used: 12.0943m
    ;Layer height: 0.2
    ;MINX:56.5
    ;MINY:56.5
    ;MINZ:0.2
    ;MAXX:178.5
    ;MAXY:178.5
    ;MAXZ:100
    ;POSTPROCESSED
    ;LINEARADVANCEPROCESSED
    ;Generated with Cura_SteamEngine 4.6.1
    T0
    M83 ;absolute extrusion mode
    M201 X500.00 Y500.00 Z140.00 E5000.00 ;Setup machine max acceleration
    M203 X9000.00 Y9000.00 Z6000.00 E6000.00 ;Setup machine max feedrate
    M204 P500.00 R1000.00 T500.00 ;Setup Print/Retract/Travel acceleration
    M205 X8.00 Y8.00 Z0.40 E5.00 ;Setup Jerk
    M220 S100 ;Reset Feedrate
    M221 S100 ;Reset Flowrate

    G28 ;Home

    M140 S60 ; start preheating the bed
    M104 S205 T0 ; start preheating hotend
    G28 ; home
    G32

    M190 S60 ; heat to Cura Bed setting
    M109 S205 T0 ; heat to Cura Hotend

    G32 E0 ;Reset Extruder
    G1 Z2.0 F3000 ;Move Z Axis up
    G1 X10.1 Y20 Z0.28 F5000.0 ;Move to start position
    G1 X10.1 Y200.0 Z0.28 F1500.0 E15 ;Draw the first line
    G1 X10.4 Y200.0 Z0.28 F5000.0 ;Move to side a little
    G1 X10.4 Y20 Z0.28 F1500.0 E30 ;Draw the second line
    G1 Z2.0 F3000 ;Move Z Axis up
    M83 ;relative extrusion mode
    G1 F2700 E-6
    ;LAYER_COUNT:500
    M572 S0.000000 D0 ;added by LinearAdvanceSettingPlugin


  • Moderator

    Does it mention what the bad command is?

    @Dragon said in Trying to figure out what is giving the Bad Command error:

    G32 E0 ;Reset Extruder

    That should be G92

    M201 X500.00 Y500.00 Z140.00 E5000.00 ;Setup machine max acceleration
    M203 X9000.00 Y9000.00 Z6000.00 E6000.00 ;Setup machine max feedrate
    M204 P500.00 R1000.00 T500.00 ;Setup Print/Retract/Travel acceleration
    M205 X8.00 Y8.00 Z0.40 E5.00 ;Setup Jerk
    

    You should remove those commands from the Cura start gcode. They will override your config.g settings.

    Also make sure you have cura set to reprap flavor gcode.



  • No, that's the problem just comes up as bad command.
    I will look over what you posted, I had to remove the G92 to stop it pulling all the filament out after print and it is set for RepRap.

    Cheers.


  • Moderator

    @Dragon said in Trying to figure out what is giving the Bad Command error:

    pulling all the filament out after print

    You'll need to set Cura to use relative extrusion.



  • It is 🙂
    Still had to run a script to make sure it did.

    Cheers.



  • 2020-06-27.png


  • Moderator

    @Dragon said in Trying to figure out what is giving the Bad Command error:

    M83 ;absolute extrusion mode

    Is it though?


  • Moderator

    If you go to the actual gcode console view does it tell you more about what bad command it is?



  • It's no longer backing the filament out after every print, but I am still trying to tune it have not started printing with it since installing the Duet WiFi.

    Cheers.



  • No still just says bad command.



  • @Phaedrux said in Trying to figure out what is giving the Bad Command error:

    @Dragon said in Trying to figure out what is giving the Bad Command error:

    M83 ;absolute extrusion mode

    Is it though?

    That is the script entering the code but not changing the text. 🙂



  • @Dragon said in Trying to figure out what is giving the Bad Command error:

    No still just says bad command.

    open the file in an editor that shows you whitespace and non-printable characters?



  • I just tried that in Notepad++ but not sure if I got it right, that is the code copied from Notepad++ pasted at the start of the thread.

    Thanks and Cheers.



  • @Dragon
    M204 P500.00 R1000.00 T500.00 ;Setup Print/Retract/Travel acceleration

    The wiki for M204 in RRF does not have an "R" parameter. https://duet3d.dozuki.com/Wiki/Gcode#Section_M204_Set_printing_and_travel_accelerations



  • Thanks, I have already taken those 4 lines out but still get the error.

    Cheers.



  • i thought it printed the line that had the bad command, maybe just to usb?

    anyways, i see a line with just whitespace below M109, so thats what made me think it may print the problem, its just not something we can see?



  • I will try removing that Thanks!

    Cheers.



  • Ugh, that didn't get rid of it. LOL


  • administrators

    What firmware version are you using? Most firmware versions usually report what the bad command was.


  • Moderator

    Can you post your homeall.g as well? Perhaps your bad command is in there.



  • Firmware 2.05.1
    Here is the code from Cura a bit more of it in case that helps:

    ;FLAVOR:RepRap
    ;TIME:1841
    ;Filament used: 1.10598m
    ;Layer height: 0.2
    ;MINX:96.5
    ;MINY:96.5
    ;MINZ:0.2
    ;MAXX:138.5
    ;MAXY:138.5
    ;MAXZ:20.2
    ;POSTPROCESSED
    ;LINEARADVANCEPROCESSED
    ;Generated with Cura_SteamEngine 4.6.1
    T0
    M83 ;absolute extrusion mode
    ;M201 X500.00 Y500.00 Z140.00 E5000.00 ;Setup machine max acceleration
    ;M203 X9000.00 Y9000.00 Z6000.00 E6000.00 ;Setup machine max feedrate
    ;M204 P500.00 R1000.00 T500.00 ;Setup Print/Retract/Travel acceleration
    ;M205 X8.00 Y8.00 Z0.40 E5.00 ;Setup Jerk
    M220 S100 ;Reset Feedrate
    M221 S100 ;Reset Flowrate
    
    G28 ;Home
    
    M140 S65 ; start preheating the bed
    M104 S215 T0 ; start preheating hotend
    G28 ; home
    G32
    
    M190 S65 ; heat to Cura Bed setting
    M109 S215 T0 ; heat to Cura Hotend
    ​
    G32 E0 ;Reset Extruder
    G1 Z2.0 F3000 ;Move Z Axis up
    G1 X10.1 Y20 Z0.28 F5000.0 ;Move to start position
    G1 X10.1 Y200.0 Z0.28 F1500.0 E15 ;Draw the first line
    G1 X10.4 Y200.0 Z0.28 F5000.0 ;Move to side a little
    G1 X10.4 Y20 Z0.28 F1500.0 E30 ;Draw the second line
    G1 Z2.0 F3000 ;Move Z Axis up
    M83 ;relative extrusion mode
    G1 F2700 E-5
    ;LAYER_COUNT:100
    M572 S0.000000 D0 ;added by LinearAdvanceSettingPlugin
    ;LAYER:0
    M107
    G1 F300 Z0.4
    G0 F6000 X127.637 Y97.311 Z0.4
    ;TYPE:SKIRT
    G1 F300 Z0.2
    G1 F2700 E5
    G1 F1200 X128.539 Y97.364 E0.03005
    G1 X129.432 Y97.496 E0.03002
    G1 X130.31 Y97.707 E0.03003
    G1 X131.166 Y97.995 E0.03004
    G1 X131.993 Y98.357 E0.03003
    G1 X132.785 Y98.792 E0.03005
    G1 X133.536 Y99.294 E0.03004
    
    And the home all:
    
    ; homeall.g
    ; called to home all axes
    ;
    ; generated by RepRapFirmware Configuration Tool v2.1.8 on Tue May 26 2020 00:51:15 GMT-0700 (Pacific Daylight Time)
    G91                     ; relative positioning
    G1 H2 Z5 F6000          ; lift Z relative to current position
    G1 H1 X-240 Y-240 F1800 ; move quickly to X and Y axis endstops and stop there (first pass)
    G1 H2 X5 Y5 F6000       ; go back a few mm
    G1 H1 X-240 Y-240 F360  ; move slowly to X and Y axis endstops once more (second pass)
    G90                     ; absolute positioning
    G1 X117 Y117 F6000        ; go to first bed probe point and home Z
    G30                     ; home Z by probing the bed
    G29 S1
    
    ; Uncomment the following lines to lift Z after probing
    ;G91                    ; relative positioning
    ;G1 Z5 F100             ; lift Z relative to current position
    ;G90                    ; absolute positioning
    

    But this only happens with files from Cura.

    Thanks.


  • administrators

    @Dragon said in Trying to figure out what is giving the Bad Command error:

    G32 E0 ;Reset Extruder

    That looks wrong. I presume it should be: G92 E0

    Edit: @Phaedrux already pointed that out.

    Can you post your bed.g file too?



  • Thanks, will try that change now.



  • Nope that wasn't it 😞



  • Here is the end Gcode if it could be there:

    G0 F9000 X114.795 Y108.649
    G1 F1500 X111.208 Y112.237 E0.16875
    G1 X110.926 Y112.519
    ;TIME_ELAPSED:1841.048257
    G1 F2700 E-5
    M140 S0
    M83 ;absolute extrusion mode
    M107
    G91 ;Relative positionning
    G1 E-2 F2700 ;Retract a bit
    G1 E-2 Z0.2 F2400 ;Retract and raise Z
    G1 X5 Y5 F3000 ;Wipe out
    G1 Z10 ;Raise Z more
    G90 ;Absolute positionning

    G1 X0 Y235 ;Present print
    M106 S0 ;Turn-off fan
    M104 S0 ;Turn-off hotend
    M140 S0 ;Turn-off bed

    M84 X Y E ;Disable all steppers but Z
    M83 ;relative extrusion mode
    M104 S0
    ;End of Gcode
    ;SETTING_3 {"global_quality": "[general]\nversion = 4\nname = Standard Quality
    ;SETTING_3 #3\ndefinition = creality_ender3\n\n[metadata]\nquality_type = s
    ;SETTING_3 tandard\ntype = quality_changes\n\n[values]\nadhesion_type = skir
    ;SETTING_3 t\nmaterial_bed_temperature = 65\n\n", "extruder_quality": ["[gene
    ;SETTING_3 ral]\nversion = 4\nname = Standard Quality #3\ndefinition = creali
    ;SETTING_3 ty_ender3\n\n[metadata]\nquality_type = standard\nposition = 0\n
    ;SETTING_3 type = quality_changes\n\n[values]\ninfill_overlap = 10.0\ninfill
    ;SETTING_3 _pattern = gyroid\ninfill_sparse_density = 10\ninfill_wipe_dist = 0
    ;SETTING_3 .4\nmaterial_flow = 100\nmaterial_flow_layer_0 = 100\nmaterial_pri
    ;SETTING_3 nt_temperature = 215\nretraction_hop_enabled = True\nretraction_hop
    ;SETTING_3 _only_when_collides = True\nskirt_gap = 10\nspeed_wall_0 = 30.0\ns
    ;SETTING_3 peed_wall_x = 30.0\ntop_bottom_thickness = =layer_height_0+layer_hei
    ;SETTING_3 ght*3\nwall_0_material_flow = 100\n\n"]}


Log in to reply