Skip to main content

CAN Firmware Compilation

Start Compiling

Brief Guide to Firmware Compilation

Notes

  • Network: Ensure the host (Raspberry Pi, etc.) is connected to the internet.
  • Login Method: Must log in via SSH over the network; serial port access is disabled.
  • 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.

Switch User:

  • Standard System (Official Raspberry Pi system, etc.)
    Do not use root; switch to a regular user:
    su <username>
  • FLY Host System (FlyOS-FAST system)
    Only supports login as root user (password: mellow)

Firmware Compilation Operation Guide

In the Klipper firmware configuration interface, only keyboard operations are supported; the mouse cannot be used.

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

Starting Firmware Compilation

Below is an introduction on how to compile the firmware:

  1. Connect via SSH, enter the following command, and press Enter:

    cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfig

    Here, rm -rf ~/klipper/.config && rm -rf ~/klipper/out is used to clear previous compilation configurations and firmware; make menuconfig is used to open the Klipper firmware configuration interface.

  2. Follow the order below to set each item one by one, completing each before moving on to the next.

    1启用 Enable extra low-level configuration options
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    2Micro-controller Architecture 选择 STMicroelectronics STM32
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    3Processor model 选择 STM32H723
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    4Bootloader offset 选择 128KiB bootloader
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    5Clock Reference 选择 25 MHz crystal
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    6Communication interface 选择 CAN bus (on PB8/PB9)
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    7CAN bus speed 设置为 1000000
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    8GPIO pins to set at micro-controller startup 设置为 !PA15
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    9GPIO state at micro-controller startup 选择 Not set

    此项是 FLYOS-Klipper 功能。通常保持 Not set;如需设置全部 GPIO 的启动状态,请先阅读 GPIO 启动状态使用说明

    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    10Q 键退出配置界面
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32H723) --->
    Bootloader offset (128KiB bootloader) --->
    Clock Reference (25 MHz crystal) --->
    Communication interface (CAN bus (on PB8/PB9)) --->
    (1000000) CAN bus speed
    (!PA15) GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    11出现 Save configuration 时按 Y 保存配置
    Quit
    Save configuration?
    (Y)es(N)o(C)ancel
  3. After completing the last two steps above, press Q to exit the configuration interface, then press Y to save the configuration.

  4. Return to the command line and enter the following command, then press Enter to start compiling:

    make -j4
    root@flyos-11e5f8 ~/klipper # make -j4
    Compiling out/src/stm32/stm32f0_i2c.o
    Compiling out/src/generic/canserial.o
    Compiling out/src/../lib/fast-hash/fasthash.o
    Compiling out/src/stm32/fdcan.o
    Compiling out/src/generic/canbus.o
    Compiling out/src/stm32/chipid.o
    Compiling out/src/stm32/hard_pwm.o
    Preprocessing out/src/generic/armcm_link.ld
    Building out/compile_time_request.o
    Version: XXXX
    Linking out/klipper.elf
    Creating bin file out/klipper.bin

    终端末尾出现 Linking out/klipper.elf Creating bin file out/klipper.bin,即表示编译成功。 实际编译时,部分 Compiling 行和 Version 会随 Klipper 与系统版本变化。

Wiring

  • Before flashing the firmware, use an XT30 data cable to connect the tool board to the UTOC or a motherboard with bridge firmware flashed. Below is the reference wiring diagram.
  • Please check whether the DIP switches are set to the corresponding positions.
    Loading...
  • UTOC connection reference
    Loading...
  • With the power disconnected, use a multimeter to measure the resistance between CAN H and CAN L. It should be around 60Ω. If it reads 120Ω, you need to connect the 120Ω jumper. If it reads around 40Ω, you need to remove the jumper.
    Loading...
  • After using the XT30 data cable to connect the tool board to the UTOC or a motherboard with bridge firmware flashed, the LED on the motherboard will blink.
Warning
  • If the LED does not blink, please reflash the Katapult firmware: Flash Katapult Firmware
  • If the LED does not blink, after flashing the Katapult firmware, proceed to the next step.

