Skip to main content

CAN Firmware Compilation

Start Compilation

Firmware Compilation Quick Guide

Important Notes

  • 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 (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 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
YWhen exiting, press Y to save 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
  • 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 menu Micro-controller Architecture, 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 GPIO pins to set at micro-controller startup, input: gpio17
    Loading...
  • Press the Q key, then Save configuration appears. At this point, press the Y key.
    Loading...
  • The configuration should now be saved, and you should have exited to the command line interface.
  • Enter the following command to start compilation. This will take some time.
make -j4
Loading...
  • Finally, if the output shows the following content, 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

Wiring

  • Before flashing the firmware, connect the tool board to the UTOC or a mainboard with bridge firmware using an XT30 data cable. The reference wiring diagram is shown below.
    Loading...
  • Ensure that the resistance between CAN H and CAN L measures around 60Ω when powered off using a multimeter. If it is 120Ω, connect the 120Ω jumper. If it is around 40Ω, remove the jumper.
    Loading...
  • After connecting the tool board to the UTOR or a mainboard with USB-to-CAN bridge firmware using an XT30 data cable, the LED on the mainboard will flash.
Warning
  • If the LED does not flash, please reflash the katapult firmware: Flash katapult firmware
  • If the LED does not flash, after reflashing the katapult firmware, proceed to the next step.

Search ID and Flash

Query CANBus UUID

Before You Begin
  • It is recommended to perform ID query and firmware flashing operations when not printing to avoid interfering with the printing process.
  • The Katapult (CANBoot) firmware and Klipper firmware on 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 correctly:

  1. The host's CAN network is correctly configured.
  2. The toolboard's CAN baud rate is exactly the same as the host's. (Communication will fail if rates differ.)
  3. The lsusb command shows a device with ID 1d50:606f (USB-CAN adapter).

Search Commands (Choose based on your 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

Scenario 1: Mainboard/Toolboard with Klipper Firmware Already Flashed

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

Scenario 2: Mainboard + Toolboard Awaiting Flashing

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

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

Scenario 4: No ID Displayed

  • Display: No IDs are shown.
  • Possible Causes:
    1. CAN bus is occupied by Klipper.
    2. Incorrect CAN0 baud rate configuration on the host.
    3. Physical wiring issues.
    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 its firmware LED will blink. It is then ready for firmware flashing.
  • Handling Occupied IDs: If a device is already running Klipper firmware and its ID is 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

Confirming Successful Flash

The appearance of the CAN Flash Success prompt indicates a successful flash:

Loading...

Firmware Update

Update Method

When you need to update the firmware, simply:

  1. Recompile the firmware.
  2. Ensure the device's CAN ID can be queried (or that 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...