My printer used to use orange pi zero 3 as the host and CAN bus is used for communication. The low host performance make the print ‘timer too close’ when an ercf v2 is assemblied.
Then I replace it with a NUC and ubuntu server 22.04 is used as the OS. While strange things happened as the CAN network configuration file at ‘/etc/network/interfaces.d/can0’ does not work and the can bus state is down after reboot. The status view just like the picture below:
I registered a service that execute the following command to start up the can0 bus after reboot and the system works temporaly. While the can0 will down after firmware reboot as the hot plug function is not enabled.
ip link set can0 type can bitrate 500000 ip link set up can0 ip link set dev can0 txqueuelen 128 ip link set can0 up
My question is that:
Why the can0 configuration file does not work and how can I find the appropriate locationo of the configuration file.
If the configuration file function not work for ubuntu server 22.04. How can I enable the hot plug function of can0. PS. I have asked this question from the gpt while the answer does not work for me.
PS. I asked the gpt about the configuration file question .It says this may happend as the defalt network management tool is ‘netplan’ and this can be fxed by filling configuration items to netplan configuration file just like xxx.yaml。 I tried and ‘invalid can node’ returned when netplan apply command executed.
I’ve just had the same problem that can0 was not coming up during boot… here is how I fixed it:
(I run Ubuntu 24.04.1 LTS)
To automatically enable all can interfaces, create a file /etc/systemd/network/80-can.network with the following content:
sudo nano /etc/systemd/network/80-can.network
[Match]
Name=can*
[CAN]
BitRate=500K
then restart systemd-networkd sudo systemctl restart systemd-networkd
then set it to auto start on boot sudo systemctl enable systemd-networkd
reboot to test sudo reboot
edit: I think you have a typo in your post, seems there is a capital R in the name interfaces.d… but here is the contents of mine… I run 1M btw but I left the instructions above for 500k to try not to confuse.
more /etc/network/interfaces.d/can0
allow-hotplug can0
iface can0 can static
bitrate 1000000
up ip link set $IFACE txqueuelen 128
oh, I saw another post somewhere suggesting bumping up the txqueuelen to 1024, I really dont know if thats necessary…
Have a great day!!
Thank you so much for your help. I have fixed the typo problem in post. I will try your advice later.
I used to configure the tx queue length to 2048 when timer too close happened(I love big buffer). While the situation is even getting worse. I think the klipper requires a low latency transmit and receive, a buffer size greater than specific size will not make any help. And it seems that a bigger buffer will lead to more latency when can network in unstable state as retransmit happened frequently.
I finally solve the ttc error by reorganize the can network design and replace the cable from main board to ercf by a solid shield cable.
Thank you so much for you advice. The issue is fixed by your reply.
I found a voron docuement described the different configuration of CAN network between two network tools ‘interfaces’ and ‘netplan’. voron_canbus/Getting_Started.md at main · Esoterical/voron_canbus