Can't flash firmware on Ender-6

Basic Information:

Printer Model: Creality Ender-6
MCU / Printerboard: STM32F103
Host / SBC: Raspberry Pi 4

Describe your issue:

I am following the Building and flashing the micro-controller guide.

Used steps from printer-creality-ender6-2020.cfg.
Ran make menuconfig and selected:

  • STMicroelectronics STM32
  • STM32F103
  • 28KiB bootloader
  • Serial (on USART1 PA10/PA9)

All as described in the file.
Saved and exited.
Ran make.
Copied compiled out/klipper.bin onto the SD card (into the root dir).

Shut off the printer, inserted SD card, turned the printer back on… “Creality Ender-6” logo pops up with an empty progress bar at the bottom and nothing happens. Waited for a few minutes… Nothing.

After that point the printer doesn’t boot, even after restarting.

Used the same SD card with the stock firmware from Creality. Logo pops up and after about 10 seconds the progress bar starts to move. Printer is now functional with the stock firmware.

TL;DR: The flashing procedure works with the stock firmware but not with the Klipper firmware.

What am I doing wrong?

Not that it’s of any use, but here is my klippy.log (65.5 KB)

From the log:

Build file /home/pi/klipper/klippy/../out/klipper.dict(8470): Sun Dec 29 23:08:07 2024
Last MCU build version: v0.12.0-404-g80d185c94
Last MCU build tools: gcc: (15:8-2019-q3-1+b1) 8.3.1 20190703 (release) [gcc-8-branch revision 273027] binutils: (2.35.2-2+14+b2) 2.35.2
Last MCU build config: ADC_MAX=4095 BUS_PINS_i2c1=PB6,PB7 BUS_PINS_i2c1a=PB8,PB9 BUS_PINS_i2c2=PB10,PB11 BUS_PINS_spi1=PA6,PA7,PA5 BUS_PINS_spi1a=PB4,PB5,PB3 BUS_PINS_spi2=PB14,PB15,PB13 BUS_PINS_spi3=PB4,PB5,PB3 CLOCK_FREQ=72000000 MCU=stm32f103xe PWM_MAX=255 RECEIVE_WINDOW=192 RESERVE_PINS_serial=PA10,PA9 SERIAL_BAUD=250000 STATS_SUMSQ_BASE=256 STEPPER_BOTH_EDGE=1
Build file /home/pi/klipper/klippy/../out/klipper.elf(1071304): Sun Dec 29 23:08:14 2024
mcu 'mcu': Wait for identify_response
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/serialhdl.py", line 68, in _get_identify_data
    params = self.send_with_response(msg, 'identify_response')
  File "/home/pi/klipper/klippy/serialhdl.py", line 262, in send_with_response
    return src.get_response([cmd], self.default_cmd_queue)
  File "/home/pi/klipper/klippy/serialhdl.py", line 319, in get_response
    self.serial.raw_send_wait_ack(cmds[-1], minclock, reqclock,
  File "/home/pi/klipper/klippy/serialhdl.py", line 254, in raw_send_wait_ack
    self._error("Serial connection closed")
  File "/home/pi/klipper/klippy/serialhdl.py", line 61, in _error
    raise error(self.warn_prefix + (msg % params))
serialhdl.error: mcu 'mcu': Serial connection closed

it seems that Klipper is waiting for an ident response, but is not getting one for obvious reasons… since I can’t flash the firmware.

Anybody out there?

See Issues flashing the printer board for typical issues when flashing the board. The recommendation is to go step by step through each item and, in particular, verify that the MCU is what you expect.

Thanks @Sineos. I am a total newb in this, but this is what I did:

# This file contains pin mappings for the stock 2020 Creality Ender 6.
# To use this config, during "make menuconfig" select the STM32F103
# with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
  • I ran make menuconfig and selected the following:

    • STMicroelectronics STM32
    • STM32F103
    • 28KiB bootloader
    • Serial (on USART1 PA10/PA9)

    Ran make and tried flashing klipper.bin, which makes the printer hang.

  • I’ve verified that my Processor Model is correct:

  • I am not sure how to verify Bootloader offset, Clock reference and Communication interface

  • My flashing method is via the SD card. I’ve verified the SD card is correctly formatted, as I am able to flash the stock firmware with it.

Shooting in the dark, I would say my bootloader offset if wrong? But, how do I know which is the right offset?

Another potentially silly question:

After I’ve attempted to flash the firmware from the SD card, I didn’t see anything happening on the touchscreen, so I’ve assumed the printer hung. But, maybe that’s by design…

So, should the touchscreen on the printer be responsive after I load the Klipper firmware?

The settings you posted above should match. Also the bootloader offset of 28KiB should be correct. DO NOT play with other offsets as this might make your situation quite more complicated.

Klipper does not support this touch screen, so this is to be expected. Klipper’s support for the “traditional” printer screens is quite limited or put differently: These screens do not match Klipper’s philosophy as being operated via much more powerful browser based interfaces or “real” screens that run under Klipperscreen.

Generally your error is indicative of a board that is not properly flashed.
As your settings seem OK, refer to the rest of the items mentioned in the above link, like SD card, USB cable etc.

When you attempt another flash of the firmware especially take note of:

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

SD card is OK. I’ve used it several times to flash the stock firmware. USB cable is not applicable in my situation.

Tried that too.

Oh well, that makes more sense. :smile: I’ve been expecting some sort of confirmation on the touchscreen like with most other firmwares. And not seeing one, assumed the printer hung… It didn’t dawn on me to try connect with Klipper in this state.

So, there was no problem in the first place. :sweat_smile:

Thanks @Sineos.

One small suggestion is to maybe add a note somewhere for people to not expect a working touchscreen.