Skip to main content

CAN Firmware Compilation

Start Compilation

  • You need an upper computer with the klipper service installed Connect via SSH over the network
  • And make sure the device is connected to the upper computer
  • Note: Please use a regular upper computer, such as a Raspberry Pi FLY board, etc. If you are using a modified upper computer, we cannot provide much assistance due to too many issues.
Note
  • Do not use the ROOT user
tip
  • 请确保上位机可以正常联网
  • 固件编译前需要使用SSH通过网络登录上位机
  • 请不要使用串口工具登录上位机

Klipper固件编译配置页面操作说明

tip

请确保键盘输入法为半角模式,即英文模式

  1. 键盘上键,下键,用于上下移动光标来选中菜单项
  2. 确认键Enter 或 空格键Space,用于勾选菜单或进入子菜单
  3. 退出键ESC,用于返回上一级菜单
  4. Q键,用于退出Klipper固件配置页面
  5. Y键,在退出Klipper固件配置页面时,如果有提示,则点击Y键保存配置文件
warning

如果配置页面选项比较少,请先勾选[ ] Enable extra low-level configuration options,用于显示部分隐藏选项

Below is an introduction on how to compile the firmware:

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

    cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfig
  • Where rm -rf ~/klipper/.config && rm -rf ~/klipper/out is to delete previous compilation data and firmware. make menuconfig is for compiling the firmware. After execution, the following interface should appear:

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

  • Enter the menu Micro-controller Architecture and then select Raspberry Pi RP2040 and press Enter

  • Select Bootloader offset, choose: 16KiB bootloader

  • Select Communication interface, choose: CAN bus

  • Select (4) CAN RX gpio number, delete 4 and input 1

  • Select (5) CAN RX gpio number, delete 5 and input 0

  • Select GPIO pins to set at micro-controller startup, input: gpio17

  • Press Q key, then you will see Save configuration, press Y key again

  • Now the configuration should be saved and you are back to the command line interface

  • Input make -j4 to start compilation, it may take a while

  • The compilation is successful if the following output is displayed

    Linking out/klipper.elf
    Creating hex file out/klipper.bin

Search for Devices

  • Please ensure the host machine can connect to the network normally.
  • Please ensure the data cable connecting the lower-level machine to the host machine has data transfer capabilities.
  • After SSH connecting to the host machine, input lsusb and press enter. One of the following three situations may occur:
    • Displays recognized USB devices.
    • Prompts that there is no ls command; you can execute this command to install it:
      sudo apt-get install usbutils
    • No error message, no other information (system issues need to be replaced with a normal system).
  • If there is no reaction after entering lsusb, this indicates a system issue beyond our control, and you need to replace it with a confirmed normal system.
  • If the information circled in the image below appears, you can proceed to the next step.
  • 1d50:606f belongs to the device you will use this time. Ignore the subsequent prompts as system issues may cause them to display incompletely or not at all.
  • If there are two 1d50:606f, you need to determine why there are two and exclude one before restarting the system.
  • Two 1d50:606f will affect subsequent burning and firmware connections, such as for FLY MINI PAD, it is recommended to use only the on-board UTOC and not other CAN bridge devices.
  • If there is no 1d50:606f, please check if the data cable is properly connected and if the firmware has been correctly flashed.
Note

You can proceed to the next step only if there is a 1d50:606f.

Flash Firmware

  • Before flashing the firmware, use an XT30 cable to connect the tool board to UTOC or the motherboard with bridge firmware flashed. Below is a reference wiring diagram.
  • Please check if the DIP switches are set correctly
  • Ensure that the resistance between CAN H and CAN L is around 60Ω when measured with a multimeter in a power-off state. If it is 120Ω, please connect a 120Ω jumper wire. If it is around 40Ω, please remove the jumper wire
tip
  • It is recommended not to perform ID finding and firmware flashing during the printing process.
  • The CAN firmware IDs of the same motherboard or Katapult tool board and Klipper's CAN firmware are completely identical.
warning
  • Ensure that the host machine's CAN network has been configured.
  • Use the command below to search for the CAN ID when lsusb shows 1d50:606f.
  • The tool board CAN rate must be consistent with the host machine, otherwise you cannot find the ID or burn the firmware.
  • Execute the following command to query the CANBus UUID:

    ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
    • After inputting, you will encounter one of the following situations based on your machine. Below are references:

      • First type: When the motherboard has bridge firmware installed, a single ID appears with a prompt Application: Klipper.
      • Second type: When the motherboard has bridge firmware installed and is paired with a tool board that needs firmware burning, two IDs appear.
      • Third type: Using UTOC with a tool board that needs firmware burning.
      • Note: UTOC does not display the ID.
      • Fourth type: No ID prompt, generally due to Klipper occupancy, incorrect CAN0 rate on the host machine, or wiring anomalies.
    • Normally, if the tool board that needs firmware burning is in CANBOOT mode, it will prompt Application: CanBoot, and the corresponding firmware light will blink. At this point, you need to burn the Klipper firmware, otherwise, you cannot connect!!!

    • Note: If the Klipper firmware has already had the ID filled in the configuration, the ID will not be displayed and will be occupied by Klipper. You need to mask the corresponding ID and power off the motherboard completely before restarting.

    warning
    • If no UUID is found, please refer to the documentation below.
    • CAN Issues Collection
  • Firmware Burning

    • Replace 241696050c56 in the command below with the UUID found during the search. Please note there is a space after -u.

      python3 ~/klipper/lib/canboot/flash_can.py -u 241696050c56
    • As shown in the figure below, if CAN Flash Success appears, the burning is successful.

  • If you need to update the firmware, simply re-execute the burning command after compiling the firmware, but ensure that you can find the ID or Klipper is connected.

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

Confirm Firmware Startup

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