Skip to main content

CAN Firmware Compilation

Start Compiling

  • A host computer with the klipper service installed is required Connect via SSH over the network
  • And the device is connected to the host computer
  • Note: Please use a regular host computer, such as Raspberry Pi FLY. If it is a modified host computer (such as a WiFi stick, Redmi, etc.), due to too many issues, we cannot provide technical support
warning
  • Notes on FlyOS-Armbian system and general system
    • Ordinary host computer systems such as Raspberry Pi, FLY are viewed in this category
    • Do not use the ROOT user for any operations on these host computers
    • Please use a normal user for operations
    • To switch users, for FlyOS-Armbian system use the su fly command to switch to a normal user
    • For other systems, use the su <your host computer username> command to switch to a normal user
    su <your host computer username>

::: tip

  • Please ensure that the host machine can connect to the network normally.
  • Before compiling the firmware, use SSH to log in to the host machine via the network.
  • Do not use a serial port tool to log in to the host machine.

:::

Klipper Firmware Compilation and Configuration Page Operation Instructions

::: tip

Please make sure that the keyboard input method is in half-width mode, i.e., English mode.

:::

  1. The key (up arrow) and (down arrow) on the keyboard are used to move the cursor up and down to select menu items.
  2. The confirm key Enter or spacebar Space is used to check the menu or enter a sub-menu.
  3. The exit key ESC is used to return to the previous menu.
  4. The Q key is used to exit the Klipper firmware configuration page.
  5. When exiting the Klipper firmware configuration page and there is a prompt, press the Y key to save the configuration file.

::: warning

If there are fewer options in the configuration page, please first check [ ] Enable extra low-level configuration options to display some hidden options.

:::

Below is the 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
  • Among them, rm -rf ~/klipper/.config && rm -rf ~/klipper/out is to delete previous compilation data and firmware, make menuconfig is to compile 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/RP235x and press Enter

  • Select Bootloader offset, select: 16KiB bootloader

  • Select Communication interface, select: CAN bus

  • Select GPIO pins to set at micro-controller startup, enter: gpio24
  • Press the Q key, Save configuration appears, then press Y key
  • Now the configuration should be saved and return to the command line interface
  • Enter the following command to start compiling, it takes some time
make -j4
  • If the following content is output, the compilation is successful

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

Wiring

  • Connect the tool board to UTOC or a mainboard with bridge firmware using an XT30 data cable before flashing the firmware, below is the reference wiring diagram
  • Make sure that the resistance of CAN H and CAN L is around 60Ω when power is off, if it is 120Ω, connect the 120Ω jumper, if it is around 40Ω, remove the jumper
  • After connecting the tool board to UTOC or a mainboard with bridge firmware using an XT30 data cable, the mainboard will have LED blinking.
Warning
  • If there is no LED blinking, re-flash the katapult firmware: Flash katapult firmware
  • If there is no LED blinking, perform the next step after flashing the katapult firmware

Search for Devices

  • Please ensure that the host computer can access the Internet normally and ensure that the data cable connecting the lower computer to the host computer has data transmission function.
  • After SSH connecting to the host computer, input lsusb and press Enter. If the information circled in the picture below is displayed, you can proceed to the next step.
    • If there is no feedback information, this is a system problem of the host computer, and we are powerless. You need to replace a confirmed normal system or replace the host computer.
    • If there is no lsusb command prompt, you can execute the following command to install it:
      sudo apt-get install usbutils
  • 1d50:606f belongs to the device you will use this time.
  • Some host computers may not fully display or fail to display due to system problems.
  • If the lsusb command can display the device but there is no 1d50:606f, please try to replace the data cable and connect the motherboard to another USB port on the host computer.
Notice

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

Search ID and Flash

tip
  • It is recommended not to find ID or flash firmware during printing
  • The CAN firmware of the same mainboard or toolboard Katapult and Klipper have exactly the same ID
warning
  • Please ensure that the can network of the host computer is configured
  • When lsusb has 1d50:606f, you can use the following command to search for CAN ID
  • The CAN speed of the toolboard must be consistent with the host computer, otherwise the ID cannot be found and the firmware cannot be burned
  • Execute the following command to query CANBus UUID:

    ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0

    Use this command to search for CAN_ID on the fast system

    python ~/klipper/scripts/canbus_query.py can0
    • After entering, there will be several situations according to your machine, the following are references

      • First type: Mainboard with bridge firmware installed, one ID appears and prompts Application: Klipper
      • Second type: Mainboard with bridge firmware installed and paired with a toolboard that needs to be flashed, two IDs appear
      • Third type: Using UTOC with a toolboard that needs to be flashed
      • Note: UTOC does not display an ID
      • Fourth type: No ID prompt, usually the ID is occupied by Klipper, the CAN0 speed of the host computer is incorrect, or the wiring is abnormal
    • Normally, if the toolboard to be flashed is in CANBOOT mode, it will prompt Application: CanBoot and the corresponding firmware light will blink. At this time, you need to burn the Klipper firmware, otherwise it cannot be connected!!

    • Note: If it is Klipper firmware and the ID has been filled in the configuration, the ID will not be displayed and will be occupied by Klipper. You need to disable the corresponding ID and power off the mainboard completely and restart once.

    warning
    • If you cannot query the UUID, please see the document below
    • CAN problem set

Firmware flashing

  • Replace 241696050c56 in the following command with the UUID you found, note that there is a space after -u

    python3 ~/klipper/lib/canboot/flash_can.py -u 241696050c56
  • As shown in the following figure, if CAN Flash Success appears, the firmware is successfully flashed

Firmware update

  • If you need to update the firmware, just compile the firmware and execute the flashing command again to update the firmware
  • However, make sure you can find the corresponding ID or Klipper is already connected
    python3 ~/klipper/lib/canboot/flash_can.py -u  <MCU ID>

Confirm Firmware is Running

  • If the firmware starts normally, the LED will light up
Loading...
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -