Skip to main content

CAN Firmware Compilation

Start Compilation

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

The following describes how to compile the firmware:

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

    cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfig
  • The rm -rf ~/klipper/.config && rm -rf ~/klipper/out part removes previous compilation data and firmware.

  • make menuconfig starts the firmware compilation configuration. 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 and select Raspberry Pi RP2040/RP235x, then press Enter:

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

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

    Loading...
  • Select GPIO pins to set at microcontroller startup, input: gpio24
    Loading...
  • Press the Q key. When Save configuration appears, press the Y key.
    Loading...
  • The configuration should now be saved, and you should be returned to the command line interface.
  • Enter the following command to start compiling. This will take some time:
make -j4
Loading...
  • The compilation is successful if the output ends with the following content:
  • Due to Klipper version differences, the appearance of out/klipper.bin alone indicates success.
    Linking out/klipper.elf
    Creating bin file out/klipper.bin

Wiring

  • Before flashing firmware, use an XT30 data cable to connect the tool board to the UTOC or a motherboard with bridge firmware. Below is a reference wiring diagram.
    Loading...
  • Ensure that the resistance between CAN H and CAN L is approximately 60Ω when measured with a multimeter in a powered-off state. If it is 120Ω, connect the 120Ω jumper. If it is around 40Ω, remove the jumper.
    Loading...
  • After connecting the tool board to the UTOC or a motherboard with bridge firmware using an XT30 data cable, the LED on the motherboard should start blinking.
Warning
  • If the LED does not blink, reflash the Katapult firmware: Flash Katapult Firmware
  • If the LED does not blink, proceed to the next step only after flashing the Katapult firmware.

Search for ID and Flash

Querying CANBus UUID

Prerequisites
  • It is recommended to perform ID query and firmware flashing operations in a non-printing state 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:

  1. The host's CAN network is correctly configured
  2. The toolboard's CAN baud rate is exactly the same as the host's (inconsistent baud rates will prevent communication)
  3. Executing the lsusb command shows the 1d50:606f device (USB-CAN adapter)

Search Command (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, with the prompt Application: Klipper
  • Explanation: The device is already running Klipper firmware and can be used directly. This ID could belong to the mainboard or the toolboard.
  • Differentiation Method: Disconnect the toolboard's CAN cable and search again. If the ID disappears, it belongs to the toolboard; if the ID remains, it belongs to the mainboard.
Loading...

Case 2: Mainboard + Toolboard Ready for Flashing

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

Case 3: UTOC + Toolboard Ready for Flashing

  • Display: The UTOC itself does not display an ID, only the toolboard's ID is shown
  • 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. The CAN bus is occupied by Klipper
    2. Incorrect baud rate configuration on the host's CAN0 interface
    3. Physical wiring issues
    4. The device is not in CanBoot mode
Loading...

Important Notes
  • Ready for Flashing State: When the toolboard is in CanBoot mode, it will display Application: CanBoot and the firmware LED will blink. Firmware flashing can be performed at this time.
  • ID Occupancy Handling: If a device is already running Klipper firmware and the ID has been entered in the configuration file, the ID will not be shown (occupied by Klipper). To display it again, you need to comment out the ID in the configuration and perform a complete power cycle.
Troubleshooting

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

Firmware Flashing

Flash Command

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

Confirming Successful Flash

A CAN Flash Success prompt indicates successful flashing:

Loading...

Firmware Update

Update Method

When a firmware update is required, 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>

Update Success Example

Loading...

Confirm Firmware Startup

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