# This file contains common pin mappings for the BigTreeTech SKR 2.
# To use this config, the firmware should be compiled for the
# STM32F407 with a "32KiB bootloader".
# In newer versions of this board shipped in late 2021 the STM32F429
# is used, if this is the case compile for this with a "32KiB bootloader"
# You will need to check the chip on your board to identify which you have.
#
# The "make flash" command does not work on the SKR 2. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR 2
# with that SD card.
# See docs/Config_Reference.md for a description of parameters.
# Note: The initial revision of this board has a flaw that can cause
# damage to itself and other boards. Be sure to verify the board is
# not impacted by this flaw before using it.
[input_shaper]
shaper_freq_x: 47.2
shaper_type_x: mzv
shaper_freq_y: 33.6
shaper_type_y: mzv
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # an example
#[stepper_x]
[stepper_x]
step_pin: PE2
dir_pin: !PE1
enable_pin: !PE3
microsteps: 64
rotation_distance: 40
endstop_pin: !PC1
position_endstop:0
position_max: 300
homing_speed: 50
[stepper_y]
step_pin: PD5
dir_pin: !PD4
enable_pin: !PD6
microsteps: 64
rotation_distance: 40
endstop_pin: !PC3
position_endstop: 0
position_max: 300
homing_speed: 50
[stepper_z]
step_pin: PA15
dir_pin: PA8
enable_pin: !PD1
microsteps: 64
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: 280
homing_retract_dist: 10.0
second_homing_speed: 10
position_min: -10 # enable to use BLTouch
[stepper_z1]
step_pin: PD11
dir_pin: PD10
enable_pin: !PD13
#step_distance: .0025
microsteps: 64
rotation_distance: 8
[extruder]
step_pin: PD15
dir_pin: PD14
enable_pin: !PC7
microsteps: 64
rotation_distance: 7.5
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PB3
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA2
#control: pid
#pid_Kp: 22.2
#pid_Ki: 1.08
#pid_Kd: 114
min_temp: 0
max_temp: 250
#[extruder1]
#step_pin: PD15
#dir_pin: PA8
#enable_pin: !PD1
#heater_pin: PB4
#sensor_pin: PA3
#...
[heater_bed]
heater_pin: PD7
sensor_type: Generic 3950
sensor_pin: PA1
#control: watermark
min_temp: 0
max_temp: 130
[fan]
pin:PB5
[heater_fan fan1]
pin: PB6
#[heater_fan2]
#pin:pb5
# Due to BTT implementing a Marlin-specific safety feature,
# "anti-reversal stepper protection", this pin needs pulling
# high to pass power to stepper drivers and most FETs
[output_pin motor_power]
pin: PC13
value: 1
[mcu]
serial:
/dev/serial/by-id/usb-Klipper_stm32f429xx_35001D001950314D35313220-if00
[printer]
kinematics: corexy
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
########################################
# EXP1 / EXP2 (display) pins
########################################
[board_pins]
aliases:
# EXP1 header
EXP1_1=PC5, EXP1_3=PB1, EXP1_5=PE10, EXP1_7=PE12, EXP1_9=<GND>,
EXP1_2=PB0, EXP1_4=PE9, EXP1_6=PE11, EXP1_8=PE13, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PA6, EXP2_3=PE7, EXP2_5=PB2, EXP2_7=PC4, EXP2_9=<GND>,
EXP2_2=PA5, EXP2_4=PA4, EXP2_6=PA7, EXP2_8=<RST>, EXP2_10=<NC>
# See the sample-lcd.cfg file for definitions of common LCD displays.
########################################
# TMC2209 configuration
########################################
[tmc2209 stepper_x]
uart_pin: PE0
run_current: 0.8
#diag_pin:
stealthchop_threshold: 999999
hold_current: 0.5
interpolate: true
[tmc2209 stepper_y]
uart_pin: PD3
run_current: 0.8
#diag_pin:
stealthchop_threshold: 999999
hold_current: 0.5
interpolate: true
[tmc2209 stepper_z]
Uart_pin: PD0
run_current: 0.08
#diag_pin:
stealthchop_threshold: 999999
hold_current: 0.5
interpolate: true
[tmc2209 stepper_z1]
uart_pin: PD12
run_current: 0.20
#diag_pin:
stealthchop_threshold: 999999
hold_current: 0.5
interpolate: true
[tmc2209 extruder]
uart_pin: PC6
run_current: 0.8
stealthchop_threshold: 999999
hold_current: 0.5
#diag_pin:
interpolate: true
#[tmc2209 extruder1]
#uart_pin: PD12
#run_current: 0.500
# This file provides example configuration for common "RepRap" style
# LCD displays that use EXP1/EXP2 plugs.
# To configure a display from this file, make sure the main
# printer.cfg file has a [board_pins] config section defining pin
# aliases for the EXP1/EXP2 plugs, find the appropriate LCD type in
# this file, and then copy-and-paste that section into printer.cfg.
# See docs/Config_Reference.md for a description of parameters.
######################################################################
# "RepRapDiscount 2004 Smart Controller" type displays
######################################################################
[display]
lcd_type: hd44780
rs_pin: EXP1_4
e_pin: EXP1_3
d4_pin: EXP1_5
d5_pin: EXP1_6
d6_pin: EXP1_7
d7_pin: EXP1_8
encoder_pins: ^EXP2_3, ^EXP2_5
click_pin: ^!EXP1_2
#kill_pin: ^!EXP2_8
[output_pin beeper]
pin: EXP1_1
####################################################################
#plug pins
######################################################################
# Some micro-controller boards and displays use inconsistent labeling
# for the EXP1 and EXP2 headers. The following diagram shows the
# correct location of pin 1 along with ground and power pins on the
# EXP1 and EXP2 plugs:
#
# EXP1: EXP2:
# +-----------------+ +-----------------+
# | o o o o 5V | | o o o o o |
# | 1 o o o GND | | 1 o o o GND |
# +------ ------+ +------ ------+
#
# Some boards may have the cutout in the wrong location. If so, it may
# be possible to carefully pry the plastic header off of the pins with
# a small screwdriver, then correct the orientation and reapply the
# plastic header.
[neopixel my_neopixel]
pin = PE6
chain_count = 8
color_order = RGB
initial_red = 0.9
initial_green = 0.9
initial_blue = 0.9
[bltouch]
sensor_pin: ^PC0
control_pin: PE5
x_offset:0
y_offset: 25
#z_offset: 0.0
pin_move_time: 0.4
[safe_z_home]
home_xy_position: 164,134
speed: 80.0
z_hop: 10.0
z_hop_speed: 10.0
###############################################################################
#
# Mechanical Gantry Calibration
#
# Requires TMC2209 drivers with UART control, some tuning and perhaps
# some printed endstops.
#
# Based on on (depricated) M915 and now alternate G34 from Marlin
# I beleive Prusa use this, certainly there's older videos advising to just
# ram the gantry at full current into the the z-max stops.
#
# It moves the gantry to the top of the travel, drops the current and then
# does a force move to force the steppers to stall against the physical end
# stops, transfering the level of the frame to the gantry.
#
# This is the only way to programatically level a multi-stepper single-driver
# gantry. It may also help with a dual-driver gantry on a bed-slinger design
# or where the plane of the bed is less trustworthy than the frame.
#
# It's particularly risky doing Z_TILT_ADJUST and SCREWS_TILT_CALCULATE
# without a mechanical reference as if one side of the gantry or bed is prone
# to droop, over time both bed and gantry will skew excessively but still read
# as level, so this can help transfer "level" from the frame to the gantry and
# then to the bed.
#
# I don't recommend doing this in a START_PRINT, I call this if a
# SCREWS_TILT_CALCULATE shows some drift, althoughon an Ender 3 type printer
# it's prudent to check the v-slot rollers for correct adjustment if drift is
# observed.
#
# It's probably best to run this and then do SCREWS_TILT_CALCULATE
# until the bed is really level. IF you have dual Z steppers you can then
# use Z_TILT_ADJUST for subsequent leveling of the gantry but make sure you
# use the same points for gantry level as you use in SCREWS_TILT_CALCULATE
#
# It may damage your printer if you do this at too high a current, or don't
# have proper endstops.
#
# HERE BE DRAGONS!
# YOU WERE WARNED!
#
# Here's a video of this in action
# https://www.youtube.com/watch?v=aVdIeIIpUAk
# and the endstops for 2020 v-slot
# https://www.thingiverse.com/thing:4848479
[gcode_macro MECHANICAL_GANTRY_CALIBRATION]
gcode:
### SET THIS DEFAULT CARFULLY - start really low
{% set my_current = params.CURRENT|default(0.12)|float %} ; adjust crash current on the fly :D
###
{% set oldcurrent = printer.configfile.settings["tmc2209 stepper_z"].run_current %} ; TODO: Find runtime current settings
{% set oldhold = printer.configfile.settings["tmc2209 stepper_z"].hold_current %}
{% set x_max = printer.toolhead.axis_maximum.x %}
{% set y_max = printer.toolhead.axis_maximum.y %}
{% set z_max = printer.toolhead.axis_maximum.z %}
{% set fast_move_z = printer.configfile.settings["printer"].max_z_velocity %}
{% set fast_move = printer.configfile.settings["printer"].max_velocity %}
M117 {printer.homed_axes}
{% if printer.homed_axes != 'xyz' %}
G28 #Home All Axes
{% endif %}
G90 ; absolute
G0 X{x_max / 2} Y{y_max / 2} F{fast_move * 30 } ;put toolhead in the center of the gantry
G0 Z{z_max -1} F{fast_move_z * 60 } ; go to the Z-max at speed max z speed
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={my_current} ; drop current on Z stepper
{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={my_current} ; drop current
{% endif %}
G4 P200 ; Probably not necessary, it is here just for sure
SET_KINEMATIC_POSITION Z={z_max - 12} ; Trick printer into beleiving the gantry is 12mm lower than it is
G1 Z{z_max -2} F{6 * 60} ; try to move 10mm up
G4 P200 ; wait
G1 Z{z_max -6} F{6 * 60} ; move 4mm down
G4 P200 ; same as the first one
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={oldcurrent} HOLDCURRENT={oldhold}
{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={oldcurrent} HOLDCURRENT={oldhold} ; reset current
{% endif %}
G1 Z{z_max -30} F{6 * 60} ; move to 30mm below z-max to allow homing movement
G4 P200 ; same as the first one
G28 Z ; we MUST home again as the ganty is really in the wrong place.
[gcode_macro G34]
gcode:
MECHANICAL_GANTRY_CALIBRATION
[menu __main __setup __calib __mech_gantry_calibrate]
type: command
enable: {not printer.idle_timeout.state == "Printing"}
name: G34 Gantry Level
gcode:
G34
[force_move]
enable_force_move: true ; enable FORCE_MOVE and SET_KINEMATIC_POSITION
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BASE_BED_MESH_CALIBRATE
gcode:
#before the original gcode
BED_MESH_CLEAR
QUAD_GANTRY_LEVEL
G1 X125 Y125 Z5 F6000
#the original gcode
BASE_BED_MESH_CALIBRATE
#after the original gcode
[bed_mesh]
speed: 50
horizontal_move_z: 6
mesh_min: 50,50
mesh_max: 240,245
probe_count: 6,5
[virtual_sdcard]
path: ~/gcode_files
[display_status]
[pause_resume]
[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:
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% 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:
## Move head and retract only if not already in the pause state and park set to true
{% 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 park positon for x and y #####
# default is your max posion from your printer.cfg
{% 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 %}
##### calculate save lift position #####
{% 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 %}
##### end of definitions #####
{% 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 %}
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.761875, 0.517500, 0.315000, 0.120000, -0.011250, -0.163125
#*# 0.751250, 0.500625, 0.236250, 0.064375, -0.071250, -0.199375
#*# 0.782500, 0.494375, 0.210625, -0.012500, -0.126875, -0.318125
#*# 0.891875, 0.536250, 0.202500, -0.048125, -0.273125, -0.397500
#*# 1.081875, 0.608125, 0.271875, -0.037500, -0.312500, -0.510625
#*# x_count = 6
#*# y_count = 5
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 50.0
#*# max_x = 240.0
#*# min_y = 50.0
#*# max_y = 245.0
#*#
#*# [bltouch]
#*# z_offset = 1.800
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 28.924
#*# pid_ki = 1.948
#*# pid_kd = 107.380
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 44.152
#*# pid_ki = 0.660
#*# pid_kd = 738.437