Skip to main content

USB Firmware Compilation

Firmware Compilation Quick Guide

Notes

  • Network: Ensure the host machine (Raspberry Pi, etc.) is connected to the network.
  • Login Method: Must use SSH to log in via the network; disable serial port.
  • Input Method: Keep the keyboard in English half-width mode.

SSH Login and User Switching

Use tools like MobaXterm, PuTTY, etc., to SSH into the host machine.

Switching Users:

  • Standard Systems (Raspberry Pi official system, etc.)
    Do not use root. Switch to a regular user:
    su <username>
  • FLY Host Machine (FlyOS-FAST system)
    Only supports logging in as the root user (password: mellow).

Firmware Compilation Operation Guide

In the Klipper firmware configuration interface, only keyboard operations are supported; mouse usage is not possible.

KeyFunction
↑ / ↓Move the cursor up/down to select menu items
Enter / SpaceConfirm selection, toggle options, or enter submenus
ESCReturn to the previous menu
QExit the configuration interface
YWhen exiting, press Y if prompted to save the configuration

Start Firmware Compilation

The following describes how to compile the firmware:

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

    cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfig
  • Among these, rm -rf ~/klipper/.config && rm -rf ~/klipper/out deletes previous compilation data and firmware.

  • make menuconfig is for compiling the firmware. After execution, the following interface should appear:

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

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

    Loading...
  • Enter the Processor model menu, select STM32F405, and press Enter.

    Loading...
  • Select Bootloader offset, choose: 32KiB bootloader.

    Loading...
  • Communication interface, select: USB (on PA11/PA12).

    Loading...
  • Press the Q key. When Save configuration appears, press the Y key.
    Loading...
  • The configuration should now be saved, and you will exit back to the command line interface.
  • Enter the following command to start compilation. This will take some time.
make -j4
Loading...
  • If the following content is output at the end, the compilation is successful.
  • Due to Klipper version differences, as long as out/klipper.bin appears, it indicates success.
    Linking out/klipper.elf
    Creating bin file out/klipper.bin

Firmware Flashing

Tip

Execute the following command to flash the firmware

fly-flash -d auto -h -f /data/klipper/out/klipper.bin
Loading...
Loading...

Searching for USB ID

  1. Open your browser, enter the IP address of the host computer in the address bar. For example, if the host IP is 192.168.101.179, type it in and press Enter.
Loading...
  1. After accessing the host's WEB interface, find the following in the configuration options on the left sidebar:
  • For fluidd: Click on {…} to enter, then find printer.cfg.
Loading...
  • For mainsail: Click on Machine to enter, then find printer.cfg.
Loading...
  1. Click on printer.cfg to enter, then click on DEVICES in the top right corner.
Loading...
Loading...
  1. Click on SERIAL, then refresh.
  • Refresh in fluidd.
Loading...
  • Refresh in mainsail.
Loading...
  1. Copy the ID. Click on the indicated arrow to copy.
  • In fluidd, ensure ttyACM exists and that Path by ID is present. This is the USB ID.
Loading...
  • In mainsail, ensure ttyACM exists and that Path by ID is present. This is the USB ID.
Loading...

Filling in the USB ID

Danger

The ID shown below is an example and CANNOT be used !!!!

serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
  1. Close the DEVICES window and fill in the ID.
Important
  • In the configuration file, change:
[mcu] 
serial: /tmp/klipper_host_mcu
  • to:
[mcu host] 
serial: /tmp/klipper_host_mcu
  • And add:
[mcu]
serial: <Replace this with the ID you just queried>
  • Find [MCU] in fluidd.
Loading...
  • Find [MCU] in mainsail.
Loading...
  1. Fill the ID into the configuration.
Tip
  • After filling in the ID, click SAVE & RESTART in the top right corner.
Loading...
Loading...
  1. If Klipper prompts ADC out of range, this is normal. Connect the heated bed and thermistor to the mainboard, configure the thermistor pins for the hotend and heated bed, then save and restart.
Danger

Note: All IDs appearing in this document are examples. The actual ID for each mainboard is different. Please fill in the ID you actually obtained.

Loading...