Skip to main content

CAN Network Configuration and ID Search

Notes Before Use

  1. Connect the UTOR or a motherboard flashed with CAN bridge firmware to the host computer via USB.
  2. Please log in to the host computer's backend via the network, do not use the serial port.
  3. 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

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.

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 shows Klipper, it means this ID can be used directly.
  • If an ID appears and Application: at the end shows CANBOOT or Katapult, 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:

  1. Run the following command in the host terminal to view the current status of the CAN0 interface:
    ip -details link show can0
  2. In the output information, confirm two key parameters:
    • bitrate: The current CAN communication rate (e.g., 1000000 means 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:

Loading...

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:

  1. Temporarily comment out or delete all configuration paragraphs related to that tool board in printer.cfg.
  2. 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:

  1. Operate only when the entire machine is powered off.
  2. 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.
  3. 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 only 120Ω), it indicates incorrect wiring or termination resistor configuration.

Configuration Rules for Each Device:

Device TypeTermination Resistor RequirementOperation Instructions
CAN Tool BoardRequires 120Ω termination resistorEnable via the onboard jumper or DIP switch.
Motherboard CAN InterfaceRequires 120Ω termination resistorEnable via the onboard jumper or DIP switch.
UTOC-type Converter ModuleHas built-in 120Ω resistorNo need to enable other termination resistors.
Loading...