Skip to content

Rotule666/canbus-SV08

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Add canbus support to the Sovol SV08

Introduction

On the road to converting one of my SV08 to multi-toolhead using dragonburner, I had to add CAN support to it. I decided to document my process.

Other can to USB adapters can work in the same way, you would need to adapt if you are using another adapter.

Pre-requisites

  • Your SV08 needs to be connected to your local network (either wired or wifi)
  • You need to know your printer ip address
  • You need to know how to ssh into your printer

Bill of material

And if you want to mount your canable on the 2020 extrusion under your SV08 you can use my small housing:

  • 2 x M3x8mm Socket Head Cap Screws
  • 2 x M3 Sliding T Slot Nut for 2020 Extrusion
  • 1 x 3d printed bottomHousing (see stl folder)
  • 1 x 3d printed TopHousing (see stl folder)

Procedure

Hardware setup

  • Install the m3 bolts and the tnuts to the bottomHousing.
  • Install the bottomHousing in the 2020 extrusion and screw it tigth, make sure the cap screws head are well inside the counterbore.
  • Clip the canable in the bottomHousing.
  • Clip the topHousing over the bottomHousing.
  • Connect the USB cable on the free SV08 USB port (underneath the camera usb cable).
  • Connect the Type-C end of the cable to the canable.

Software setup

ssh to your printer and follow the steps in these sections

Setting up a daemon to configure CAN at boot

create a systemD daemon file /etc/systemd/system/can0.service.

sovol@SPI-XI:~$ sudo nano /etc/systemd/system/can0.service

Add the following content to the file and save, you can use your prefered bitrate and txqueuelen, klipper recommends 128 but more doesn't hurt.

[Unit]
Description=Setup CAN interface can0
Wants=network.target
After=network.target

[Service]
Type=oneshot
ExecStartPre=/bin/sh -c "until ip link show can0; do sleep 1; done"
ExecStart=/sbin/ip link set can0 type can bitrate 1000000
ExecStartPost=/sbin/ip link set can0 txqueuelen 128
ExecStartPost=/sbin/ip link set up can0
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Enable your daemon

sovol@SPI-XI:~$ sudo systemctl enable can0.service

Setting up a udev rule to allow hotplug (in case you disconnect/reconnect your canable usb to can adapter)

create a udev rule file to init your canable /etc/udev/rules.d/90-canable.rules.

sovol@SPI-XI:~$ sudo nano /etc/udev/rules.d/90-canable.rules

Add the following content to your udev rule file and save.

ACTION=="add", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="606f", RUN+="/sbin/ip link set can0 type can bitrate 1000000", RUN+="/sbin/ip link set can0 txqueuelen 128", RUN+="/sbin/ip link set up can0"

Reload the udev rules.

sovol@SPI-XI:~$ sudo udevadm control --reload-rules

Test your setup

Reboot your printer

sovol@SPI-XI:~$ sudo reboot

ssh back into your printer and execute this command to show your can interface details

sovol@SPI-XI:~$ ip -details link show can0

the result should look like this, I currently have ERROR-ACTIVE because there is only one node to my CAN bus, CAN requires to have 2 nodes to work properly.

4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 128
    link/can  promiscuity 0 minmtu 0 maxmtu 0
    can state ERROR-ACTIVE restart-ms 0
          bitrate 1000000 sample-point 0.750
          tq 62 prop-seg 5 phase-seg1 6 phase-seg2 4 sjw 1
          gs_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
          clock 48000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

Conclusion

You can now use CAN to add more klipper slaves mcu. Refer to the Klipper documentation.

About

Adding CANbus to Sovol SV08

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published