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 useroot; switch to a regular user:su <username> - FLY Host System (FlyOS-FAST system)
Only supports login asrootuser (password:mellow)
Firmware Compilation Operation Guide
In the Klipper firmware configuration interface, only keyboard operations are supported; the mouse cannot be used.
| Key | Function |
|---|---|
| ↑ / ↓ | Move cursor up/down to select menu items |
| Enter / Space | Confirm selection, check options, or enter submenus |
| ESC | Return to the previous menu |
| Q | Exit the configuration interface |
| Y | If prompted when exiting, press Y to save the configuration |
Starting Firmware Compilation
Below is an introduction on how to compile the firmware:
-
Connect via SSH, enter the following command, and press
Enter:cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfigHere,
rm -rf ~/klipper/.config && rm -rf ~/klipper/outis used to clear previous compilation configurations and firmware;make menuconfigis used to open the Klipper firmware configuration interface. -
Follow the order below to set each item one by one, completing each before moving on to the next.
1启用 Enable extra low-level configuration options(Top)Klipper Firmware Configuration2Micro-controller Architecture 选择 Raspberry Pi RP2040/RP235x(Top)Klipper Firmware Configuration3Processor model 选择 rp2040(Top)Klipper Firmware Configuration4Bootloader offset 选择 16KiB bootloader(Top)Klipper Firmware Configuration5Communication Interface 选择 CAN bus(Top)Klipper Firmware Configuration6CAN RX gpio number 设置为 4(Top)Klipper Firmware Configuration7CAN TX gpio number 设置为 5(Top)Klipper Firmware Configuration8CAN bus speed 默认使用 1M(1000000),无需修改默认 CAN 速率为 1M,对应值
1000000,使用 1M 时无需修改。- 1M:
1000000 - 500K:
500000 - 250K:
250000
请根据上位机的 CAN 网络速率选择;上位机、主板与同一总线上的所有 CAN 设备必须使用相同速率。
(Top)Klipper Firmware Configuration9启用 Optimize stepper code for 'step on both edges'(Top)Klipper Firmware Configuration10GPIO pins to set at micro-controller startup 设置为以下内容Loading...(Top)Klipper Firmware Configuration11按 Q 键退出配置界面(Top)Klipper Firmware Configuration12出现 Save configuration 时按 Y 保存配置QuitSave configuration?(Y)es(N)o(C)ancel - 1M:
-
After completing the last two steps above, press
Qto exit the configuration interface, then pressYto save the configuration. -
Return to the command line and enter the following command, then press
Enterto start compiling:make -j4root@flyos-11e5f8 ~/klipper # make -j4Compiling out/src/../lib/can2040/can2040.oCompiling out/src/generic/canserial.oCompiling out/src/generic/canbus.oCompiling out/src/../lib/fast-hash/fasthash.oCompiling out/src/rp2040/hard_pwm.oCompiling out/src/rp2040/spi.oCompiling out/src/rp2040/i2c.oPreprocessing out/src/rp2040/rpxxxx_link.ldBuilding out/compile_time_request.oVersion: XXXXLinking out/klipper.elfCreating bin file out/klipper.bin终端末尾出现
Linking out/klipper.elf和Creating bin file out/klipper.bin,即表示编译成功。 实际编译时,部分 Compiling 行和 Version 会随 Klipper 与系统版本变化。
Wiring
- Before flashing the firmware, use an XT30 data cable to connect the tool board to the UTOC or the mainboard flashed with bridge firmware. Below is the reference wiring diagram.
Loading...
Before starting, completely turn off the printer and disconnect the power supply, and also disconnect any USB connections that may power the CAN nodes. Do not plug or unplug wiring harnesses, adjust the terminal resistors, or touch terminals while the power is on.
The “power-off measurement” here does not mean disconnecting the CAN wires. During measurement, the CAN wires and all nodes on the bus should remain connected in their normal operating configuration; otherwise, what is measured may only represent a single node or a single terminating resistor, which cannot represent the entire CAN bus.
Set the multimeter to the resistance range, and measure the resistance between CAN-H and CAN-L:
| Reference Reading | Judgment and Handling |
|---|---|
Approximately 60Ω | Normal, usually indicating that there is one 120Ω termination resistor at each physical end of the bus |
Approximately 120Ω | Usually only one termination resistor is active; please enable the termination resistor at the other physical end according to the product wiring diagram |
Approximately 40Ω | Usually three termination resistors are active; please disable the redundant termination resistors according to the product wiring diagram |
The above values are for reference only; multimeter accuracy, probe contact, and wiring harness condition can all cause measurement errors. The key to judgment is which range the reading is close to, as well as the trend of reading changes after adjusting the terminal resistor; it is not required to match the values in the table exactly.
- After using an XT30 data cable to connect the tool board to the UTOC or the mainboard flashed with bridge firmware, the LED on the tool board will blink.
- If the LED does not blink, please reflash the Katapult firmware:Flash Katapult Firmware
- If the LED does not blink, please proceed to the next step after flashing the Katapult firmware.
Search for ID and Flash
Query CANBus UUID
- 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.
Please ensure the following conditions are met; otherwise, the CAN ID may not be found properly:
- The host CAN network is correctly configured
- The toolboard CAN baud rate is exactly the same as the host (communication will fail if the baud rates differ)
- After running the
lsusbcommand, the1d50:606fdevice (USB-CAN adapter) is visible
Search Command (select based on your 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 Description
Case 1: Mainboard/Toolboard already flashed with Klipper firmware
- Display: Shows one CAN ID and indicates
Application: Klipper - Description: The device is already running Klipper firmware and can be used directly. This ID may be the mainboard ID or the toolboard ID.
- How to distinguish: First completely power off, disconnect the toolboard's CAN cable, then power on and search again. If the ID disappears, it belongs to the toolboard; if the ID remains, it belongs to the mainboard.
Case 2: Mainboard + Toolboard awaiting flashing
- Display: Shows two CAN IDs
- Description: The mainboard is running Klipper firmware, and the toolboard is running CanBoot firmware, awaiting flashing.
Case 3: UTOC + Toolboard awaiting flashing
- Display: UTOC itself does not show an ID; only the toolboard ID is shown
- Description: UTOC serves only as a bridge; ensure the toolboard is in CanBoot mode.
Case 4: No ID displayed
- Display: No ID is shown at all
- Possible causes:
- The CAN bus is occupied by Klipper
- The host CAN0 baud rate is configured incorrectly
- Physical wiring is abnormal
- The device has not entered CanBoot mode
- Awaiting flash state: When the toolboard is in CanBoot mode, it will show
Application: CanBootand the firmware LED will blink; firmware flashing can be performed at this time. - ID occupation handling: If the device is already running Klipper firmware and the ID has been entered into the configuration file, the ID will not be displayed (occupied by Klipper). To display it again, you need to comment out that ID in the configuration and completely power off and restart.
If the UUID cannot be queried, please refer to: CAN Troubleshooting Guide
Start Flashing
After the CAN firmware compilation is complete, select the flashing method according to the current device status:
您的下位机现在是什么状态
Verify if the Firmware Is Running
- If the firmware starts correctly, the LED will light up.
Loading...