Notifications
Clear all

Unknown G code $51 G21  

  RSS
joe.g7
(@joe-g7)
Active Member
Unknown G code $51 G21

Trying to print a model. Keep getting the following error code in Slic3r (Prusa Edition 1.37.2):

echo:busy: processing
echo:busy: processing
echo:Advance K=30.00
E/D=Auto
Unknown G code: $51 G21
echo:busy: processing
echo:busy: processing
echo:busy: processing
echo:busy: processing
echo:busy: processing

Any thoughts?

Napsal : 25/08/2018 10:31 pm
JoanTabb
(@joantabb)
Veteran Member Moderator
Re: Unknown G code $51 G21

Hi Joe,

might have been a good idea to include the Gcode so that folk can look it over,

it might be that there is a little corruption
and the $51 may be meant to attatch to a missing Gcode...

regards Joan.

I try to make safe suggestions,You should understand the context and ensure you are happy that they are safe before attempting to apply my suggestions, what you do, is YOUR responsibility. Location Halifax UK

Napsal : 26/08/2018 12:31 am
joe.g7
(@joe-g7)
Active Member
Topic starter answered:
Re: Unknown G code $51 G21

Sorry, noob when it comes to G code. Attached is the file. This one is printing the same part, but has a slightly different error (Unknown G code: $108 G21 ) when printing.

Napsal : 26/08/2018 5:41 pm
bobstro
(@bobstro)
Illustrious Member
Re: Unknown G code $51 G21

G21 appears exactly once on line 28 in that gcode. It is immediately preceded by the line:

M900 K30 ; Filament gcode

Which is normal for setting Linear Advance for PLA. Are you by any chance printing by any other means than directly of the SD card? If so, can you try printing the same gcode file directly from SD card?

Timing issues might cause commands to be corrupted during transmission. It is interesting that the error in both cases occurs immediately before the G21 line which sets unit to millimeters.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Napsal : 26/08/2018 6:32 pm
IBICO74
(@ibico74)
Active Member
Re: Unknown G code $51 G21

I get the same error.

17:24:04.034: Unknown G code: $91 G21

G21 ; set units to millimeters

Tried to reflash my MK3 with latest firmware 1.60.0 without any differ. Tried to upload the code to Repetier and direct USB from Slic3rPE.
Exported to disk and checked the Gcode and it say G21 one place.

; generated by Slic3r Prusa Edition 1.41.3+linux64 on 2019-03-07 at 17:54:05

;

; external perimeters extrusion width = 0.80mm
; perimeters extrusion width = 0.80mm
; infill extrusion width = 0.56mm
; solid infill extrusion width = 0.75mm
; top infill extrusion width = 0.75mm
; first layer extrusion width = 0.80mm

M201 X1000 Y1000 Z1000 E1000 ; sets maximum accelerations, mm/sec^2
M203 X200 Y200 Z12 E120 ; sets maximum feedrates, mm/sec
M204 P1250 R1250 T1250 ; sets acceleration (P, T) and retract acceleration (R), mm/sec^2
M205 X8.00 Y8.00 Z0.40 E1.50 ; sets the jerk limits, mm/sec
M205 S0 T0 ; sets the minimum extruding and travel feed rate, mm/sec
M107
M115 U3.5.1 ; tell printer latest fw version
M83 ; extruder relative mode
M104 S220 ; set extruder temp
M140 S60 ; set bed temp
M190 S60 ; wait for bed temp
M109 S220 ; wait for extruder temp
G28 W ; home all without mesh bed level
G80 ; mesh bed leveling
G1 Y-3.0 F1000.0 ; go outside print area
G92 E0.0
G1 X60.0 E9.0 F1000.0 ; intro line
G1 X100.0 E12.5 F1000.0 ; intro line
G92 E0.0
M221 S95
M900 K4510; Filament gcode
G21 ; set units to millimeters
G90 ; use absolute coordinates
M82 ; use absolute distances for extrusion
G92 E0
;BEFORE_LAYER_CHANGE
G92 E0.0
;0.28

; Filament-specific end gcode
G4 ; wait
M221 S100
M104 S0 ; turn off temperature
M140 S0 ; turn off heatbed
M107 ; turn off fan
G1 Z55.12 ; Move print head up
G1 X0 Y200; home X axis
M84 ; disable motors
; filament used = 606.6mm (1.5cm3)
; filament used = 1.7
; filament cost = 0.1
; total filament cost = 0.1
; estimated printing time (normal mode) = 9m 8s

