Support for new Creality boards 4.2.2 with GD32F303

This worked on my machines (2*ender3 with the GD32 chip). Thank you so much for this!

Glad I was able to help!

Im having this exact issue. Come to find out my 3v2 also has the GD32F303 chip. Im kinda annoyed with it at the moment. Did you get it figured out?

I was just told theres some with a GD32f303 and some with gd2ā€¦ chips was yours the f303? Im about to give it a shot haha

Mine was GD32F303.
I had to try different variations on the USB pins in menuconfig. I think the original STM32 board used custom pins for the USBā€¦ But my board had a dedicated USB chip, so I had to change that setting.

I theorize that with the chip shortages, there may be multiple variations of these boards floating around.

Good Luck

I also seem to have one of the newer boards with a dedicated USB controller. I rolled a firmware with disabled SWD and USB connection and the light turns on and the system attaches a serial device. However, the connection times out. I tried 115200 and 250000 baudrates in the cfg and neither worked. I am extremely confused about what is preventing the printer and the controller from talking.

I get an explicit ā€œtimeout on connectā€ error when the sd card is in the printer when I load mainsail, which I donā€™t think itā€™s supposed to be regardless. Any help is appreciated.

Works for me. Ender 3 Pro with CRTouch board V4.2.2 chip GD32F303 RET6
Is simple, just follow this:

This file contains pin mappings for the stock 2020 Creality Ender 3

Pro 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.

It should be noted that newer variations of this printer shipping in

2022 may have GD32F103 chips installed and not STM32F103. You may

have to inspect the mainboard to ascertain which one you have. If it

is the GD32F103 then please select Disable SWD at startup in the

ā€œmake menuconfigā€ along with the same settings for STM32F103.

so

  1. ssh pi@192.168.0.142 # your RPI IP
  2. cd ~/klipper/
  3. make menuconfig

