Skip to main content

CAN Firmware Compilation

Start Compilation

  • A host computer with the klipper service installed is required. Connect SSH via network
  • And the device should be well connected to the host computer.
  • Note: Please use a common host computer, such as Raspberry Pi, FLY Pi, etc. If it is a modified host computer (such as WiFi stick, Redmi, etc.), due to too many problems with this type of host computer, technical support cannot be provided for you.
Precautions
  • Please do not use the ROOT user.
  • Command to switch users
su fly
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 command below 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 then select Raspberry Pi RP2040 and press Enter

  • Select Bootloader offset, choose: 16KiB bootloader

  • Select Communication interface, choose: CAN bus

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

  • Press Q key, the prompt Save configuration appears, then press Y key

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

  • Input make -j4 to start compilation, it takes some time

  • The final output should look like this for a successful compilation:

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

Search for Devices

  • Please ensure that the host computer can connect to the network normally, and ensure that the data cable connecting the lower computer to the host computer has a data transmission function.
  • After SSH connection to the host computer, enter lsusb and press Enter. If the information circled in the image below appears, you can proceed to the next step.
    • If there is no information feedback, this is a system problem of the host computer. We are powerless in this regard. You need to replace the system with a confirmed normal one or replace the host computer.
    • If the lsusb command is not available, you can execute this command to install it:
      sudo apt-get install usbutils
  • 1d50:6177 belongs to the device you will use this time. The suffix OpenMoko, Inc. stm32f407xx has a certain reference value, but it is not used as a judgment basis.
    • Some host computers may not display the information completely or not display it at all due to system problems.
    • If the device can be displayed when the lsusb command is entered, but 1d50:6177 is not present, please try to replace the data cable and try to connect the motherboard to other USB ports of the host computer.
  • If you have previously performed the above steps and successfully burned the Klipper firmware, and the motherboard is operating normally, but only need to update the Klipper firmware, please directly view the Firmware Update chapter in the menu bar on the right side of this page.
Precautions

The next step can be performed only when 1d50:6177 is present.

Flash Firmware

  • Before flashing the firmware, connect the tool board to UTOC or a mainboard flashed with bridge firmware using an XT30 cable. Below is a reference wiring diagram.
  • Ensure that the CAN H and CAN L have a resistance of around 60Ω when measured with a multimeter in a power-off state. If it reads 120Ω, connect a 120Ω jumper. If it reads around 40Ω, remove the jumper.
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 Boot

  • If the firmware starts up correctly, the LED will light up.