Klipper setup guide

I have finally got klippered snapmaker original 3D printer.
I introduce “how.”
Btw I could not figure out how to implement self update firmware and its bootloader. So my method needs JTAG cable to re-flash the control board. I mention that the control board uses GD32F105RC and it is compatible to STM32F1XX mcu.

((Klipper Firmware Configuration))
Enable extra low-level configuration options: ON
Micro-controller Architecture: STMicroelectronics STM32
Processor model: STM32F103
Only 100KiB of RAM: OFF
Disable SWD at start up: OFF
Bootloader offset: No bootloader
Clock Reference: 16MHz crystal
Communication interface: Serial on USART1 PA10/PA9
Baud rate for serial port: 460800 (stable value for CH340 chip)
GPIO pins to set at micro-controller startup: Just default

((Re-flash)) I use J-Flash (Segger J-link cable) . this is my .jflash file
AppVersion = 78606
FileVersion = 2
[GENERAL]
aATEModuleSel[24] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
ConnectMode = 0
CurrentFile = “klipper.elf”
DataFileSAddr = 0x08000000
GUIMode = 0
HostName = “”
TargetIF = 1
USBPort = 0
USBSerialNo = 0x00000000
UseATEModuleSelection = 0
[JTAG]
IRLen = 0
MultipleTargets = 0
NumDevices = 0
Speed0 = 1000
Speed1 = 1000
TAP_Number = 0
UseAdaptive0 = 0
UseAdaptive1 = 0
UseMaxSpeed0 = 0
UseMaxSpeed1 = 0
[CPU]
NumInitSteps = 1
InitStep0_Action = “Reset”
InitStep0_Value0 = 0x00000000
InitStep0_Value1 = 0x00000000
InitStep0_Comment = “Reset and halt target”
NumExitSteps = 0
UseScriptFile = 0
ScriptFile = “”
RAMAddr = 0x20000000
RAMSize = 0x00018000
CheckCoreID = 1
CoreID = 0x3BA00477
CoreIDMask = 0x0F000FFF
UseAutoSpeed = 0x00000001
ClockSpeed = 0x00000000
EndianMode = 0
ChipName = “GigaDevice GD32F105RC”
[FLASH]
aRangeSel[1] = 0-127
BankName = “Internal flash”
BankSelMode = 1
BaseAddr = 0x08000000
NumBanks = 1
[PRODUCTION]
AutoPerformsDisconnect = 0
AutoPerformsErase = 1
AutoPerformsProgram = 1
AutoPerformsSecure = 0
AutoPerformsStartApp = 0
AutoPerformsVerify = 0
EnableFixedVTref = 0
EnableTargetPower = 0
EraseType = 3
FixedVTref = 0x00000CE4
MonitorVTref = 0
MonitorVTrefMax = 0x0000157C
MonitorVTrefMin = 0x000003E8
OverrideTimeouts = 0
ProgramSN = 0
SerialFile = “”
SNAddr = 0x00000000
SNInc = 0x00000001
SNLen = 0x00000004
SNListFile = “”
SNValue = 0x00000001
StartAppType = 0
TargetPowerDelay = 0x00000014
TimeoutErase = 0x00003A98
TimeoutProgram = 0x00002710
TimeoutVerify = 0x00002710
VerifyType = 1
[PERFORMANCE]
DisableSkipBlankDataOnProgram = 0x00000000
PerfromBlankCheckPriorEraseChip = 0x00000001
PerfromBlankCheckPriorEraseSelectedSectors = 0x00000001

((printer.cfg))
[include mainsail.cfg]

[virtual_sdcard]
path: /home/shoji/printer_data/gcodes
on_error_gcode: CANCEL_PRINT

[mcu]
serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
baud: 460800
restart_method: command

[printer]
kinematics: cartesian
max_velocity: 140
max_accel:3000
max_z_velocity: 20
max_z_accel: 500
square_corner_velocity:4.0

[stepper_x]
step_pin: PB5
dir_pin: !PB6
enable_pin: !PB7
microsteps: 16
rotation_distance: 8
endstop_pin: ^!PC11
position_endstop: -5
position_min: -5
position_max: 125
homing_speed: 10

[stepper_y]
step_pin: PB8
dir_pin: !PB9
enable_pin: !PB4
microsteps: 16
rotation_distance: 8
endstop_pin: ^!PC10
position_endstop: -5
position_min: -5
position_max: 125
homing_speed: 10

[stepper_z]
step_pin: PB3
dir_pin: !PD2
enable_pin: !PC12
microsteps: 16
rotation_distance: 8
endstop_pin: ^!PA8
#position_endstop: 0
position_min: -8
position_max: 125.5
homing_speed: 10

