Skip to main content

USB Bridge CAN Firmware Flashing

Firmware Compilation Notes and Operation Guide

Important Notes

📌 Important Prerequisites
  1. Network Connection: Ensure the host machine (Raspberry Pi, etc.) is connected to the network.
  2. Access Method: You must log in to the host machine via SSH over the network. Using serial port tools is prohibited.
  3. User Permissions: Use the correct user account for operations based on the host machine's system type.
  4. Input Method: Ensure the keyboard input method is set to Half-width mode (English mode).

SSH Login and User Switching

SSH Login to Host Machine

Use an SSH tool (such as MobaXterm, PuTTY, etc.) to log in to the host machine over the network: View Detailed SSH Connection Tutorial

Switch User Based on System Type

Applicable Systems:

  • Official Raspberry Pi OS
  • Other systems with Klipper installed

User Permission Requirements:

  • Do not use the root user for any operations.
  • You must switch to a standard user for operations.

Switch Command:

  • Other systems (replace <username> with your username)

    su <username>
💡 Tip

Standard users typically have the necessary compilation permissions. Using the root user may cause permission issues.


Firmware Compilation Instructions

1. Keyboard Operation Guide

  • In the Klipper firmware configuration page, you can only use the following shortcut keys for operation.
  • You cannot use the mouse directly!
KeyFunction Description
↑ ↓ Arrow KeysMove the cursor up/down to select menu items.
Enter or SpaceConfirm selection/check menu items or enter submenus.
ESCReturn to the previous menu level.
QExit the Klipper firmware configuration page.
YPress Y to save the configuration if prompted when exiting.

Show Hidden Options

⚠️ Show Hidden Options

If there are few options on the configuration page, first check:

[ ] Enable extra low-level configuration options

This option is used to display some hidden configuration options.

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 interface below should appear.

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

    Loading...
  • Enter the Micro-controller Architecture menu, then select STMicroelectronics STM32 and press Enter.

    Loading...
  • Enter the Processor model menu, select STM32F405, and press Enter.

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

    Loading...
  • Select Communication interface, choose: USB to CAN bus bridge (USB on PA11/PA12).

  • Follow the image to select CAN bus interface (CAN bus (on PB8/PB9)) --->.

    Loading...
  • Press the Q key. When Save configuration appears, then press the Y key.
    Loading...
  • The configuration should now be saved, and you should have exited to the command line interface.
  • Enter the command below to start compilation. This will take some time.
make -j4
Loading...
  • Finally, if the output below appears, 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

Firmware Flashing

tip

Execute the following command to flash the firmware

fly-flash -d auto -h -f /data/klipper/out/klipper.bin
Loading...
Loading...

Search for CAN ID

  1. Open a browser and enter the IP address of the host computer in the address bar. For example, if the IP address of my host computer is 192.168.101.179, simply enter it and press Enter.
Loading...
  1. Open the WEB interface of the host computer, and in the configuration options of the left sidebar, find:
  • For fluidd: {…}, click into it to find printer.cfg
Loading...
  • For mainsail: Machine, click into it to find printer.cfg
Loading...
  1. After clicking into printer.cfg, click on DEVICES in the upper right corner.

    Loading...
    Loading...
  2. Click CAN, then refresh.

    • Refresh in fluidd
    Loading...
    • Refresh in mainsail
    Loading...
  3. Copy the ID; click the arrow to copy it.

    • In fluidd, confirm whether the item pointed to by the first arrow is Klipper; if so, click the arrow on the right to copy it.
    Loading...
    • In mainsail, confirm whether the item pointed to by the first arrow is Klipper; if so, click the arrow on the right to copy it.
    Loading...

Fill in CAN ID

  1. Close DEVICES and fill in the ID
Note
  • Please change the following in the configuration file:
[mcu] 
serial: /tmp/klipper_host_mcu

to

[mcu host] 
serial: /tmp/klipper_host_mcu
  • Add:
[mcu]
canbus_uuid: <Replace this with the ID you just looked up>
  • In fluidd, find [MCU]
Loading...
  • In mainsail, find [MCU]
Loading...
  1. Fill the ID into the configuration
tip
  • After filling in the ID, click SAVE & RESTART in the upper right corner.
Loading...
Loading...
  1. If Klipper shows a message ADC out of range, this is normal. Connect the heated bed and thermistor to the mainboard, and configure the thermistor pins for the extruder and heated bed, then save and restart.
dangerous

Note: All IDs shown in the documentation are examples. Each mainboard has a different ID, so please fill in the actual ID you obtained.


Loading...