Search for ID and Flash

Querying CANBus UUID

Notes Before Operation
  • It is recommended to perform ID queries and firmware flashing in a non-printing state to avoid interrupting the printing process.
  • The Katapult (CANBoot) firmware and Klipper firmware on the same motherboard/toolboard use the same CAN ID.
Prerequisites

Please ensure the following conditions are met; otherwise, it may not be possible to search for CAN IDs:

  1. The host computer's CAN network is correctly configured
  2. The CAN baud rate of the toolboard is exactly the same as that of the host computer (communication will fail if rates differ)
  3. After executing the lsusb command, the 1d50:606f device (USB-CAN adapter) is visible

Search Command (Choose based on system)

  • Standard host machine search command
    ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
  • FLY host machine search command
    python3 ~/klipper/scripts/canbus_query.py can0

Explanation of Search Results

Scenario 1: Motherboard/Toolboard with Klipper Firmware Flashed

  • Display Effect: Shows one CAN ID, with the hint Application: Klipper
  • Explanation: The device is running Klipper firmware and can be used directly. This ID could belong to the motherboard or the toolboard.
  • Differentiation Method: Disconnect the toolboard's CAN connection cable and re-search. If this ID disappears, it belongs to the toolboard; if the ID remains, it belongs to the motherboard.
Loading...

Scenario 2: Motherboard + Toolboard Ready for Flashing

  • Display Effect: Shows two CAN IDs
  • Explanation: The motherboard is running Klipper firmware, the toolboard is running CanBoot firmware and waiting to be flashed.
Loading...

Scenario 3: UTOC + Toolboard Ready for Flashing

  • Display Effect: UTOC itself does not display an ID, only the toolboard's ID is shown
  • Explanation: UTOC acts only as a bridge. Ensure the toolboard is in CanBoot mode.
Loading...

Scenario 4: No ID Displayed

  • Display Effect: No IDs are displayed
  • Possible Reasons:
    1. CAN bus is occupied by Klipper
    2. Incorrect baud rate configuration for the host's CAN0
    3. Physical wiring issues
    4. Device is not in CanBoot mode
Loading...

Important Notes
  • Ready for Flashing State: When a toolboard is in CanBoot mode, it will show Application: CanBoot and its status LED will flash, indicating firmware can be flashed.
  • ID Occupied Handling: If a device is running Klipper firmware and its ID has been configured in the configuration file, the ID will not be displayed (occupied by Klipper). To make it visible again, comment out the ID in the configuration and perform a complete power cycle.
Troubleshooting

If the UUID cannot be queried, please refer to: CAN Troubleshooting Guide

Firmware Flashing

Flash Command

  1. Replace 241696050c56 in the command below with your queried UUID
  2. Note: Ensure there is a space after the -u parameter
Version Information
  • FlyOS-FAST 1.3.8 and above or systems with Klipper updated after April 9, 2026, use the new command:

    python3 ~/klipper/lib/katapult/flashtool.py -u 241696050c56
  • Older systems (before FAST 1.3.8 or Klipper not updated before April 9, 2026), use the old command:

    python3 ~/klipper/lib/canboot/flash_can.py -u 241696050c56

Flash Success Confirmation

Seeing the CAN Flash Success message indicates a successful flash:

Loading...

Firmware Update

Update Method

When updating the firmware, simply:

  1. Recompile the firmware
  2. Ensure the device's CAN ID can be queried (or Klipper is connected to the device)
  3. Execute the same flash command
Version Information
  • FlyOS-FAST 1.3.8 and above or systems with Klipper updated after April 9, 2026:

    python3 ~/klipper/lib/katapult/flashtool.py -u <MCU ID>
  • Older systems (before FAST 1.3.8 or Klipper not updated before April 9, 2026):

    python3 ~/klipper/lib/canboot/flash_can.py -u <MCU ID>

Update Success Example

Loading...

Verify Whether the Firmware Has Started

  • If the firmware starts normally, the LED will light up.
    Loading...
Loading...