CAN Network Configuration and ID Search
Notes Before Use
- Connect the UTOR or a motherboard flashed with CAN bridge firmware to the host computer via USB.
- Please log in to the host computer's backend via the network, do not use the serial port.
- If using the FlyOS-FAST system, no CAN configuration is required (the system is preset to 1M rate, 1024 cache).
Check if the Host Computer Supports CAN
If using a FLY host computer, you can skip this step.
Execute the following command to detect kernel CAN support:
sudo modprobe can && echo "Kernel supports CAN" || echo "Kernel does not support CAN"
If "Kernel supports CAN" is displayed, you can proceed with configuration.
Configure CAN0
⚠️ This operation will overwrite the original CAN0 configuration. A system restart is required after completion.
FAST system does not need to execute this!
Choose the corresponding configuration method based on the system type:
- Standard Linux System
- Raspberry Pi System
Standard Linux System
1M Rate Configuration:
sudo /bin/sh -c "cat > /etc/network/interfaces.d/can0" << EOF
allow-hotplug can0
iface can0 can static
bitrate 1000000
up ifconfig \$IFACE txqueuelen 1024
pre-up ip link set can0 type can bitrate 1000000
pre-up ip link set can0 txqueuelen 1024
EOF
500K Rate Configuration:
Change 1000000 to 500000 in the above command.
Raspberry Pi System
Create a network configuration file (BitRate value can be modified):
sudo tee /etc/systemd/network/99-can.network > /dev/null <<'EOF'
[Match]
Name=can*
[CAN]
BitRate=1000000
RestartSec=100ms
EOF
Create a link configuration file (cache is not recommended to modify):
sudo tee /etc/systemd/network/99-can.link > /dev/null <<'EOF'
[Match]
OriginalName=can*
[Link]
TxQueueLength=1024
EOF
Finally, restart the device:
sudo reboot
Commands to Search for CAN ID
- Standard host computer search command
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0 - FLY host computer search command
python3 ~/klipper/scripts/canbus_query.py can0 - If an ID appears and
Application:at the end showsKlipper, it means this ID can be used directly. - If an ID appears and
Application:at the end showsCANBOOTorKatapult, it means firmware flashing is required before it can be used.Loading...
Error Prompts
- Below are common errors:
- OSError: [Errno 19] No such device
- can.CanError: Failed to transmit: [Errno 100] Network is down
- can.CanError: Failed to transmit: [Errno 105] No buffer space available
- The first one means the host computer cannot find the CAN device (motherboard flashed with USB bridge firmware or UTOC).
- The second one means the host computer has not configured or has misconfigured CAN0.
- The third one means insufficient host computer cache or system issues causing cache crash.
- For the second and third points, refer to the Configure CAN0 section and reconfigure.
Guide and Troubleshooting for Searching Tool Board ID
1. Check and Configure CAN Rate
The CAN communication rate of the tool board firmware must exactly match the configuration of the host computer (host). Otherwise, the device will not be discoverable.
Steps:
- Run the following command in the host terminal to view the current status of the CAN0 interface:
ip -details link show can0 - In the output information, confirm two key parameters:
bitrate: The current CAN communication rate (e.g.,1000000means 1Mbps).TxQueueLength: Transmission queue length / cache size (e.g.,1024).
The image below shows an example of the command output. Please focus on checking if the bitrate parameter within the red box matches your device settings:
2. Exclude System ID Occupation
If the tool board has been flashed with Klipper firmware and its ID has been written into the host configuration file (printer.cfg), this ID will be occupied by the system and will not appear in searches.
Solution:
- Temporarily comment out or delete all configuration paragraphs related to that tool board in
printer.cfg. - After making the changes, you must completely power off the machine and disconnect the power for about 10 seconds, then power it on again.
3. Verify CAN Bus Termination Resistor
- A stable CAN bus network must have
120Ωtermination resistors installed at both physical ends of the line. - It must be ensured that the resistance between CAN-H and CAN-L, measured with a multimeter while powered off, is around
60Ω.
Checking Method:
- Operate only when the entire machine is powered off.
- Use the resistance range of a multimeter to measure the resistance between the CAN-H and CAN-L pins on the motherboard's CAN interface or on the tool board.
- The correct bus resistance should be approximately 60Ω (the result of two
120Ωresistors in parallel). If the measured value deviates significantly (e.g., open circuit or only120Ω), it indicates incorrect wiring or termination resistor configuration.
Configuration Rules for Each Device:
| Device Type | Termination Resistor Requirement | Operation Instructions |
|---|---|---|
| CAN Tool Board | Requires 120Ω termination resistor | Enable via the onboard jumper or DIP switch. |
| Motherboard CAN Interface | Requires 120Ω termination resistor | Enable via the onboard jumper or DIP switch. |
| UTOC-type Converter Module | Has built-in 120Ω resistor | No need to enable other termination resistors. |