Help needed with SKR1.4, TMC5160 and BL Touch Klipper setup

Hi all,

I have a Artirelly Sidewider X1 running a SKR 1.4 with TMC5160 and a BL Touch and a BTT touchscreen so after watching several videos on Youtube about Klipper I decided to give it a go.

I’ve installed Klipper on the Raspeberry and have started looking at how I go configuring the printer.cfg file, but must admit I’m a bit lost here on how I go in configuring it to take into account the BL Touch as well as the TMC5160, I’m also using a Bondtech BMG Extruder and a E3DV6 hotend, I’m currently assuming that for the steppers just renaming them would work but I would rather check here first before I go on a make the magic smoke show up.

As I’m a complete noob with Klipper, any advise on the correct setup would be highly appreciated.

Thanks in advance

It that helps, here my printer.cfg:

This file contains common pin mappings for the BIGTREETECH SKR V1.4

board. To use this config, the firmware should be compiled for the

LPC1768 or LPC1769(Turbo).

See docs/Config_Reference.md for a description of parameters.

[virtual_sdcard]
path: ~/gcode_files

[display_status]

[pause_resume]

[stepper_x]
step_pin: P2.2
dir_pin: P2.6
enable_pin: !P2.1
microsteps: 16
rotation_distance: 40
endstop_pin: !P1.29
position_endstop: 0
position_max: 310
homing_speed: 50

[stepper_y]
step_pin: P0.19
dir_pin: P0.20
enable_pin: !P2.8
microsteps: 16
rotation_distance: 40
endstop_pin: !P1.28
position_endstop: 0
position_max: 310
homing_speed: 50

[stepper_z]
step_pin: P0.22
dir_pin: !P2.11
enable_pin: !P0.21
microsteps: 16
rotation_distance: 8
endstop_pin: endstop_pin: probe:z_virtual_endstop
position_max: 300
position min: -1.5

[extruder]
step_pin: P2.13
dir_pin: !P0.11
enable_pin: !P2.12
microsteps: 16
rotation_distance: 33.500
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: P2.7
sensor_type: EPCOS 100K B57560G104F
sensor_pin: P0.24
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 5
max_temp: 260

#[extruder1]
#step_pin: P1.15
#dir_pin: P1.14
#enable_pin: !P1.16
#heater_pin: P2.4
#sensor_pin: P0.23
#…

[heater_bed]
heater_pin: P2.5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: P0.25
control: pid
pid_Kp: 54.027
pid_Ki: 0.770
pid_Kd: 948.182
min_temp: 0
max_temp: 130

[fan]
pin: P2.3

[mcu]
serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00

[printer]
kinematics: cartesian
max_velocity: 400
max_accel: 500
max_z_velocity: 10
max_z_accel: 100

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

TMC2208 configuration

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

#[tmc2208 stepper_x]
#uart_pin: P1.10
#run_current: 0.800
#hold_current: 0.500
#stealthchop_threshold: 999999

#[tmc2208 stepper_y]
#uart_pin: P1.9
#run_current: 0.800
#hold_current: 0.500
#stealthchop_threshold: 999999

#[tmc2208 stepper_z]
#uart_pin: P1.8
#run_current: 0.650
#hold_current: 0.450
#stealthchop_threshold: 999999

#[tmc2208 extruder]
#uart_pin: P1.4
#run_current: 0.800
#hold_current: 0.500
#stealthchop_threshold: 999999

#[tmc2208 extruder1]
#uart_pin: P1.1
#run_current: 0.800
#hold_current: 0.500
#stealthchop_threshold: 999999

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

TMC5160 configuration

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

[tmc5160 stepper_x]
cs_pin: P1.10
spi_software_miso_pin: P0.5
spi_software_mosi_pin: P1.17
spi_software_sclk_pin: P0.4
run_current: 0.800
hold_current: 0.500
stealthchop_threshold: 999999
diag1_pin: P1.29

[tmc5160 stepper_y]
cs_pin: P1.9
spi_software_miso_pin: P0.5
spi_software_mosi_pin: P1.17
spi_software_sclk_pin: P0.4
run_current: 0.800
hold_current: 0.500
stealthchop_threshold: 999999
diag1_pin: P1.28

[tmc5160 stepper_z]
cs_pin: P1.8
spi_software_miso_pin: P0.5
spi_software_mosi_pin: P1.17
spi_software_sclk_pin: P0.4
run_current: 0.650
hold_current: 0.450
stealthchop_threshold: 999999
diag1_pin: P1.27

[tmc5160 extruder]
cs_pin: P1.4
spi_software_miso_pin: P0.5
spi_software_mosi_pin: P1.17
spi_software_sclk_pin: P0.4
run_current: 0.800
hold_current: 0.500
stealthchop_threshold: 999999
diag1_pin: P1.26