Captură de ecran la 2023-01-24 20-10-47
5. make
6. On computer open FileZilla and connect to RPI at your IP address user pi/ your passwors/ port 22.
7. Browse on RPI /home/pi/klipper/out/klipper.bin and copy to sd card.
8. run ā€œls /dev/serial/by-id/*ā€ and result have to be similar ā€œ/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0ā€ this have to be pasted in printer.cfg at [mcu] section.
9. If receive a error about mcu not rady or something like this, then delete the space betwin : and / (serial:/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0), strange but for me works.
10. for inspiration hire is my cfg file.

This file contains pin mappings for the stock 2020 Creality Ender 3

Pro 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.

It should be noted that newer variations of this printer shipping in

2022 may have GD32F103 chips installed and not STM32F103. You may

have to inspect the mainboard to ascertain which one you have. If it

is the GD32F103 then please select Disable SWD at startup in the

ā€œmake menuconfigā€ along with the same settings for STM32F103.

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: probe:z_virtual_endstop

position_endstop: 0.0

position_max: 200

[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 34.406
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: 0
max_temp: 250

[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

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

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100

[bltouch]
sensor_pin: ^PB1
control_pin: PB0
x_offset: -45.5
y_offset: -10
z_offset: 0

[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 5, 5
mesh_max: 200, 200
probe_count: 5,5
algorithm: bicubic
fade_start: 1
fade_end: 10
fade_target: 0

[display]
lcd_type: st7920
cs_pin: PB12
sclk_pin: PB13
sid_pin: PB15
encoder_pins: ^PB14, ^PB10
click_pin: ^!PB2

[screws_tilt_adjust]
screw1_name: Middle
screw1: 155,122.5
screw2: 70.5,37.5
screw2_name: front left screw
screw3: 235,37.5
screw3_name: front right screw
screw4: 235,207.5
screw4_name: rear right screw
screw5: 70.5,207.5
screw5_name: rear left screw
horizontal_move_z: 10
speed: 50
screw_thread: CW-M4

I got a new USB cable and the error has changed. Iā€™m using the firmware that @Arketype prepared as we seem to have the same board. This is extremely confusing because the firmware is definitely loaded and the pi definitely detects the printer board but for whatever reason they refuse to talk to each other.

Tail of the klipper log: Build file /home/pi/klipper/klippy/../.config(3105): Wed Jan 25 12:24:58 2023= - Pastebin.com

Edit:

I got a brand-new monoprice USB cable today and tried that. It still didnā€™t work, but I at least got more descriptive errors: mcu 'mcu': Starting serial connectmcu 'mcu': Unable to open serial port: [Errn - Pastebin.com

Edit 2:

The new error was because the serial device ID/path changed. I changed it to the new value and it went back to mostly silent timeouts. I think I will try to reinstall mainsail on the pi, Iā€™m running out of reasons to blame it on the printer/firmware.

Edit 3:

Reinstalling mainsail did not work. Still see the device, but no connection.

Try building it again but changing CONFIG_STM32_SERIAL_USART3=y to CONFIG_STM32_USB_PA11_PA12=y

I canā€™t be certain because I was to the point of trial and error and may have changed the makeconfig before I realized the current build had worked, but itā€™s worth a shot. I couldnā€™t get anything else to work, including Arketypeā€™s build. I also had to use /dev/serial/by-id instead of by-path

The bin attached is the one that worked - I just canā€™t be certain about the current makeconfig
Also included my printer.cfg in case anything in it is useful.

klipper.zip (22.3 KB)

1 Like

That did it! Iā€™m still using by-path, but that got the job done and theyā€™re talking, at least.

Thank you so much!

1 Like

Nice! Thatā€™s a good feeling isnā€™t it?

Just to confirm: did you rebuild with the different serial connection, or did you use my bin?

I used your bin, thank you very much.

Loving klipper. I finally have the precision to print tabletop minis at .08, and can do so quickly.

Now I just need to figure out how to reliably print at that fidelity with the pen colorizer plug-in.

1 Like

Thanks so much for uploading the firmware and config files! I got Klipper working on my Ender - however, Iā€™m trying to set up multiple printers, (currently just an Artillery Genius and an Ender 3 Pro) and the Ender 3 wonā€™t connect to Mainsail. Iā€™ve tried using /serial/by-path/ , since both printers show the same usb ID. Now, if itā€™s just the Ender 3 connected, and I use the /serial/by-id/, it seems to work, but I need the printers to use a different serial connection in order to run them off the same laptop. Does by-path not work yet for this board?

I have the same problem.

See Frequently Asked Questions - Klipper documentation last paragraph by-path. It is the same as by-id, just a different representation on Linux OS level. If it does not work the reason may be somewhere else.

Youā€™ll see I have both /dev/serial/by-id/ and /dev/serial/by-path/ in my printer.cfg, and I can now swap between them without any problem. So long as youā€™re copying the full path correctly, both by-id and by-path should work.

I havenā€™t done this myself, but I believe if youā€™re trying to direct multiple printers from a single host, youā€™ll want a Moonraker instance for each printer. That will give you a different port number when adding the printers to Mainsail/Fluidd.

I used KIAUH for my install, which has an option for adding additional Moonraker instances.

I have tried probably every single combination of settings and coulnā€™t get it to work on my Ender 3 V2 with the 4.2.2 with GD32F303. Every time I try to flash the firmware the screen gets stuck on the Creality logo, which Iā€™ve seen people saying it is normal, is it? And when I try to use status on the terminal I get ā€œPrinter is not readyā€. Iā€™ve tried everything I read here on this thread, if someone could give me some insight I would really appreciate it. Iā€™m new to 3D printing.

1 Like

Check your board and see if you have one of the boards with a dedicated USB controller. If so, then you should just use d00vyā€™s firmware, thatā€™s what worked for me in the end. Otherwise, you need to just keep trying different combinations until ā€“ and this I think is the part people miss ā€“ upon reboot the pi has devices registered to /dev/serial/by-id/. Always reboot the pi between firmware changes, as I donā€™t think the pi recognizes hotplugged serial devices.

Works for me with the d00vyā€™s firmware. HW: Ender 3 pro with 4.2.2 board
Had 2 broken usb cables!
So be carful :wink:

1 Like

Managed to fix it too, after weeks.
The fix wasnā€™t another firmware or cable. The problem was with my Raspberry Pi zero 2. After multiple tries with raspios, ubuntu and octopi, I installed with the provided tool from Raspberryā€™s website, MainsailOS with Moonraker and it worked out of the box!!!