Skip to main content

USB Firmware Compilation

Start Compilation

  • A host machine with the installed klipper service is required Connect via SSH over the network
  • Make sure the device is connected to the host machine
  • Note: Please use a regular host machine, such as a Raspberry Pi FLY board, etc. If it's a modified host machine (e.g., WiFi stick, Redmi, etc.), due to too many issues, we cannot provide technical support for these machines
warning
  • To switch from the ROOT user to a regular user, you can enter the command below
  • Do not use the ROOT user
  • For the fly user, you can directly enter: su fly. For non-fly users, please replace <your host machine username> with your host machine's username!
su <your host machine username>

::: tip

  • Please ensure that the host machine can connect to the network normally.
  • Before compiling the firmware, use SSH to log in to the host machine via the network.
  • Do not use a serial port tool to log in to the host machine.

:::

Klipper Firmware Compilation and Configuration Page Operation Instructions

::: tip

Please make sure that the keyboard input method is in half-width mode, i.e., English mode.

:::

  1. The key (up arrow) and (down arrow) on the keyboard are used to move the cursor up and down to select menu items.
  2. The confirm key Enter or spacebar Space is used to check the menu or enter a sub-menu.
  3. The exit key ESC is used to return to the previous menu.
  4. The Q key is used to exit the Klipper firmware configuration page.
  5. When exiting the Klipper firmware configuration page and there is a prompt, press the Y key to save the configuration file.

::: warning

If there are fewer options in the configuration page, please first check [ ] Enable extra low-level configuration options to display some hidden options.

:::

Below is the introduction on how to compile the firmware:

  • After connecting to SSH, enter the following command and press Enter:

    cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfig
  • Where rm -rf ~/klipper/.config && rm -rf ~/klipper/out is to delete previous compilation data and firmware. make menuconfig is to compile the firmware. After execution, the following interface should appear:

  • Select Enable extra low-level configuration options and press Enter

  • Enter the menu Micro-controller Architecture then select STMicroelectronics STM32 and press Enter

  • Enter the menu Processor model, select STM32F072 and press Enter

  • Select Bootloader offset, choose: 8KiB bootloader

  • Communication interface, select: USB (on PA11/PA12) and press Enter

  • Please verify against the following image to ensure it matches before proceeding

  • Press the Q key, and when the Save configuration prompt appears, press Y again.

  • Now the configuration should be saved and you should have returned to the command line interface.

  • Enter make -j4 to start compiling, it will take some time.

  • If the output below is displayed, the compilation is successful.

    Linking out/klipper.elf
    Creating hex file out/klipper.bin
  • Below is the record of the firmware compilation operation process.
Asciinema cast

Entering Burning Mode

Tip

The Katapult firmware has been pre-installed on D5 units produced after September 1, 2024.

  • Connect the main board to the host machine using a Type-C data cable, then double-click the reset button, at which point the LED on the main board will flash.
Warning
  • If there is no flashing LED, please re-burn the Katapult firmware: Burn Katapult Firmware
  • If there is no flashing LED, please execute the next step after burning the Katapult firmware.

Confirm Whether Burning Mode is Entered

  • Ensure that the host machine can connect to the internet normally and that the data cable connecting the host machine and the device has data transfer functionality.
  • After SSH connection to the host machine, enter lsusb and press Enter. If the information circled in the image below is displayed, you can proceed to the next step.
    • If there is no feedback at all, this indicates an issue with the host system, and we cannot help. You need to replace with a confirmed normal system or change the host machine.
    • If the lsusb command is not recognized, you can run this command to install it:
      sudo apt-get install usbutils
  • The ID displayed in the red box can serve as a reference but is not fixed; the suffix stm32f072xx after OpenMoko, Inc. has a judgment basis where XX is variable.
    • Some host machines may display incomplete or no information due to system issues.

Burning Firmware

tip
  • When installing the programming plugin, you need to be connected to the internet. Please ensure that your host computer is already properly connected to the Internet.
  • If it has been installed, there is no need to install it again.

Start Programming

Warning
  • For non-fly host computers, please make sure to execute the following code to install the dependency package for firmware programming! Otherwise, the firmware cannot be programmed!
      cd && git clone https://github.com/Arksine/katapult.git
  • Use this command to install in China
  cd && git clone https://gitee.com/MrCakeFuck/katapult.git
  • Use the following instruction to search for your device ID, and the ID shown in the figure below should appear (note: the ID shown in the figure is for reference only, and each motherboard has a different ID):

    ls /dev/serial/by-id/*
  • To program the firmware, use the following code, and make sure the firmware has been compiled successfully. Please replace <your motherboard ID> with the ID queried in the previous step.

    ~/klippy-env/bin/python ~/katapult/scripts/flashtool.py -d /dev/serial/by-id/<your motherboard ID>

For the fast system, use this command to program, please replace <your motherboard ID> with the ID queried in the previous step.

python ~/katapult/scripts/flashtool.py -d /dev/serial/by-id/<your motherboard ID>

  • Below is a reference:

  • After programming is complete, refer to the following:

Firmware Update

  • Use the following instruction to search for your motherboard ID, and the ID shown in the figure below should appear (note: the ID shown in the figure is for reference only, and each motherboard has a different ID).

    ls /dev/serial/by-id/*
Note

In the figure below, /dev/serial/by-id/usb-katapult_rp2040_E662549553642032-if00 is the motherboard's ID.

  • To update the USB firmware, after compiling the latest firmware, enter the following command to update, please replace <your motherboard ID> with the ID queried in the previous step.

    cd ~/klipper/ && make flash FLASH_DEVICE=<your motherboard ID>

Solution for Incorrect Firmware Burning

  • Power off the motherboard, power on again, and quickly double-click the reset button to re-enter programming mode.
  • Or use the window/host machine to re-burn the katapult firmware burn katapult firmware