Pin virtual_endstop used multiple times in config

Basic Information:

Printer Model: Cartesian
MCU / Printerboard: Fysetc Spider V2.2
klippy.log Don’t have one yet

Describe your issue:

I am trying to configure Klipper to run my Cartesian 3D printer. I am having trouble with the diag pin for sensorless homing and the Fysetc TMC2209 v3.0 driver. Klipper keeps giving me this error " pin virtual_endstop used multiple times in config". I have been through the configuration multiple times and cannot see the conflict. The X and Y pins on the Spider V2.2 board share pins PB13 and PB14 with the X and Y min endstop connections. I want to use sensorless homing. When I add the diag pin configuration to my printer.cfg file, it comes back with the error. How do I configure the Spider V2.2 board with the Fysetc TMC 2209 V3.0 drivers to use sensorless homing in Klipper?

My configuration -
#####################################
# Spider v2.2 
#####################################

[stepper_x]
step_pin: PE11
dir_pin: !PE10
enable_pin: !PE9
microsteps: 16
rotation_distance: 40
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_endstop: -18
position_min = -20
position_max: 300
homing_speed = 45
full_steps_per_rotation: 200
step_pulse_duration: 0.000000100
homing_retract_dist = 0

[stepper_y]
step_pin: PD8
dir_pin: !PB12
enable_pin: !PD9
microsteps: 16
rotation_distance: 40
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_endstop: 3
position_max: 300
homing_speed = 40
full_steps_per_rotation: 200
step_pulse_duration: 0.000000100
homing_retract_dist = 0

[stepper_z]
step_pin: PD14
dir_pin: !PD13
enable_pin: !PD15
microsteps: 16
rotation_distance: 8
endstop_pin = probe:z_virtual_endstop
position_min = -2
position_max = 280
homing_speed = 12
full_steps_per_rotation: 200
step_pulse_duration: 0.000000100

[stepper_z1]
step_pin = PE6
dir_pin = !PC13
enable_pin = !PE5
microsteps = 16
rotation_distance = 8
full_steps_per_rotation: 200
step_pulse_duration: 0.000000100

[extruder]
step_pin: PD5
dir_pin: !PD6
enable_pin: !PD4
microsteps: 16
rotation_distance: 33.500
nozzle_diameter: 0.400
filament_diameter: 1.750
pressure_advance = 0.15
pressure_advance_smooth_time = 0.1
smooth_time = 2.0
min_extrude_temp = 170
heater_pin: PB15
sensor_type = NTC 100K MGB18-104F39050L32
sensor_pin: PC0
control: pid
pid_Kp: 22
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 325

####################################
# Heated BED
####################################

[heater_bed]
heater_pin: PB4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
control: watermark
min_temp: 0
max_temp: 130
control = pid
pid_kp = 73.064
pid_ki = 0.729
pid_kd = 1830.251

#####################################
# FAN Control
#####################################

#fan for printed model FAN0
[fan]
pin: PA13

#fan for hotend FAN1
#[heater_fan heatbreak_cooling_fan]
pin: PA14
shutdown_speed: 1

#fan for control board FAN2
[heater_fan my_control_fan]
pin: PB2

####################################
# MCU Serial number and Temp sensor
####################################

[mcu]
## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify
serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00

[temperature_sensor mcu_temp]
sensor_type = temperature_mcu

######################################
# Printer type and settings
######################################

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000                     #Max 4000
max_accel_to_decel: 1500
square_corner_velocity: 5.0
max_z_velocity: 15                  #Max 15 for 12V TMC Drivers, can increase for 24V
max_z_accel: 100

########################################
# TMC UART configuration
########################################

[tmc2209 stepper_x]
uart_pin: PE7
diag_pin: PB14`Preformatted text`
run_current: 0.6
stealthchop_threshold: 999999

[tmc2209 stepper_y]
uart_pin: PE15
diag_pin: PB13
run_current: 0.6
stealthchop_threshold: 999999

[tmc2209 stepper_z]
uart_pin: PD10
run_current: 0.6
stealthchop_threshold: 999999

[tmc2209 extruder]
uart_pin: PD7
run_current: 0.6
sense_resistor: 0.110
stealthchop_threshold: 999999

