CAN Firmware Compilation
Before Flashing
Confirm Current Mode and Operation Path
- Important Note: If the tool board is currently in Klipper-CAN mode, you can flash it directly via command after compiling the firmware. The command will automatically reset it into
Katapultand complete the flashing. - Factory State: The board comes pre-flashed with
Katapultfirmware in CAN mode at a rate of 1M. - Status Check (Look at LED): If the onboard LED is blinking (as shown below), it indicates it is in
Katapultmode and ready for flashing.Loading... - Mode Exception: If the LED is not blinking, it means the firmware is not
Katapult. You must first re-flash it following the guide in the link below: Click here to flash Katapult firmware
Set DIP Switches and Physical Connection
-
DIP Switch Setting: Regardless of the current state, first set the onboard DIP switch to CAN mode, and turn ON the
120Ωswitch (as shown below).Loading... -
Device Connection: Use a CAN cable to connect the tool board to a UTOC or a mainboard that already has the bridge firmware flashed. Refer to the image below for wiring:
Loading... -
Key Check (Termination Resistor): With the power completely off, use a multimeter to measure the resistance between the CAN_H and CAN_L pins.
Device Operation Instructions Tool Board Find and plug in the jumper cap labeled 120Ω.Mainboard If connected to a mainboard, also plug in its 120Ωjumper cap.UTOC Module Has a built-in resistor. How to Check:
- Ensure the power is completely off.
- Use a multimeter to measure the resistance between CAN-H and CAN-L on the tool board's CAN port.
- Result Judgment:
- Approx. 60Ω: Normal. Termination resistors at both ends are correctly connected.
- Approx. 140Ω: Possibly CAN-H and CAN-L are reversed.
- Approx. 120Ω: The
120Ωresistor is not installed or there is a broken wire. - Approx. 40Ω: There might be an extra resistor. Please check intermediate nodes.
Start Compilation
Firmware Compilation Notes and Operation Guide
Important Notes
- Network Connection: Ensure the host machine (Raspberry Pi, etc.) is connected to the network.
- Access Method: You must log in to the host machine via SSH over the network. Using serial port tools is prohibited.
- User Permissions: Use the correct user account for operations based on the host machine's system type.
- 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
- Standard Host Machine (Armbian)
- FLY Host Machine
Applicable Systems:
- Official Raspberry Pi OS
- Other systems with Klipper installed
User Permission Requirements:
- Do not use the
rootuser for any operations. - You must switch to a standard user for operations.
Switch Command:
-
Other systems (replace
<username>with your username)su <username>
Standard users typically have the necessary compilation permissions. Using the root user may cause permission issues.
Applicable Systems:
- FlyOS-FAST System
Login Information:
- Username:
root - Password:
mellow
The FAST system only has the root user.
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!
| Key | Function Description |
|---|---|
| ↑ ↓ Arrow Keys | Move the cursor up/down to select menu items. |
| Enter or Space | Confirm selection/check menu items or enter submenus. |
| ESC | Return to the previous menu level. |
| Q | Exit the Klipper firmware configuration page. |
| Y | Press Y to save the configuration if prompted when exiting. |
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/outdeletes previous compilation data and firmware. -
make menuconfigis for compiling the firmware. After execution, the following interface should appear:Loading... -
Select Enable extra low-level configuration options and press Enter.
Loading... -
Enter the Micro-controller Architecture menu, then select Raspberry Pi RP2040/RP235x and press Enter.
Loading... -
Select Bootloader offset, choose: 16KiB bootloader.
Loading... -
Select Communication interface, choose: CAN bus.
Loading... -
Select
(4) CAN RX gpio number, delete4and enter1. -
Select
(5) CAN TX gpio number, delete5and enter0.Loading...
- Select GPIO pins to set at micro-controller startup, enter:
!gpio5warningPlease enter in English input mode
!gpio5Loading...- Please compare with the image above to verify, ensure it matches the image above, then proceed to the next step
- Press the
Qkey, Save configuration will appear, then press theYkey.
- The configuration should now be saved, and you will have exited to the command line interface.
- Enter the following command to start compilation. It will take some time.
make -j4
- If the following content is output at the end, the compilation is successful.
- Due to Klipper version differences, as long as
out/klipper.binappears, it indicates success.Linking out/klipper.elf
Creating bin file out/klipper.bin
Search ID and Flash
Search for Devices
- Now that you have successfully logged into the host computer, you can enter
lsusbto search for devices. You may encounter one of the following situations:- If entering
lsusbprompts that thelscommand is not found, you can install the required utility by entering the following command:sudo apt-get install usbutils - If there is no response after entering
lsusb, this is a system issue and cannot be resolved here. You will need to change the system or use a known working system. - If information like that shown in the image below appears, please note that this is only a reference. You only need to confirm that
1d50:606fappears:Loading...
- If entering
1d50:606fis the device you will use in this instance.- If multiple
1d50:606fdevices appear, one must be excluded, as multiple entries may affect subsequent flashing and firmware connection. For example, withFLY MINI PAD, it is recommended to use the onboardUTOCand avoid using other CAN bridges. - If the device does not appear, please check whether the data cable is properly connected and whether the correct firmware has been flashed.
You can proceed to search for the CAN ID only when 1d50:606f appears.
Query CANBus UUID
- It is recommended to perform ID queries and firmware flashing operations when not printing 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, you may not be able to search for the CAN ID normally:
- The host computer's CAN network is correctly configured.
- The toolboard's CAN baud rate is exactly the same as the host computer's. (Communication will fail if rates differ.)
- The
1d50:606fdevice (USB-CAN adapter) is visible after executing thelsusbcommand.
Search Command (Choose Based on System)
- Standard Host
- Fly-FAST System
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
python ~/klipper/scripts/canbus_query.py can0
Search Result Explanation
Case 1: Mainboard/Toolboard with Klipper Firmware Flashed
- Display Effect: Shows one CAN ID and prompts
Application: Klipper. - Explanation: The device is running Klipper firmware and can be used directly. This ID could be either the mainboard ID or the toolboard ID.
- Distinguishing Method: Disconnect the toolboard's CAN cable and search again. If the ID disappears, it belongs to the toolboard; if it remains, it belongs to the mainboard.
Case 2: Mainboard + Toolboard Awaiting Flashing
- Display Effect: Shows two CAN IDs.
- Explanation: The mainboard is running Klipper firmware, and the toolboard is running CanBoot firmware, waiting to be flashed.
Case 3: UTOC + Toolboard Awaiting Flashing
- Display Effect: The UTOC itself does not show an ID, only the toolboard's ID is displayed.
- Explanation: The UTOC acts only as a bridge. Ensure the toolboard is in CanBoot mode.
Case 4: No ID Displayed
- Display Effect: No IDs are displayed.
- Possible Causes:
- CAN bus is occupied by Klipper.
- Host computer's CAN0 baud rate configuration is incorrect.
- Physical wiring is abnormal.
- Device is not in CanBoot mode.
- Awaiting Flashing State: When a toolboard is in CanBoot mode, it will show
Application: CanBootand the firmware LED will blink. At this time, firmware flashing can be performed. - Handling Occupied IDs: 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 block the ID in the configuration and perform a complete power cycle restart.
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
Flashing Success Confirmation
The appearance of the CAN Flash Success prompt indicates successful flashing:
Firmware Update
Update Method
When you need to update the firmware, simply:
- Recompile the firmware.
- Ensure the device's CAN ID can be queried (or Klipper is already connected to the device).
- Execute the same flashing command.
python3 ~/klipper/lib/canboot/flash_can.py -u <MCU ID>
Update Success Example
Confirm Firmware Startup
- If the firmware starts normally, the LED will light up.
Loading...