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 设置为 1(Top)Klipper Firmware Configuration7CAN TX gpio number 设置为 0(Top)Klipper Firmware Configuration8CAN bus speed 设置为 1000000(Top)Klipper Firmware Configuration9启用 Optimize stepper code for 'step on both edges'(Top)Klipper Firmware Configuration10GPIO pins to set at micro-controller startup 设置为 !gpio5,!gpio19,!gpio24(Top)Klipper Firmware Configuration11GPIO state at micro-controller startup 选择 Not set此项是 FLYOS-Klipper 功能。通常保持
Not set;如需设置全部 GPIO 的启动状态,请先阅读 GPIO 启动状态使用说明。(Top)Klipper Firmware Configuration12按 Q 键退出配置界面(Top)Klipper Firmware Configuration13出现 Save configuration 时按 Y 保存配置QuitSave configuration?(Y)es(N)o(C)ancel -
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 a UTOC or a mainboard with bridge firmware flashed. Below is a reference wiring diagram.
-
Please check whether the DIP switches are set to the correct positions.
Loading... -
Ensure that the resistance between CAN H and CAN L measures approximately
60Ωusing a multimeter with the power disconnected. If it reads120Ω, enable the120ΩDIP switch; if it reads around40Ω, disable the switch.Loading... -
After connecting the tool board to a UTOC or a mainboard with bridge firmware flashed via the XT30 data cable, the LED on the mainboard should blink.
- If the LED does not blink, please reflash the Katapult firmware: Flash Katapult Firmware
- If the LED does not blink, proceed to the next step after flashing the Katapult firmware.
Search for ID and Flash
Querying CANBus UUID
- It is recommended to perform ID queries and firmware flashing in a non-printing state to avoid interrupting the printing process.
- The Katapult (CANBoot) firmware and Klipper firmware on the same motherboard/toolboard use the same CAN ID.
Please ensure the following conditions are met; otherwise, it may not be possible to search for CAN IDs:
- The host computer's CAN network is correctly configured
- The CAN baud rate of the toolboard is exactly the same as that of the host computer (communication will fail if rates differ)
- After executing the
lsusbcommand, the1d50:606fdevice (USB-CAN adapter) is visible
Search Command (Choose based on system)
- Standard host machine search command
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
- FLY host machine search command
python3 ~/klipper/scripts/canbus_query.py can0
Explanation of Search Results
Scenario 1: Motherboard/Toolboard with Klipper Firmware Flashed
- Display Effect: Shows one CAN ID, with the hint
Application: Klipper - Explanation: The device is running Klipper firmware and can be used directly. This ID could belong to the motherboard or the toolboard.
- Differentiation Method: Disconnect the toolboard's CAN connection cable and re-search. If this ID disappears, it belongs to the toolboard; if the ID remains, it belongs to the motherboard.
Scenario 2: Motherboard + Toolboard Ready for Flashing
- Display Effect: Shows two CAN IDs
- Explanation: The motherboard is running Klipper firmware, the toolboard is running CanBoot firmware and waiting to be flashed.
Scenario 3: UTOC + Toolboard Ready for Flashing
- Display Effect: UTOC itself does not display an ID, only the toolboard's ID is shown
- Explanation: UTOC acts only as a bridge. Ensure the toolboard is in CanBoot mode.
Scenario 4: No ID Displayed
- Display Effect: No IDs are displayed
- Possible Reasons:
- CAN bus is occupied by Klipper
- Incorrect baud rate configuration for the host's CAN0
- Physical wiring issues
- Device is not in CanBoot mode
- Ready for Flashing State: When a toolboard is in CanBoot mode, it will show
Application: CanBootand its status LED will flash, indicating firmware can be flashed. - ID Occupied Handling: If a device is running Klipper firmware and its ID has been configured in the configuration file, the ID will not be displayed (occupied by Klipper). To make it visible again, comment out the ID in the configuration and perform a complete power cycle.
If the UUID cannot be queried, please refer to: CAN Troubleshooting Guide
Firmware Flashing
Flash Command
- Replace
241696050c56in the command below with your queried UUID - Note: Ensure there is a space after the
-uparameter
-
FlyOS-FAST 1.3.8 and above or systems with Klipper updated after April 9, 2026, use the new command:
python3 ~/klipper/lib/katapult/flashtool.py -u 241696050c56 -
Older systems (before FAST 1.3.8 or Klipper not updated before April 9, 2026), use the old command:
python3 ~/klipper/lib/canboot/flash_can.py -u 241696050c56
Flash Success Confirmation
Seeing the CAN Flash Success message indicates a successful flash:
Firmware Update
Update Method
When updating the firmware, simply:
- Recompile the firmware
- Ensure the device's CAN ID can be queried (or Klipper is connected to the device)
- Execute the same flash command
-
FlyOS-FAST 1.3.8 and above or systems with Klipper updated after April 9, 2026:
python3 ~/klipper/lib/katapult/flashtool.py -u <MCU ID> -
Older systems (before FAST 1.3.8 or Klipper not updated before April 9, 2026):
python3 ~/klipper/lib/canboot/flash_can.py -u <MCU ID>
Update Success Example
Verify Firmware Startup
- If the firmware starts normally, the LED will light up.
Loading...