[tmc2209 stepper_z1]
uart_pin: PC14
run_current: 0.6
stealthchop_threshold: 999999

########################################
# BL TOUCH CONFIGURATION
########################################

[bltouch]
sensor_pin = ^PA0
control_pin = PA2
pin_move_time = 0.680
stow_on_each_sample = True
probe_with_touch_mode = False
pin_up_reports_not_triggered = True
pin_up_touch_mode_reports_triggered = True
x_offset = -42
y_offset = 12
speed = 5.0
samples = 1
sample_retract_dist = 5.0
lift_speed = 5.0
samples_result = average
samples_tolerance = 0.100
samples_tolerance_retries = 1
z_offset = 0.950

########################################
# BED MESH AND Z TILT
########################################

[bed_mesh]
speed = 90
horizontal_move_z = 10.0
mesh_min = 35, 35
mesh_max = 245, 270
probe_count = 8, 8
mesh_pps = 3, 3
algorithm = bicubic
bicubic_tension = 0.2
relative_reference_index = 12
fade_start = 0.4
fade_end = 10.0

[z_tilt]
z_positions = -55, 325
	145, 145
points = 80, 270
	270, 30
speed = 45
horizontal_move_z = 10

#######################################
# ADXL345 AND IMPUT SHAPER
#######################################

[resonance_tester]
accel_chip = adxl345
probe_points = 
	150,150,200

[input_shaper]
shaper_type = mzv
damping_ratio_x = 0.1
damping_ratio_y = 0.1
shaper_type_x = ei
shaper_freq_x = 45.8
shaper_type_y = zv
shaper_freq_y = 21.0

#######################################
# RUNOUT SENSOR
#######################################

[filament_switch_sensor RunoutSensor]
pause_on_runout = True
runout_gcode = PAUSE
insert_gcode = RESUME
switch_pin = !PA3

######################################
# HOMING X Y Z
######################################

[safe_z_home]
home_xy_position = 150, 150
speed = 55.0
z_hop = 10
z_hop_speed = 5.0
move_to_previous = False

#####################################
# HEATER VERIFICATION
#####################################

[verify_heater extruder]
max_error = 160
check_gain_time = 35
hysteresis = 5
heating_gain = 2

[verify_heater heater_bed bed]
max_error = 160
check_gain_time = 70
hysteresis = 5
heating_gain = 1

##################################
# RETRACTION
##################################

[firmware_retraction]
retract_length = 6
retract_speed = 60
unretract_extra_length = 2
unretract_speed = 10

##################################
# EXTRAS
##################################

[gcode_arcs]
resolution = 1.0

[virtual_sdcard]
path = ~/gcode_files

[display_status]

[endstop_phase]

[pause_resume]
recover_velocity = 50

################################
# MACROS
################################

[gcode_macro POWER_OFF_PRINTER]
gcode = 
	{action_call_remote_method("set_device_power",
	device="Printer",
	state="off")}

[delayed_gcode delayed_printer_off]
initial_duration = 0.
gcode = 
	{% if printer.idle_timeout.state == "Idle" %}
	POWER_OFF_PRINTER
	{% endif %}

[gcode_macro UNLOAD_FILAMENT]
gcode = 
	{% set speed = params.SPEED|default(500) %}
	G91
	G1 E-50 F{speed}
	G1 E-50 F{speed}
	G92

[gcode_macro LOAD_FILAMENT]
gcode = 
	{% set speed = params.SPEED|default(500) %}
	G91
	G1 E50 F{speed}
	G1 E50 F{speed}
	G92

[gcode_macro START_PRINT]
gcode = 
	G90
	SET_GCODE_OFFSET Z=0.0
	G28
	BED_MESH_PROFILE LOAD="default"
	G1 X15 Y20 Z5 F6000
	G1 Z0.15 F300

[gcode_macro END_PRINT]
gcode = 
	M140 S0
	M104 S0
	M106 S0
	G91
	G1 X-2 Y-2 E-3 F300
	G1 Z20 F3000
	G90
	M84

[gcode_macro PAUSE]
description = Pause the actual running print
rename_existing = PAUSE_BASE
gcode = 
	PAUSE_BASE
	_TOOLHEAD_PARK_PAUSE_CANCEL