; avoid_crossing_perimeters = 0
; bed_shape = 0x0,250x0,250x210,0x210
; bed_temperature = 60
; before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\n\n
; between_objects_gcode =
; bridge_acceleration = 1000
; bridge_fan_speed = 100
; brim_width = 0
; complete_objects = 0
; cooling = 1
; cooling_tube_length = 5
; cooling_tube_retraction = 91.5
; default_acceleration = 1000
; deretract_speed = 0
; disable_fan_first_layers = 2
; duplicate_distance = 6
; end_filament_gcode = "; Filament-specific end gcode"
; end_gcode = G4 ; wait\nM221 S100\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up\nG1 X0 Y200; home X axis\nM84 ; disable motors
; extra_loading_move = -2
; extruder_clearance_height = 20
; extruder_clearance_radius = 20
; extruder_colour = #FFFF00
; extruder_offset = 0x0
; extrusion_axis = E
; extrusion_multiplier = 1
; fan_always_on = 1
; fan_below_layer_time = 100
; filament_colour = #D86161
; filament_cooling_final_speed = 3.4
; filament_cooling_initial_speed = 2.2
; filament_cooling_moves = 4
; filament_cost = 68
; filament_density = 1.15
; filament_diameter = 1.75
; filament_load_time = 0
; filament_loading_speed = 28
; filament_loading_speed_start = 3
; filament_max_volumetric_speed = 10
; filament_minimal_purge_on_wipe_tower = 15
; filament_notes = ""
; filament_ramming_parameters = "120 100 6.6 6.8 7.2 7.6 7.9 8.2 8.7 9.4 9.9 10.0| 0.05 6.6 0.45 6.8 0.95 7.8 1.45 8.3 1.95 9.7 2.45 10 2.95 7.6 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6"
; filament_soluble = 0
; filament_toolchange_delay = 0
; filament_type = PLA
; filament_unload_time = 0
; filament_unloading_speed = 90
; filament_unloading_speed_start = 100
; first_layer_acceleration = 1000
; first_layer_bed_temperature = 60
; first_layer_extrusion_width = 0.8
; first_layer_speed = 20
; first_layer_temperature = 220
; gcode_comments = 0
; gcode_flavor = marlin
; infill_acceleration = 1250
; infill_first = 0
; layer_gcode = ;AFTER_LAYER_CHANGE\n;[layer_z]
; machine_max_acceleration_e = 1000,5000
; machine_max_acceleration_extruding = 1250,1250
; machine_max_acceleration_retracting = 1250,1250
; machine_max_acceleration_x = 1000,960
; machine_max_acceleration_y = 1000,960
; machine_max_acceleration_z = 1000,1000
; machine_max_feedrate_e = 120,120
; machine_max_feedrate_x = 200,100
; machine_max_feedrate_y = 200,100
; machine_max_feedrate_z = 12,12
; machine_max_jerk_e = 1.5,1.5
; machine_max_jerk_x = 8,8
; machine_max_jerk_y = 8,8
; machine_max_jerk_z = 0.4,0.4
; machine_min_extruding_rate = 0,0
; machine_min_travel_rate = 0,0
; max_fan_speed = 100
; max_layer_height = 0.4
; max_print_height = 210
; max_print_speed = 100
; max_volumetric_extrusion_rate_slope_negative = 0
; max_volumetric_extrusion_rate_slope_positive = 0
; max_volumetric_speed = 0
; min_fan_speed = 100
; min_layer_height = 0.15
; min_print_speed = 15
; min_skirt_length = 4
; notes =
; nozzle_diameter = 0.8
; only_retract_when_crossing_perimeters = 0
; ooze_prevention = 0
; output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}.gcode
; parking_pos_retraction = 92
; perimeter_acceleration = 800
; post_process =
; printer_model = MK3
; printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_MK3\n
; remaining_times = 0
; resolution = 0
; retract_before_travel = 2
; retract_before_wipe = 0%
; retract_layer_change = 0
; retract_length = 0.2
; retract_length_toolchange = 4
; retract_lift = 0.2
; retract_lift_above = 0
; retract_lift_below = 209
; retract_restart_extra = 0
; retract_restart_extra_toolchange = 0
; retract_speed = 35
; silent_mode = 0
; single_extruder_multi_material = 0
; single_extruder_multi_material_priming = 0
; skirt_distance = 2
; skirt_height = 3
; skirts = 1
; slowdown_below_layer_time = 20
; spiral_vase = 0
; standby_temperature_delta = -5
; start_filament_gcode = "M900 K45{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"
; start_gcode = M115 U3.5.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0\nM221 S{if layer_height<0.075}100{else}95{endif}
; temperature = 220
; threads = 4
; toolchange_gcode =
; travel_speed = 180
; use_firmware_retraction = 0
; use_relative_e_distances = 0
; use_volumetric_e = 0
; variable_layer_height = 0
; wipe = 0
; wipe_tower = 0
; wipe_tower_bridging = 10
; wipe_tower_rotation_angle = 0
; wipe_tower_width = 60
; wipe_tower_x = 170
; wipe_tower_y = 125
; wiping_volumes_extruders = 70,70
; wiping_volumes_matrix = 0
; z_offset = 0
; clip_multipart_objects = 0
; dont_support_bridges = 1
; elefant_foot_compensation = 0
; extrusion_width = 0.8
; first_layer_height = 0.28
; infill_only_where_needed = 0
; interface_shells = 0
; layer_height = 0.28
; raft_layers = 0
; seam_position = nearest
; support_material = 0
; support_material_angle = 0
; support_material_auto = 0
; support_material_buildplate_only = 0
; support_material_contact_distance = 0.1
; support_material_enforce_layers = 0
; support_material_extruder = 0
; support_material_extrusion_width = 0.55
; support_material_interface_contact_loops = 0
; support_material_interface_extruder = 0
; support_material_interface_layers = 2
; support_material_interface_spacing = 0.2
; support_material_interface_speed = 100%
; support_material_pattern = rectilinear
; support_material_spacing = 2
; support_material_speed = 50
; support_material_synchronize_layers = 0
; support_material_threshold = 55
; support_material_with_sheath = 0
; support_material_xy_spacing = 50%
; wipe_into_objects = 0
; xy_size_compensation = 0
; bottom_solid_layers = 2
; bridge_angle = 0
; bridge_flow_ratio = 0.95
; bridge_speed = 70
; ensure_vertical_shell_thickness = 0
; external_fill_pattern = rectilinear
; external_perimeter_extrusion_width = 0.8
; external_perimeter_speed = 50%
; external_perimeters_first = 0
; extra_perimeters = 0
; fill_angle = 45
; fill_density = 5%
; fill_pattern = gyroid
; gap_fill_speed = 25
; infill_every_layers = 1
; infill_extruder = 1
; infill_extrusion_width = 200%
; infill_overlap = 28%
; infill_speed = 70
; overhangs = 0
; perimeter_extruder = 1
; perimeter_extrusion_width = 0.8
; perimeter_speed = 60
; perimeters = 2
; small_perimeter_speed = 15
; solid_infill_below_area = 0
; solid_infill_every_layers = 0
; solid_infill_extruder = 1
; solid_infill_extrusion_width = 0.75
; solid_infill_speed = 70
; thin_walls = 0
; top_infill_extrusion_width = 0.75
; top_solid_infill_speed = 45
; top_solid_layers = 3
; wipe_into_infill = 0
; print_settings_id = 0.18mm 0.8 nozzle MK3
; filament_settings_id = "Polyalchemy rosa"
; printer_settings_id = Prusa i3 MK3 0.8 nozzle
; printer_model = MK3
; printer_variant = 0.6
; default_print_profile = 0.30mm QUALITY 0.6 nozzle MK3
; default_filament_profile = "Prusament PLA"
; compatible_printers_condition_cummulative = "printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and nozzle_diameter[0]==0.6";"nozzle_diameter[0]>0.35 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)"
; inherits_cummulative = "0.30mm QUALITY 0.6 nozzle MK3";"Fillamentum Timberfill";"Original Prusa i3 MK3 0.6 nozzle"