[tmc5160 extruder1]
cs_pin: P1.1
spi_software_miso_pin: P0.5
spi_software_mosi_pin: P1.17
spi_software_sclk_pin: P0.4
run_current: 0.800
hold_current: 0.500
stealthchop_threshold: 999999
diag1_pin: P1.25

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

EXP1 / EXP2 (display) pins

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

[board_pins]
aliases:
# EXP1 header
EXP1_1=P1.30, EXP1_3=P1.18, EXP1_5=P1.20, EXP1_7=P1.22, EXP1_9=,
EXP1_2=P0.28, EXP1_4=P1.19, EXP1_6=P1.21, EXP1_8=P1.23, EXP1_10=<5V>,
# EXP2 header
EXP2_1=P0.17, EXP2_3=P3.26, EXP2_5=P3.25, EXP2_7=P1.31, EXP2_9=,
EXP2_2=P0.15, EXP2_4=P0.16, EXP2_6=P0.18, EXP2_8=, EXP2_10=
# Pins EXP2_1, EXP2_6, EXP2_2 are also MISO, MOSI, SCK of bus “ssp0”

See the sample-lcd.cfg file for definitions of common LCD displays.

[bltouch]
sensor_pin: !P1.27
control_pin: P1.26
x_offset: -43
y_offset: -52
z_offset: 1.5

[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 35,6
mesh_max: 240, 198
probe_count: 5,3

[gcode_macro G29]
gcode:
BED_MESH_CALIBRATE

[safe_z_home]
home_xy_position: 100,100 # Change coordinates to the center of your print bed
speed: 50
z_hop: 10 # Move up 10mm
z_hop_speed: 5

[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
##### set defaults #####
{% set x = params.X|default(230) %} #edit to your park position
{% set y = params.Y|default(230) %} #edit to your park position
{% set z = params.Z|default(10)|float %} #edit to your park position
{% set e = params.E|default(1) %} #edit to your retract length
##### calculate save 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} F2100
G1 Z{z_safe}
G90
G1 X{x} Y{y} F6000

[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} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME

[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT

[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

Ok, seems like going through trial and error I’m starting to understand how it works, my only issue now seems to be related to the BTT touchscreen I’m using as I got it to work for several minutes but now is not showing anything except the screen type whereas I previously managed to get some info displayed.

this is what I’m using and I do have the [board_pins] config section

[display]

lcd_type = st7920

cs_pin = EXP1_4

sclk_pin = EXP1_5

sid_pin = EXP1_3

encoder_pins = ^EXP2_3, ^EXP2_5

click_pin = ^!EXP1_2

[output_pin beeper]

pin: EXP1_1

The BBT’s firmware and Klipper are not really compatible. You will need this firmware and a special [display] configuration to make it work.

Check the Wiki if your combination is already available. If not you will have to figure it out but the examples in the Wiki should give you an idea how.

Thanks for this Sineos, I’ll give a try and report back, for now I can say that I have the same config as the one tested by wildjokerss with the TFT 35V3 E3 and the SKR 1.4, except for the firmware; what I don’t get is why it started working until I did a change on the printer.cfg file that was not even related to the display section.

Below is what I currently have going on for the display and as you can see it matches what is on the Wiki and tested, I’ll use the firmware described in the link.

[board_pins]
aliases: 
	EXP1_1=P1.30, EXP1_3=P1.18, EXP1_5=P1.20, EXP1_7=P1.22, EXP1_9=<GND>,
	EXP1_2=P0.28, EXP1_4=P1.19, EXP1_6=P1.21, EXP1_8=P1.23, EXP1_10=<5V>,
	EXP2_1=P0.17, EXP2_3=P3.26, EXP2_5=P3.25, EXP2_7=P1.31, EXP2_9=<GND>,
	EXP2_2=P0.15, EXP2_4=P0.16, EXP2_6=P0.18, EXP2_8=<RST>, EXP2_10=<NC>

[display]
lcd_type: st7920 
cs_pin: EXP1_4
sclk_pin: EXP1_5
sid_pin: EXP1_3
encoder_pins: ^EXP2_3, ^EXP2_5
click_pin: ^!EXP1_2

I’d recommend the emulated_st7920

[display]
lcd_type: emulated_st7920
spi_software_miso_pin: EXP1_6
spi_software_mosi_pin: EXP1_3
spi_software_sclk_pin: EXP1_5
en_pin: EXP1_4
encoder_pins: ^EXP2_3, ^EXP2_5
click_pin: ^!EXP1_2

will give that a try, thanks

Sineos,

Thank you very much, that did the trick, I did ran into a weird issue for a few minutes where I had white donuts going from left to right on all the screen until I rebooted the machine and all good since on that front. :slight_smile:

Thanks again

1 Like