[gcode_macro RESUME]
description = Resume the actual running print
rename_existing = RESUME_BASE
gcode = 
	{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
	{% if 'VELOCITY' in params|upper %}
	{% set get_params = ('VELOCITY=' + params.VELOCITY)  %}
	{%else %}
	{% set get_params = "" %}
	{% endif %}
	{% if printer.extruder.can_extrude|lower == 'true' %}
	M83
	G1 E{extrude} F2100
	{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
	{% else %}
	{action_respond_info("Extruder not hot enough")}
	{% endif %}
	RESUME_BASE {get_params}

[gcode_macro CANCEL_PRINT]
description = Cancel the actual running print
rename_existing = CANCEL_PRINT_BASE
variable_park = True
gcode = 
	{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
	_TOOLHEAD_PARK_PAUSE_CANCEL
	{% endif %}
	TURN_OFF_HEATERS
	CANCEL_PRINT_BASE

[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description = Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude = 1.0
gcode = 
	{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
	{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
	{% set z_park_delta = 2.0 %}
	{% set max_z = printer.toolhead.axis_maximum.z|float %}
	{% set act_z = printer.toolhead.position.z|float %}
	{% if act_z < (max_z - z_park_delta) %}
	{% set z_safe = z_park_delta %}
	{% else %}
	{% set z_safe = max_z - act_z %}
	{% endif %}
	{% if printer.extruder.can_extrude|lower == 'true' %}
	M83
	G1 E-{extrude} F2100
	{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
	{% else %}
	{action_respond_info("Extruder not hot enough")}
	{% endif %}
	{% if "xyz" in printer.toolhead.homed_axes %}
	G91
	G1 Z{z_safe} F900
	G90
	G1 X{x_park} Y{y_park} F6000
	{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
	{% else %}
	{action_respond_info("Printer not homed")}
	{% endif %}

[gcode_macro BED_MESH_CALIBRATE]
rename_existing = BASE_BED_MESH_CALIBRATE
gcode = 
	BED_MESH_CLEAR
	G1 X125 Y125 Z5 F6000
	BASE_BED_MESH_CALIBRATE
	
	[bed_mesh default]

It’s very much preferred that you attach a log rather than copy pasting a wall of config text.

You’ve used the virtual X endstop pin for both the X and Y stepper.

3 Likes

Or at least put such code fragments between Preformatted text tags:

STRG+F in the config file and then search for the suspect.

As @jakep_82 already explained you used the same pin for X and Y stepper: tmc2209_stepper_x:virtual_endstop

1 Like

I am truly sorry. I will keep this in mind for future problems.
I caught that after I posted this. I changed the pin numbers to the correct ones and it still has the same problem. I am using PB14 for X and PB13 for Y now but it still gives me the same error. I also removed the (!) and put a (^) in its place and the problem persists. I tried removing both the ! and ^ and the problem is still there. The only thing I can figure out is maybe Klipper is seeing the pins used for both the mechanical end stop and virtual end stop but I am not sure how to fix this. I am running Klipper on another printer with the Octopus Pro board and sensorless homing without issues. I am lost at this point. The Spider board doesn’t have the support BTT or Makerbase does and that is the reason I am reaching out to this community. My knowledge is limited to the basics when it comes to Klipper. Thank you for taking a look at my problem.

Great suggestion! Thanks.
I caught the use of the same pin for X and Y and made the change but the problem is stubborn. It was late and I was tired so when I get home today I plan to take another look at it. Thanks for taking the time to help.

Not sure, if you have caught the solution. You have a simple typo in your config:

[stepper_x]
...
endstop_pin: tmc2209_stepper_x:virtual_endstop
...

[stepper_y]
...
endstop_pin: tmc2209_stepper_x:virtual_endstop
...

You are using tmc2209_stepper_x for both axes

1 Like

GREAT CATCH!! I found it just a little while ago. I was really tired when I put this together and fatigue got the best of me. Thank you so much for helping me with this problem!

1 Like

Well, the honor is all at @jakep_82: Pin virtual_endstop used multiple times in config - #2 by jakep_82
I just repeated it, since I had the feeling it got lost.

1 Like

Thanks to all of you!
I was running on three days of 4 hours sleep. I should have waited.
It is up and running!

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.