Napsal : 07/03/2019 6:01 pm
bobstro
(@bobstro)
Illustrious Member
Re: Unknown G code $51 G21


I get the same error.

M900 K4510; Filament gcode
G21 ; set units to millimeters

The value for M900 in the line is likely invalid. Try something in the range 30-45.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Napsal : 07/03/2019 8:18 pm
--
 --
(@)
Illustrious Member
Re: Unknown G code $51 G21

The command appears to be a result of some math in the filament custom gcode:
M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}30{endif}; Filament gcode

From Marlin: looks like large numbers are not expected. But it is a float ... so they shouldn't cause a failure. What is more interesting is that Prusa's list of gcode commands doesn't include M900. Might be worth a test by commenting the M900 out.

Usage
M900 [K<float>]
Parameters
[K<float>]
Advance K factor. Unchanged if omitted. Set this value higher for more flexible filament or a longer filament path.

Example
Set the K factor

M900 K0.18

Napsal : 07/03/2019 8:28 pm
Cipis
(@cipis)
Member
Re: Unknown G code $51 G21

Your custom filament g-code is not OK. If you want K value 45, just edit it to M900 K45 and delete rest of the conditional g-code.

Napsal : 10/03/2019 8:15 pm
--
 --
(@)
Illustrious Member
Re: Unknown G code $51 G21

@Roman is correct:

This line is broken:

; start_filament_gcode = "M900 K45{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"

It should look like:

; start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}45{endif}; Filament gcode"

Or if you do not have and don't plan on having an MMU:

M900 K45

Napsal : 10/03/2019 8:22 pm
Share: