CAN Firmware Compilation
Start Compilation
Firmware Compilation Quick Guide
Notes
- Network: Ensure the host machine (Raspberry Pi, etc.) is connected to the network.
- Login Method: Must use SSH to log in via the network; disable serial port.
- 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 machine.
Switching Users:
- Standard Systems (Raspberry Pi official system, etc.)
Do not useroot. Switch to a regular user:su <username> - FLY Host Machine (FlyOS-FAST system)
Only supports logging in as therootuser (password:mellow).
Firmware Compilation Operation Guide
In the Klipper firmware configuration interface, only keyboard operations are supported; mouse usage is not possible.
| Key | Function |
|---|---|
| ↑ / ↓ | Move the cursor up/down to select menu items |
| Enter / Space | Confirm selection, toggle options, or enter submenus |
| ESC | Return to the previous menu |
| Q | Exit the configuration interface |
| Y | When exiting, press Y if prompted to save the configuration |
Start Firmware Compilation
The following describes how to compile the firmware:
-
After connecting via SSH, enter the command below and press Enter:
cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfig -
The
rm -rf ~/klipper/.config && rm -rf ~/klipper/outpart deletes previous compilation data and firmware. -
make menuconfigis for firmware compilation. After execution, the following interface should appear:Loading... -
Select Enable extra low-level configuration options and press Enter.
Loading... -
Navigate to the Micro-controller Architecture menu, then select Raspberry Pi RP2040/RP235x and press Enter.
Loading... -
Select Bootloader offset, and choose: 16KiB bootloader.
Loading... -
Select Communication interface, and choose: CAN bus.
Loading... -
Select
(4) CAN RX gpio number, delete4, and enter1. -
Select
(5) CAN TX gpio number, delete5, and enter0.Loading...
- Select GPIO pins to set at micro-controller startup, input: !gpio5,!gpio19,!gpio24
Caution
Please enter
!gpio5,!gpio19,!gpio24in English input mode.Loading...
- Press the
Qkey. When Save configuration appears, press theYkey.
- The configuration should now be saved, and you will exit to the command line interface.
- Enter the command below to start compilation. This process may take some time.
make -j4
- The compilation is successful if the following output appears at the end.
- Due to Klipper version differences, the appearance of
out/klipper.binalone indicates success.Linking out/klipper.elf
Creating bin file out/klipper.bin
Wiring
-
Before flashing the firmware, connect the tool board to the UTOC or a motherboard with bridge firmware using an XT30 data cable. Refer to the wiring diagram below.
-
Ensure the DIP switch is set to the correct position.
Loading... -
Use a multimeter to measure the resistance between CAN H and CAN L while powered off. It should be around
60Ω. If it reads120Ω, enable the120ΩDIP switch. If it reads around40Ω, disable the DIP switch.Loading... -
After connecting the tool board to the UTOC or a motherboard with bridge firmware using an XT30 data cable, the motherboard's LED should blink.
- If the LED does not blink, reflash the katapult firmware: Flash Katapult Firmware
- If the LED does not blink, proceed to the next step only after successfully flashing the katapult firmware.
Search 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 the Klipper firmware on the same mainboard/tool board use the same CAN ID.
Please ensure the following conditions are met; otherwise, the CAN ID may not be found normally:
- The host's CAN network is correctly configured.
- The CAN baud rate of the tool board is exactly the same as the host's. (Communication will fail if rates differ.)
- The
1d50:606fdevice (USB-CAN adapter) is visible after executing thelsusbcommand.
Search Commands (Choose based on system)
- Search command for a standard host
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0 - Search command for a FLY host
python3 ~/klipper/scripts/canbus_query.py can0
Search Result Explanation
Scenario 1: Mainboard/Tool board already flashed with Klipper firmware
- Display: Shows one CAN ID and prompts
Application: Klipper. - Explanation: The device is running Klipper firmware and can be used directly. This ID could belong to either the mainboard or a tool board.
- How to distinguish: Disconnect the CAN cable from the tool board and search again. If the ID disappears, it belongs to the tool board; if it remains, it belongs to the mainboard.
Scenario 2: Mainboard + Tool board awaiting flashing
- Display: Shows two CAN IDs.
- Explanation: The mainboard is running Klipper firmware, and the tool board is running CanBoot firmware, waiting to be flashed.
Scenario 3: UTOC + Tool board awaiting flashing
- Display: The UTOC itself does not show an ID, only the tool board's ID is displayed.
- Explanation: The UTOC acts only as a bridge. Ensure the tool board is in CanBoot mode.
Scenario 4: No ID displayed
- Display: No ID is displayed.
- Possible causes:
- CAN bus is occupied by Klipper.
- Incorrect CAN0 baud rate configuration on the host.
- Physical connection issue.
- Device is not in CanBoot mode.
- Awaiting Flashing State: When a tool board is in CanBoot mode, it will display
Application: CanBootand the firmware LED will blink, indicating it is ready for firmware flashing. - ID Occupancy Handling: If a device is already running Klipper firmware and its ID is entered in the configuration file, the ID will not be displayed (occupied by Klipper). To make it reappear, you need to comment out that ID in the configuration and perform a complete power cycle.
If you cannot query the UUID, please refer to: CAN Troubleshooting Guide
Firmware Flashing
Flashing Command
- Replace
241696050c56in the command below with the UUID you actually queried. - Note: There must be a space after the
-uparameter.
python3 ~/klipper/lib/canboot/flash_can.py -u 241696050c56
Confirmation of Successful Flashing
The appearance of the CAN Flash Success prompt indicates successful flashing:
Firmware Update
Update Method
When a firmware update is needed, simply:
- Recompile the firmware.
- Ensure the device's CAN ID can be queried (or that Klipper is connected to the device).
- Execute the same flashing command.
python3 ~/klipper/lib/canboot/flash_can.py -u <MCU ID>
Successful Update Example
Confirm Firmware Startup
- If the firmware starts normally, the LED will light up.
Loading...