#[stepper_z2]
#step_pin: PC2
#dir_pin: !PC1
#enable_pin: !PC3
#microsteps: 16
#rotation_distance: 8
#endstop_pin: ^!PC0
#position_endstop: 0
#position_min: -8
#position_max: 125.5
#homing_speed: 10

[extruder]
step_pin: PA4
dir_pin: !PA1
enable_pin: !PA0
microsteps: 16
rotation_distance: 32.3544767893
nozzle_diameter: 0.4
filament_diameter: 1.750
heater_pin: !PB10
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC5
#control: pid
min_temp: -257
max_temp: 230
#pid_Kp: 7
#pid_Ki: 0.5
#pid_Kd: 45
[output_pin LED_R]
pin: mcu:PC7
value:0

[output_pin LED_B]
pin: mcu:PC8
value:0
[output_pin GATE_CTRL]
pin: mcu:PB0
value:1

[output_pin MAIN_POWER]
pin: mcu:PF2
value:1

[output_pin STEPPER_POWER]
pin: mcu:PF1
value:1

[heater_bed]
heater_pin: PA7
sensor_pin: PC4
sensor_type: EPCOS 100K B57560G104F
min_temp: -257
max_temp: 80

[bed_mesh]
speed: 80
horizontal_move_z: 1
mesh_min: 15, 15
mesh_max: 115, 115
probe_count: 3, 3

[input_shaper]
shaper_freq_x: 20
shaper_freq_y: 40

[firmware_retraction]
retract_length: 0.6
retract_speed: 40
unretract_extra_length: 0.0
unretract_speed: 20

[force_move]
enable_force_move: 1

[homing_override]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=1
FORCE_MOVE STEPPER=stepper_z DISTANCE=0.5 VELOCITY=20 ACCEL=100
G28 X0
G28 Y0
G28 Z0
G1 Z10 F3000
G1 X65 Y65

## <---------------------- SAVE_CONFIG ---------------------->
#
# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
##
#
# [heater_bed]
## control = pid
#
# pid_kp = 68.783
## pid_ki = 2.011
#
# pid_kd = 588.090
##
#
# [extruder]
## control = pid
#
# pid_kp = 30.663
## pid_ki = 2.323
#
# pid_kd = 101.187
##
#
# [stepper_z]
## position_endstop = -4.735
#
#
## [bed_mesh default]
#
# version = 1
## points =
#
# 0.260000, 0.010000, -0.140000
## 0.325000, 0.020000, -0.130000
#
# 0.285000, -0.000000, -0.170000
## x_count = 3
#
# y_count = 3
## mesh_x_pps = 2
#
# mesh_y_pps = 2
## algo = lagrange
#
# tension = 0.2
## min_x = 15.0
#
# max_x = 115.0
## min_y = 15.0
#
# max_y = 115.0

4 Likes

This is awesome! How has it performed so far?

I feel that output is stable more than official firmware. because of “input shaping” and “pressure advance.” however speed is limited by the hardware issue mainly cooling fan. for 3D benchy model, maximum speed is around 35mm/s.

good part:

  1. I can print via web browser. official firmware is USB flash. I know that we can use octoprint or luban via USB port however my idea it is unstable. I guess baud rate.
  2. We can add bed mesh from 2x2. I use 3x3.
  3. Klipper allows us to use baby steps while it is printing (Actually Mailsail function).

bad part:

  1. We need JTAG cable (Actually it is not so bad for me).

Now I have touch display port (UART, TX and RX). and one extra stepper motor port (one stepper output and end stop input). So I may make modification of print module. I have E3D V6 clone and Orbiter 2.0 extruder. or maybe filament run out sensor.

Klipper Host is actually small Single Board Computer (FriendlyElec NanoPi NEO2 512MB, Armbian).

Today I compared Air duct mod model for “Original.”
Test data is 3D Hubs Marvin. Same generated GCode.
Blue ducts are crashes when I used official firmware from Snapmaker. because of homing sequence. So I never tested before. Still Orange duct is better.



Hello Shoji,

I am also trying to install Klipper, but have no JTAG Programmer.
Did you try out all Bootloader offset’s during your testing?

Regards
Apper

Hi Apper

I have tried then my controller was bricked. I think the stock firmware has self re-programming functionality, there is not boot loader. I read the source code. It has USB flash memory access and it reads firmware information on USB flash memory.

It is easy to use JTAG. You can also use OpenOCD with FT2232H, I guess.

