nehilo / Klipper-KingRoon-Printers

151 stars 41 forks source link

Unable to read tmc uart 'stepper_y' register IFCNT #19

Closed VectorForce3D closed 1 year ago

VectorForce3D commented 1 year ago

Flashed the given GD32 bin and set up my printer.cfg. the print works fine if I don't use any tmc 2208 cfg but when I do, it instantly throws an error when I try to move.

`#####################################

PRINTER

##################################### [printer] kinematics: cartesian max_velocity: 300 max_accel: 3500 max_accel_to_decel:1750 max_z_velocity: 15 max_z_accel: 100 square_corner_velocity: 5.0

[input_shaper] shaper_freq_x: 23.0 shaper_freq_y: 39.0 shaper_type_x: mzv shaper_type_y: mzv

[mcu] serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 baud: 250000 restart_method: command

[temperature_sensor HOST] sensor_type: temperature_host

[temperature_sensor MCU] sensor_type: temperature_mcu

[virtual_sdcard] path: /home/user/printer_2_data/gcodes

[gcode_arcs] resolution: 0.05

[display_status]

[pause_resume]

[respond]

#####################################

Heater Verification

##################################### [verify_heater heater_bed] max_error: 120 check_gain_time: 60 hysteresis: 5 heating_gain: 2

[verify_heater extruder] max_error: 120 check_gain_time: 30 hysteresis: 5 heating_gain: 2

#####################################

BEEPER

#####################################

[output_pin _BEEPER_pin]

pin: PC5

pwm: true

value: 1

shutdown_value: 0

cycle_time: 0.001

scale: 1000

#####################################

Filament Sensor

#####################################

[filament_switch_sensor FilamentSensor]

pause_on_runout: False

runout_gcode:

M118 Starting filament change

M600

insert_gcode:

switch_pin: !PA4

event_delay: 5.0

#####################################

STEPPER

##################################### [stepper_x] step_pin: PE3 dir_pin: PE2 enable_pin: !PE4 full_steps_per_rotation: 200 microsteps: 32 rotation_distance: 40 endstop_pin: !PA15 position_endstop: 0 position_min: 0 position_max: 180 homing_speed: 50 homing_retract_dist: 0 second_homing_speed: 3

[stepper_y] step_pin: PE0 dir_pin: PB9 enable_pin: !PE1 full_steps_per_rotation: 200 microsteps: 32 rotation_distance: 40 endstop_pin: !PA12 position_endstop: -2.5 position_min: -2.5 position_max: 180 homing_speed: 50 homing_retract_dist: 0 second_homing_speed: 3

[stepper_z] step_pin: PB5 dir_pin: !PB4 enable_pin: !PB8 full_steps_per_rotation: 200 microsteps: 32 rotation_distance: 8 endstop_pin: !PA11 # disable to use BLTouch

endstop_pin: probe:z_virtual_endstop # enable to use BLTouch

position_endstop: 0 # disable to use BLTouch position_max: 190 homing_retract_dist: 10.0 second_homing_speed: 5

position_min: -5 # enable to use BLTouch

#####################################

BLtouch

#####################################

[include bltouch.cfg] # disable to use stock modification

#####################################

TMC

#####################################

[tmc2208 stepper_x] uart_pin: PA5 run_current: 0.650 stealthchop_threshold: 0 interpolate: false sense_resistor: 0.110 driver_TBL: 2 driver_TOFF: 3 driver_HEND: 3 driver_HSTRT: 0 driver_PWM_GRAD: 8 driver_PWM_LIM: 9

[tmc2208 stepper_y] uart_pin: PC13 run_current: 0.650 stealthchop_threshold: 0 interpolate: false sense_resistor: 0.110 driver_TBL: 2 driver_TOFF: 3 driver_HEND: 3 driver_HSTRT: 0 driver_PWM_GRAD: 8 driver_PWM_LIM: 9

[tmc2208 stepper_z] uart_pin: PC7 run_current: 0.650 stealthchop_threshold: 0 interpolate: false sense_resistor: 0.110 driver_TBL: 0 driver_TOFF: 3 driver_HEND: 2 driver_HSTRT: 0 driver_PWM_GRAD: 8 driver_PWM_LIM: 10

[tmc2208 extruder] uart_pin: PA10 run_current: 0.500 sense_resistor: 0.110 stealthchop_threshold: 0 interpolate: false sense_resistor: 0.110

#####################################

THERMISTOR

#####################################

[thermistor Kingroon_Calibrated B3950] temperature1: 25.0 resistance1: 103180.0 temperature2: 150.0 resistance2: 1366.2 temperature3: 250.0 resistance3: 168.6

#####################################

EXTRUDER

#####################################

[extruder] max_extrude_only_distance: 100.0 step_pin: PD6 dir_pin: !PD3 enable_pin: !PB3 full_steps_per_rotation: 200 microsteps: 32 rotation_distance: 7.940 #red head max_extrude_cross_section: 10

BMG Extruder ->

rotation_distance: 22.6789511

gear_ratio = 50:17

Titan Extruder ->

rotation_distance: 7.940

nozzle_diameter: 0.400 filament_diameter: 1.750 heater_pin: PC3 sensor_type: Kingroon_Calibrated B3950 sensor_pin: PC1 control: pid pid_Kp: 19.0 pid_Ki: 1.34 pid_Kd: 67.5 min_temp: 0 max_temp: 300 pressure_advance: 0.035

#####################################

BED

#####################################

[heater_bed] heater_pin: PA0 sensor_type: Kingroon_Calibrated B3950 sensor_pin: PC0 control: pid pid_Kp: 40.68 pid_Ki: 7.93 pid_Kd: 139.15 min_temp: 0 max_temp: 130

[bed_screws]

need calibration

screw1: 20,20 screw2: 160,20 screw3: 160,160 screw4: 20,160

#####################################

FAN

#####################################

[fan] pin: PB1

[heater_fan my_nozzle_fan] pin: PB0 heater: extruder heater_temp: 50.0 fan_speed: 1.0 shutdown_speed: 1

#####################################

MACROS

#####################################

[gcode_macro M300]

gcode: SET_PIN PIN=_BEEPER_pin VALUE={S}

G4 P{P}

SET_PIN PIN=_BEEPER_pin VALUE=0

[gcode_macro PARK] gcode: PAUSE

[gcode_macro M600] description: Filament change macro gcode: {% if printer.toolhead.homed_axes != "xyz" %} M118 Homing G28 {% endif %} {% if printer.extruder.can_extrude == 0 %} {% set max_z = printer.toolhead.axis_maximum.z|float %} {% set act_z = printer.toolhead.position.z|float %} {% if act_z > (max_z - 20.0) %} {% set z_safe = max_z %} {% else %} {% set z_safe = (act_z + 20.0) %} {% endif %} G91 G1 Z{z_safe} G90 G1 X0 Y0 F2100 M118 Acquiring temperature M109 S200 {% endif %}
{% if printer.pause_resume.is_paused == 0 %} PAUSE {% endif %} M118 First UNLOAD, then LOAD new and RESUME when ready

[gcode_macro UNLOAD] description: Unload filament helper gcode: {% if printer.pause_resume.is_paused == 1 %} {% if printer.extruder.can_extrude == 1 %} G91 G1 E5 F300 G1 E-50 F300 G90 {% else %} RESPOND TYPE=error MSG="Extrude below minimum temp" {% endif %} {% else %} RESPOND TYPE=error MSG="Printer must be paused" {% endif %}

[gcode_macro LOAD] description: Load filament helper gcode: {% if printer.pause_resume.is_paused == 1 %} {% if printer.extruder.can_extrude == 1 %} G91 G1 E20 F300 G90 {% else %} RESPOND TYPE=error MSG="Extrude below minimum temp" {% endif %} {% else %} RESPOND TYPE=error MSG="Printer must be paused" {% endif %}

[gcode_macro LOW_TEMP_CHECK_T] gcode: {% if printer.extruder.target != 0 %} # if there is a setpoint for extruder {% if printer.extruder.temperature < printer.extruder.target %} # if not reached, heat

M118 Heating from {printer.extruder.temperature} to {printer.extruder.target}.

        M109 S{printer.extruder.target|float} 
    {% endif %}
{% else %} # if no setpoint for extruder
    {% if printer.extruder.target < T %}  # heat to T.

M118 No setpoint, heating to {T}.

        M109 S{T}
    {% endif %}
{% endif %}

[gcode_macro M900] description: Set pressure advance gcode: SET_PRESSURE_ADVANCE ADVANCE={params.K|default(0)}

[gcode_macro Bed_Mesh] gcode: {% if printer.toolhead.homed_axes != "xyz" %} G28 # home if not homed {% endif %} SAVE_GCODE_STATE NAME=G29_STATE {% if T|int > 30 %} M140 S{T} # set bed temperature M190 S{T} # wait for bed temperature {% endif %} BED_MESH_CALIBRATE profile="default" G0 X10 Y10 F6000

[gcode_macro PROBE_CALIBRATE] #BLtouch

rename_existing: BASE_PROBE_CALIBRATE

gcode:

{% if printer.toolhead.homed_axes != "xyz" %}

G28 # home if not homed

{% endif %}

BASE_PROBE_CALIBRATE

[gcode_macro PRIME_LINE]

PrusaSliser: PRIME_LINE F={first_layer_speed}

Cura: PRIME_LINE F={speed_print_layer_0}

gcode: {% set feedrate = params.F|default(20)|float 60 %} {% set length = params.L|default(120)|float %} {% if 'Y' in params %} {% set length_max = ( printer.toolhead.axis_maximum.y|float - 10.0 ) %} {% else %} {% set length_max = ( printer.toolhead.axis_maximum.x|float - 10.0 ) %} {% endif %} {% if length > length_max %} {% set length = length_max %} {% endif %} {% set width = printer.configfile.settings.extruder.nozzle_diameter|float %} {% set height = ( (width / 0.04)|int - (width / 0.04 / 4)|int )|float 0.04 %} {% set extrude = 1.5 length width * height / 2.4 %} SAVE_GCODE_STATE NAME=PRIME_LINE_STATE SET_IDLE_TIMEOUT TIMEOUT=7200 {% if 'Y' in params %} {% set x_start = 5.0 %} {% set y_start = (printer.toolhead.axis_maximum.y|float - length) / 2 %} G0 X{x_start} Y{y_start} Z{height} F5000 # move to start position G91 # relative positioning G1 Y{length} E{extrude} F{feedrate} # draw the 1st line G1 X{width} F5000 # move to the next line G1 Y-{length} E{extrude} F{feedrate} # draw the 2nd line {% else %} {% set x_start = (printer.toolhead.axis_maximum.x|float - length) / 2 %} {% set y_start = 5.0 %} G0 X{x_start} Y{y_start} Z{height} F5000 # move to start position G91 # relative positioning G1 X{length} E{extrude} F{feedrate} # draw the 1st line G1 Y{width} F5000 # move to the next line G1 X-{length} E{extrude} F{feedrate} # draw the 2nd line {% endif %} RESTORE_GCODE_STATE NAME=PRIME_LINE_STATE

[gcode_macro _FILAMENT_BALL] description: Helper: Round the filament tip gcode:

set default parameter value

{% set wait = params.WAIT|default(0) %}

end of definitions

SAVE_GCODE_STATE NAME=STATE_FILAMENT_BALL

Ball up the filament tip

G92 E0 ; zero the extruder M82 ; absolute extrusion G1 E2 F3600 G1 E0 F3600 G1 E4 F3600 G1 E0 F3600 G1 E8 F3600 G1 E0 F3600 M83 ; relative extrusion G1 E-25 F3600 G4 P{wait|int * 1000} RESTORE_GCODE_STATE NAME=STATE_FILAMENT_BALL

[gcode_macro PAUSE] rename_existing: BASE_PAUSE gcode:

set defaults
{% set x = params.X|default(10) %}       #edit to your park position
{% set y = params.Y|default(170) %}      #edit to your park position
{% set z = params.Z|default(20)|float %} #edit to your park position
{% set e = params.E|default(1) %}        #edit to your retract length
##### calculate safe lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% set lift_z = z|abs %}
{% if act_z < (max_z - lift_z) %}
    {% set z_safe = lift_z %}
{% else %}
    {% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{e} F300
G1 Z{z_safe}
G90
G1 X{x} Y{y} F4000

[gcode_macro RESUME] rename_existing: BASE_RESUME gcode:

set defaults
{% set e = params.E|default(1) %} #edit to your retract length
G91
G1 E{e} F300
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME  

[gcode_macro CANCEL_PRINT] rename_existing: BASE_CANCEL_PRINT gcode: {% set ENDY = printer.toolhead.axis_maximum.y|float - 10 %} G91
G1 E-1 F300 G1 Z1 E-1 F4000 G90 G1 X0 Y{ENDY} M84 M106 S0 TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT

[gcode_macro END_PRINT] gcode: M140 S0 M104 S0 M106 S0 G91 G1 X0 Y0 E-3 F300 G1 Z20 F3000 G90 M84

[include mainsail.cfg]

[include Adaptive_Purge.cfg]

[exclude_object]

[gcode_macro START_PRINT] gcode: ADAPTIVE_PURGE

[exclude_object]`

nehilo commented 1 year ago

u need to solder UART pad on board. Chk readme https://github.com/nehilo/Klipper-KingRoon-Printers#tmc-uart-pin-kingroon-motherboard--for-advanced-users-