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 backend through the network, do not use the serial port.
  3. If using the FlyOS-FAST system, CAN configuration is not required (the system is preset with 1M rate, 1024 cache).

Check if the Host Computer Supports CAN

This step can be skipped if using a FLY host computer.

Execute the following command to detect kernel CAN support:

sudo modprobe can && echo "Kernel supports CAN" || echo "Kernel does not support CAN"

If it displays "Kernel supports CAN", you can proceed with the configuration.

Configure CAN0

⚠️ This operation will overwrite the existing CAN0 configuration. The system needs to be restarted after completion.
Not required for the FAST system!

Choose the corresponding configuration method based on the system type:

General 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 in the above command to 500000.

Finally, restart the device:

sudo reboot

Commands for Searching CAN IDs

  • Search command for general host computers
    ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
  • Search command for FLY host computers
    python3 ~/klipper/scripts/canbus_query.py can0
  • If an ID appears and shows Klipper under Application: at the end, this ID can be used directly.
  • If an ID appears and shows CANBOOT or Katapult under Application: at the end, the firmware needs to be flashed before use.
    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 error indicates the host computer cannot find the CAN device (motherboard flashed with USB bridge firmware or UTOC).
  • The second error indicates the host computer has not configured CAN0 or configured it incorrectly.
  • The third error indicates insufficient cache on the host computer or cache crash due to system issues.
  • For the second and third points, refer to configuring CAN0 and reconfigure.

Toolboard ID Search Guide and Troubleshooting

1. Check and Configure CAN Rate

The CAN communication rate of the toolboard firmware must be identical to the configuration of the host computer, otherwise the device will not be discoverable.

Steps:

  1. Run the following command in the host terminal to check 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: The transmit queue length / cache size (e.g., 1024).

The image below shows an example of the command output. Please check if the bitrate parameter inside the red box matches your device settings:

Loading...

2. Exclude System ID Occupancy

If the toolboard has been flashed with the 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 be displayed during the search.

Solution:

  1. Temporarily comment out or delete all configuration sections related to this toolboard in printer.cfg.
  2. After making the changes, you must completely shut down the machine and disconnect the power for about 10 seconds, then power it back on.

3. Verify CAN Bus Termination Resistors

  • A stable CAN bus network must have 120Ω termination resistors installed at both physical ends of the line.
  • Ensure that the resistance measured between CAN-H and CAN-L with a multimeter, when the system is powered off, is approximately 60Ω.

Inspection Method:

  1. Ensure the entire machine is powered off before operating.
  2. Use the resistance setting on a multimeter to measure the resistance between the CAN-H and CAN-L pins on the motherboard CAN interface or the toolboard.
  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 an incorrect wiring or termination resistor configuration.

Configuration Rules for Each Device:

Device TypeTermination Resistor RequirementOperation Instruction
CAN ToolboardRequires 120Ω termination resistorEnable via onboard jumper cap or DIP switch.
Motherboard CAN InterfaceRequires 120Ω termination resistorEnable via onboard jumper cap or DIP switch.
UTOC Type Conversion ModuleBuilt-in 120Ω resistorNo need to enable other termination resistors.
Loading...