Okay, am reading the source also (1.7.0.0 and 2.11.0.0).
No Bootloader on a STM32?
Will probe some further and as an option have Beaglebone(s) which have JTAG through their USB.

My understanding:
The firmware is re-programmed by itself. The firmware always check USB flash memory has some firmware file when it boots up. There is No boot loader program. if once you failed to update firmware, then your controller would be bricked. As you know some board has boot loader which can read new firmware file from SD card or USB flash memory.

As you know, Klipper doesn’t have functionality to update the firmware. I think If you don’t go back SM firmware anymore then Just write no boot loader setting Klipper firmware. I believe you will be happy with it.

Okay, Thanks for all the Info!
Wll let you know how i progress.

1 Like

Okay: Klipper firmware flashed with Beaglebone, 2 GPIO pins and Openocd.

printer.cfg spews a lot of errors, so needs some tweaking.
Must be a newer Klipper release generating some config errors.

Hello Shoji,

Do you have the Fan pins for me?
Or a pointer to which file in the firmware contains the pin configuration?

Regards,
Apper

PS:
Found it:
Firmware-Snapmaker-2.11/Marlin_ST_RC6_UDisk/CFile/Marline/Pins.h
PPS: are always on, my 24V PS lost a Phase, fixed that all is good.

This is the bad design which I believe. Original’s hotend fan and part cooling (i guess cooling for extruder stepper motor) are just connected to 24V power supply. You may modify the controller module has two LED signal pins which you can add Fan driver circuit externally by yourself. I guess it is better to use 3rd party controller such as Big Tree Tech if we don’t like the design.

Shoji

Hi Shoij,

Sofar it works, just have problems with PrusaSlicer.
Which Slicer do you use with Klipper and the Snapmaker?

Regards
Apper

I use prusaslicer 2.6.1

My Printer Settings

Size 125x125
Max print height 125
Extruders 1
G-code flaveor Klipper
G-code thumbnails 16x16, 220x124
Format of G-code thumbnails PNG
Supports remaining times YES
Use relative E distances YES
Use firmware retraction YES
Use volumetric E NO
Enable variable layer height feature YES

START G-code begin

M140 S[first_layer_bed_temperature] ; set bed temp
G90 ; use absolute coordinates
M83 ; extruder relative mode
G28
BED_MESH_PROFILE LOAD=default
M190 S[first_layer_bed_temperature]
M104 S[first_layer_temperature] ; set extruder temp
G1 X-1 Y-1 F3000
G1 Z0.4
M109 S[first_layer_temperature] ; wait for extruder temp
G92 E0
G1 X-1 Y-1
G1 E10 F100
G1 X5 Y-1 Z0.2 F600
G1 Z0.5
M221 S100
G92 E0

START G-code end

Emit temperature commands automatically YES

END G-code begin

G1 Z{z_offset+min(max_layer_z+1, max_print_height)} E-5 F2100 ; retract
{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+2, max_print_height)} F200 ; Move print head up{endif}
G1 X0 Y125 Z120 F4200 ; park print head
{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+30, max_print_height)} F200 ; Move print head further up{endif}
G4 ; wait
M104 S0 ; turn off temperature
M140 S0 ; turn off heatbed
M107 ; turn off fan
M221 S100 ; reset flow
M84 E X Y; disable motors

END G-code end

Before layer change G-code begin

G92 E0.0

Before layer change G-code end

How to apply limits Use for time estimate
Maximum feedrate X and Y 140
Maximum feedrate Z 20
Maximum feedrte E 100
Maximum acceleration X and Y 3000
Maximum acceleration Z 500
Maximum acceleration E 3000
Maximum acceleration when extruding 1500
Maximum acceleration when retracting 1500
Maximum jerk X 10
Maximum jerk Y 10
Maximum jerk Z 0.2
Maximum jerk E 2.5
Nozzle diameter 0.4
Layer height limits Min 0.07, Max 0.36
Extruder offset X 0, Y 0
Lift Z 0.25
Only lift Z Above Z 0, Below Z 0
Minimum travel after retraction 1
Retract on layer change YES

Keep having serious stringing problems, with PrusaSlicer.
Seems to me that in Luban you can set stringing but no G10/G11 are generated…

Luban doesn’t support to generate firmware retraction g-code, I think. if you use klipper, then firmware retraction G10/G11 is better than normal retraction.

I am happy with firmware retraction. btw don’t use Gyroid infill pattern. straight line pattern is good with kilpper. I use “Stars.”

Have you tried to use Pressure advance? I use this feature. For PLA, around 0.05 value makes good result.

No Pressure Advance yet.
I still have a problems with oozing and stringing, so need to fix that first.