Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ExtNeon/bee6862ad71092278e1c6cf10ba91acd to your computer and use it in GitHub Desktop.
Save ExtNeon/bee6862ad71092278e1c6cf10ba91acd to your computer and use it in GitHub Desktop.
Klipper config, ender 3 with 4.2.2 board (the noisy one)
CONFIG WAS UPDATED - SEE COMMENTS
DEPRECATED
# This file contains pin mappings for the NON stock 2020 Creality Ender 3
# with the 32-bit Creality 4.2.2 board. To use this config, during
# "make menuconfig" select the STM32F103 with a "28KiB bootloader" and
# serial (on USART1 PA10/PA9) communication.
# adapted for my printer ender3-4.2.2 with some modifications and without the BLTouch.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 0
position_max: 235
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_endstop: 0
position_max: 235
homing_speed: 50
[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: ^PA7
#endstop_pin: probe:z_virtual_endstop
position_max: 200
position_min: 0
[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 32.000 #That is 100 steps per mm = full_rotation_steps * microsteps / steps_per_mm
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
control: pid
# tuned for stock hardware with 200 degree Celsius target
pid_Kp: 21.527
pid_Ki: 1.063
pid_Kd: 108.982
min_temp: -30
max_temp: 250
pressure_advance: 0.85
[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
control: pid
# tuned for stock hardware with 50 degree Celsius target
pid_Kp: 54.027
pid_Ki: 0.770
pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PA0
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[board_pins]
aliases:
EXP1_1=PC6,EXP1_3=PB10,EXP1_5=PB14,EXP1_7=PB12,EXP1_9=<GND>,
EXP1_2=PB2,EXP1_4=PB11,EXP1_6=PB13,EXP1_8=PB15,EXP1_10=<5V>,
PROBE_IN=PB0,PROBE_OUT=PB1,FIL_RUNOUT=PC6
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
# Pin mappings for BL_T port
#[bltouch]
#sensor_pin: ^PA7
#control_pin: PB0
#z_offset = 0
#x_offset: -48
#y_offset: 0
#[safe_z_home]
#home_xy_position: 165, 130 # Change coordinates to the center of your print bed
#speed: 50
#z_hop: 10 # Move up 10mm
#z_hop_speed: 5
#[bed_mesh]
#speed: 150
#horizontal_move_z: 7
#mesh_min: 50, 50
#mesh_max: 180, 200
#probe_count: 5, 3
[display]
lcd_type: st7920
cs_pin: PB12
sclk_pin: PB13
sid_pin: PB15
encoder_pins: ^PB14, ^PB10
click_pin: ^!PB2
[gcode_arcs]
resolution = 1.0
[idle_timeout]
gcode:
DISABLE_STEPPER
TURN_OFF_HEATERS
timeout: 600
[gcode_macro DISABLE_STEPPER]
gcode:
M84
[gcode_macro G29]
gcode:
G28
#BED_MESH_CALIBRATE
G1 X2 Y2 Z5 F4000
[menu __main __octoprint __poweroff]
type: command
#enable: !toolhead.is_printing
name: Turn off Octopi
gcode:
{action_respond_info('action:poweroff')}
@luptonma
Copy link

luptonma commented Aug 22, 2022

Thanks for the config file.

It almost worked perfectly with my Ender 3 using a creality 4.2.2 controller board.

I have a CR Touch (BL Touch clone that Creality makes) plugged into the 5 pin header so I had to change the BL Touch sensor pin from ^PA7 to ^PB1. My working BL Touch section looks like this:

[bltouch]
sensor_pin: ^PB1
control_pin: PB0
z_offset = 0
x_offset: -48
y_offset: 0

Hope this helps anyone else looking to configure a BL Touch or CR Touch using the 5 pin connector instead of the split 3:2 style connector with the two pin part plugged into the socket where the Z end stop microswitch was originally attached.

My plan is use the empty Z end stop connection to drive a filament run out sensor . I think it should look something like this:

[filament_switch_sensor RunoutSensor]
pause_on_runout: False
runout_gcode: PAUSE
insert_gcode: RESUME
switch_pin: !PA7

Max L.

@N3XPW
Copy link

N3XPW commented Sep 15, 2022

Thanks for that config.
Im struggeling flashing my Ender3 with the v4.2.2 MB.
Iv tried the make menuconfig with the above give info: STM32F103 & 28kib bootloader & USART1 PA10/PA9 Communication IF.
Flashing it on the Ender doesnt work. The Klipper cant establish an connection to it.

Any suggestions?

@luptonma
Copy link

luptonma commented Sep 16, 2022

Thanks for that config. Im struggeling flashing my Ender3 with the v4.2.2 MB. Iv tried the make menuconfig with the above give info: STM32F103 & 28kib bootloader & USART1 PA10/PA9 Communication IF. Flashing it on the Ender doesnt work. The Klipper cant establish an connection to it.

Any suggestions?

The Creality v4.2.2 won't flash over USB using a "make flash" command. A lot of older 3D printer controller boards don't support make flash.

Once you set things up with make "menuconfig" run

make clean
make

This will create a something.bin file in the /home/pi/klipper/out directory. You need to copy that .bin file to the root of a FAT32 micro SD card and rename it something like "E3Firmware.bin" or something other than the default name. If the .bin file has the same name as the last .bin file flashed to your Creality 3D printer it will ignore the .bin and won't re-flash the Creality controller card. I assume this reduces wear on your Creality controller card flash memory if you neglect to delete the .bin files from the SD card and leave the card in the slot forever after. It probably also avoids overwriting your settings but with Klipper those are all stored in the Printer.cfg file.

Put the SD card in the powered down 4.2.2 board and power it on. The LCD won't show anything, which is a pain and had me convinced it wasn't working. You should see some activity with the LEDs on the 4.2.2 board to show that it at least powered on. Give it a few minutes or then power up the Raspberry Pi which is attached to the 4.2.2 board via USB cable and see if you can access the 4.2.2. board to send g-code moves to jog an axis, home the printer etc. from the Klipper Web interface on the Pi. Note that you can configure the Klipper OS image with your WiFi or other network information before you flash the Pi's OS but DO NOT CHANGE THE Klipper OS USERNAME from "pi" or it will screw things up.

Here is a very verbose description of the whole process:
https://www.raverobot.com/how-to-install-klipper-on-an-ender-3-3d-printer/

To get the LCD to display something you need to add a section for the LCD to your Printer.cfg file
I believe the original Ender 3 used a 12864 LCD controller chip and you can find sample sections for that on the Klipper web page:
https://www.klipper3d.org/Config_Reference.html#display_data
https://www.klipper3d.org/Config_Reference.html#menu

Note: I have not tried to get the LCD to work despite having looked up all the info.

Feel free to let me know how it goes.

Max L.

@Gorlimtouk
Copy link

I have the 256kb chip of (RCT6 instead of RET6). Do i need to make/load any changes?
Creality 4.2.2 Ender 3 Pro. (CR touch changes are easy thanks to @luptonma.
The latest Mainsail (from RaspPi imager) also has extra option at the Make Menu config.
Any advise on these new options?

@ExtNeon
Copy link
Author

ExtNeon commented Feb 13, 2023

I have the 256kb chip of (RCT6 instead of RET6). Do i need to make/load any changes? Creality 4.2.2 Ender 3 Pro. (CR touch changes are easy thanks to @luptonma. The latest Mainsail (from RaspPi imager) also has extra option at the Make Menu config. Any advise on these new options?

You should check schematics for your board. If pin names on the microcontroller are the same, you probably be fine. Also you can just go on and experiment with it, but be prepared for unforseen consequences.

BTW this config is a bit outdated. I've added some pretty neat macros and other stuff you guys probably don't need. I'll paste it ASAP.

@ExtNeon
Copy link
Author

ExtNeon commented Feb 13, 2023

Okay folks, here we go: new version of my config file, use with care!
https://gist.github.com/ExtNeon/e582111d5ffd0a44a0e28c425b5d092b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment