Skip to main content

CAN Firmware Compilation

Before Flashing

Confirm Current Mode and Operation Path

  • Important Note: If the tool board is currently in Klipper-CAN mode, you can flash it directly via command after compiling the firmware. The command will automatically reset it into Katapult and complete the flashing.
  • Factory State: The board comes pre-flashed with Katapult firmware in CAN mode at a rate of 1M.
  • Status Check (Look at LED): If the onboard LED is blinking (as shown below), it indicates it is in Katapult mode and ready for flashing.
    Loading...
  • Mode Exception: If the LED is not blinking, it means the firmware is not Katapult. You must first re-flash it following the guide in the link below: Click here to flash Katapult firmware

Set DIP Switches and Physical Connection

  1. DIP Switch Setting: Regardless of the current state, please first set the onboard DIP switch to CAN mode and turn the 120Ω switch ON (as shown below).

    Loading...
  2. Device Connection: Use a CAN cable to connect the tool board to a UTOC or a mainboard that already has the bridge firmware flashed. Refer to the image below for wiring:

    Loading...
  3. Critical Check (Termination Resistor): With the system completely powered off, use a multimeter to measure the resistance between the CAN_H and CAN_L pins.

    DeviceInstructions
    Tool BoardFind and install the jumper cap labeled 120Ω.
    MainboardIf connecting to a mainboard, also install its 120Ω jumper cap.
    UTOC ModuleHas a built-in resistor.

    How to Check:

    1. Ensure the system is completely powered off.
    2. Use a multimeter to measure the resistance between CAN-H and CAN-L on the tool board's CAN port.
    3. Result Interpretation:
      • Approx. 60Ω: Normal. Termination resistors at both ends are correctly connected.
      • Approx. 140Ω: Possible reversal of CAN-H and CAN-L connections.
      • Approx. 120Ω: The 120Ω resistor is not installed or there is a broken wire.
      • Approx. 40Ω: There might be extra resistors. Please check intermediate nodes.

Start Compilation

Firmware Compilation Quick Guide

Precautions

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

Switching Users:

  • Standard Systems (Official Raspberry Pi OS, 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 cursor up/down to select menu items
Enter / SpaceConfirm selection, toggle options, or enter submenus
ESCReturn to the previous menu level
QExit the configuration interface
YWhen exiting, press Y to save the configuration if prompted

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
  • The command rm -rf ~/klipper/.config && rm -rf ~/klipper/out deletes previous compilation data and firmware.

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

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

    Loading...
  • Enter the Micro-controller Architecture menu, then select Raspberry Pi RP2040/RP235x and press Enter.

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

    Loading...
  • Select Communication interface, choose: CAN bus.

    Loading...
  • Select (4) CAN RX gpio number, delete 4 and enter 1.

  • Select (5) CAN TX gpio number, delete 5 and enter 0.

    Loading...
  • Select GPIO pins to set at micro-controller startup, enter:
    !gpio5
    warning

    Please enter in English input mode:

    !gpio5
    Loading...
    • Please cross-check with the image above to ensure consistency before proceeding to the next step
  • Press the Q key. When Save configuration appears, press the Y key.
Loading...
  • The configuration should now be saved, and you will exit to the command line interface.
  • Enter the command below to start compilation. This process may take some time.
make -j4
Loading...
  • The compilation is successful if the following content is output at the end.
  • Due to Klipper version differences, the appearance of out/klipper.bin indicates success.
    Linking out/klipper.elf
    Creating bin file out/klipper.bin

Search ID and Flash

Query CANBus UUID

Before Operation
  • It is recommended to perform ID queries and firmware flashing operations when not printing to avoid interfering with the printing process.
  • The Katapult (CANBoot) firmware and Klipper firmware for the same mainboard/toolboard use the same CAN ID.
Prerequisites

Please ensure the following conditions are met, otherwise the CAN ID may not be found normally:

  1. Host CAN network is correctly configured
  2. Toolboard CAN rate is exactly the same as the host (communication will fail if rates differ)
  3. The 1d50:606f device (USB-CAN adapter) is visible after executing the lsusb command.

Search Commands (Choose based on system)

  • Standard Host Search Command
    ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
  • FLY Host Search Command
    python3 ~/klipper/scripts/canbus_query.py can0

Search Result Explanation

Case 1: Mainboard/Toolboard with Klipper Firmware Flashed

  • Display: Shows one CAN ID and prompts Application: Klipper
  • Explanation: The device is running Klipper firmware and can be used directly. This ID could belong to either the mainboard or a toolboard.
  • How to Distinguish: Disconnect the toolboard's CAN cable and search again. If the ID disappears, it belongs to the toolboard; if it remains, it belongs to the mainboard.
Loading...

Case 2: Mainboard + Toolboard Awaiting Flashing

  • Display: Shows two CAN IDs
  • Explanation: The mainboard is running Klipper firmware, and the toolboard is running CanBoot firmware, awaiting flashing.
Loading...

Case 3: UTOC + Toolboard Awaiting Flashing

  • Display: The UTOC itself does not show an ID, only the toolboard's ID is displayed.
  • Explanation: The UTOC acts only as a bridge; ensure the toolboard is in CanBoot mode.
Loading...

Case 4: No ID Displayed

  • Display: No IDs are shown.
  • Possible Reasons:
    1. CAN bus is occupied by Klipper.
    2. Host CAN0 rate configuration is incorrect.
    3. Physical wiring is faulty.
    4. Device is not in CanBoot mode.
Loading...

Important Notes
  • Awaiting Flashing State: When a toolboard is in CanBoot mode, it will show Application: CanBoot and the firmware LED will blink, indicating it is ready for firmware flashing.
  • Handling Occupied IDs: If a device is running Klipper firmware and its ID is already entered in the configuration file, the ID will not be displayed (occupied by Klipper). To make it reappear, you need to comment out that ID in the configuration and perform a complete power cycle.
Troubleshooting

If you cannot query the UUID, please refer to: CAN Troubleshooting Guide

Firmware Flashing

Flashing Command

  1. Replace 241696050c56 in the command below with the UUID you actually queried.
  2. Note: There must be a space after the -u parameter.
python3 ~/klipper/lib/canboot/flash_can.py -u 241696050c56

Confirmation of Successful Flashing

The appearance of the CAN Flash Success prompt indicates successful flashing:

Loading...

Firmware Update

Update Method

When a firmware update is needed, simply:

  1. Recompile the firmware.
  2. Ensure the device CAN ID can be queried (or Klipper is connected to the device).
  3. Execute the same flashing command.
python3 ~/klipper/lib/canboot/flash_can.py -u <MCU ID>

Successful Update Example

Loading...

Confirm Firmware Startup

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