Can Klipper use a different network than can0

Basic Information:

Printer Model: Modified Ender 3 S1 / Modified Sovol IDEX
MCU / Printerboard: BTT SKR Mini E3 v.3.0 / BTT Octopus 1.1 Pro

Hi,
I have a RPi to control two printers. It is running two instances of Moonraker and two instances of Klipper (one for each printer). With the printers communicating over USB, everything works properly, and I can simultaneously control both. I have converted both printers to Can Bus: the SKR Mini with a UCAN usb-can, and the other with Octopus as the usb-can bridge.

I have created two independent networks, having tried first can3 and can4, then can0 and can1. Networks seem to come up correctly and I can see all the can terminals, however I cannot get Klipper to connect to them when the two are up. The only way to connect is by disconnecting one of the two and resetting the adapters so it shows up as can0.

My question is, is there a limitation on using multiple can networks simultaneously, or am I missing some config to let Klipper know about what controller is in what network?

Thanks

You should include klippy.log which did contain errors about connecting second printer.

Did you set property canbus_interface ?
https://www.klipper3d.org/Config_Reference.html#mcu

@gaolst thanks for replying. Sorry for the klippy.log, at the time as was using one of the printers so couldn’t disconnect to show how both connected would show up in the log. As I said, if I restart everything and connect just one to grab can0, then it works. If I connect both and use udev to assign can0 and can1, then it stops working. Attached are the logs for both printers. Rollover for klippy1.log was done while still connected and working, then powered everything off and restarted everything.
Here are some screen grabs from the RPi:



and the logs:
klippy1.log (145.3 KB)
klippy2.log (204.7 KB)
Hope this can give some insight.

MCU configuration have additional parameter canbus_interface
which by default have value can0
I don’t see that parameter defined in your configs.
So most probably both printers trying to use same interface can0.

That why I did asking about did you try to specify different interfaces for printers by defining property canbus_interface ?

P.S. Most probably with udev rules you can statically bind printers to their interfaces. Like printer 1 - will always be can0, Printer 2 - always can1

That did the trick. Thanks man.
I included the canbus_interface in all the CAN mcu’s and it is working. Guess I will find another use for the RPi and screen I had already ordered :grinning:

Great.
If you did udev rules for static assignment - post them here as a sample, so somebody can use them.

To get udev to assign static network interface to each Canbus, create file in
/etc/udev/rules.d/99-canbus.rules
with the following content according to your devices:

SUBSYSTEM==“net”, ATTRS{idVendor}==“1d50”, ATTRS{idProduct}==“606f”, ATTRS{serial}==“550023000751313133353932”, NAME=“can1”
SUBSYSTEM==“net”, ATTRS{idVendor}==“1d50”, ATTRS{idProduct}==“606f”, ATTRS{serial}==“001900305043571420353339”, NAME=“can0”

You can find the serials and other attributes using dmesg.

So your interfaces come up automatically, create a file in /etc/network/interfaces.d/ for each interface, so you would have the file can0:
allow-hotplug can0
iface can0 can static
bitrate 1000000
up ifconfig $IFACE txqueuelen 1024

and can1:
allow-hotplug can1
iface can1 can static
bitrate 1000000
up ifconfig $IFACE txqueuelen 1024

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.