FYSETC / FYSETC_SB_CAN_TOOLHEAD

StealthBurner toolhead CAN bus module for VORON
18 stars 1 forks source link

Does this toolhead PCB require the CAN bus expander? #4

Open OzzieOrca opened 1 year ago

OzzieOrca commented 1 year ago

I've got a Spider V1.1 board and am looking at purchasing this toolhead PCB from https://www.fysetc.com/products/fysetc-sb-can-tool-board-based-on-stm32f072-support-klipper-with-tmc2209-axl345-acceleration-sensor-for-3d-printer-parts?variant=42187842519215.

Is this CAN bus expander required? https://www.fysetc.com/products/fysetc-canbus-expander-module-for-spider-board?variant=42187841994927

In this repo/wiki you've got a bunch of pinouts for the toolhead PCB but not how to connect it to the Spider. https://github.com/FYSETC/FYSETC-SPIDER#can-bus shows using it but for connecting to the Raspberry Pi. I assume it's needed to go from UART to CAN bus? Does the CAN bus expander GND need to be tied to ground?

I'm going to be using the Stealthburner Rapido toolhead and probably leave the Clockwork 1 in place. Looks like the Clockwork 1 might be missing a mounting screw hole? I'll figure something out.

Anything else I should know as far as compatibility? Will I be ok with the V1.1 Spider board?

Either way, updating the docs to mention whether it's required and how to connect would be great :) I could make a PR if needed.

Thanks!

numindast commented 1 year ago

The Spider CAN expander is not required, unless your intention is to operate the Spider via CAN from the Klipper host. My understanding is this is not necessary and not always desirable.

I've got the expander also and it's just going to sit in a box. In my case, I use UART from the Raspberry Pi to the Spider (rather than USB, but either is perfectly acceptable). Add the UCAN to a USB port on your Pi and the other end of the UCAN is the CAN bus to the toolhead. Just wired this up today and it works.

Hope this helps

Kravenovic commented 1 year ago

Hello @numindast, I sincerely apologise for tagging you directly, but I am attempting to set up the SB CAN TH but am failing rather miserably. I am on a spider v2.2, and the connection goes like this RPI > UCAN > SB CAN TH. I followed the FYSETC's guide here but I still can't get the canbus_uuid at all. I've inserted the can0 config into /etc/network/interfaces.d directory too, but nothing works.

May I please ask the steps you took to get yours working? Thanks in advance sir!

numindast commented 1 year ago

Hi - what are you seeing when trying to run the canbus_query.py script? Nothing at all (eg. returns to shell prompt) or a bunch of errors?

Here's the process I followed. I'm probably overexplaining but hopefully if you missed a step you can catch it, or else this could be useful for someone else.

First connecting USB to the RPi from the UCAN. You should be able to lsusb and be able to see the following USB device in the output: Bus 001 Device 003: ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter

If not, try a different USB cable perhaps, or a different USB port on the RPi. The UCAN came out of the box with the "candleLight" firmware so I did not have to flash the UCAN firmware myself. (Important note: the UCAN board does not run Klipper, it runs candleLight.) You won't be able to make progress until that entry is shown above in your lsusb.

You can confirm if your RPi likes the can0 setup by checking with ifconfig and view the output:

can0: flags=193<UP,RUNNING,NOARP>  mtu 16
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 128  (UNSPEC)
        RX packets 14816  bytes 111412 (108.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1164  bytes 6843 (6.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

"UP,RUNNING" is what you want to see here. If it's not running, try sudo ip link set can0 up type can bitrate 500000 (shamelessly stolen from the Voron discord #voron_electronics pinned posts). If that fails, ask in Discord for help, because I don't know.

Next up, connect your toolhead cable (you don't even need to install the PCB to start talking to it). The 4-pin Molex goes on the PCB of course, and the other end - CAN H/L to the appropriate screw terminals, and GND to a V- on your 24v power supply. That's also going to be where the CAN cable's power wires go, V+ and V- as well. You may already have done this, just confirming though. GND or V- need to be connected from both UCAN and the CAN cable to the toolhead.

Also, the 24v power must be turned on to power the toolhead PCB, it will not light up from just the CAN H/L wires. You'll know it's powered up when a red LED goes on near the bottom of the board.

If you haven't yet, here is when you can flash Klipper to the toolhead's MCU. Link to Fysetc's Wiki on that here.

Be sure to follow their steps carefully. It's worth the extra effort.

The RPi should be able to see/report an uninitialized STM32 on the bus. Snag that canbus_uuid, stick it in your printer.cfg (I named mine [mcu toolhead]) and go forth.

Good luck - report back!

Kravenovic commented 1 year ago

Hello @numindast, thank you so much for taking the time to reply me! Running this command ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0 returns this output:

Traceback (most recent call last):
  File "/home/pi/klipper/scripts/canbus_query.py", line 64, in <module>
    main()
  File "/home/pi/klipper/scripts/canbus_query.py", line 61, in main
    query_unassigned(canbus_iface)
  File "/home/pi/klipper/scripts/canbus_query.py", line 21, in query_unassigned
    bustype='socketcan')
  File "/home/pi/klippy-env/lib/python3.7/site-packages/can/interface.py", line 127, in __new__
    return cls(channel, *args, **kwargs)
  File "/home/pi/klippy-env/lib/python3.7/site-packages/can/interfaces/socketcan/socketcan.py", line 594, in __init__
    bind_socket(self.socket, channel)
  File "/home/pi/klippy-env/lib/python3.7/site-packages/can/interfaces/socketcan/socketcan.py", line 459, in bind_socket
    sock.bind((channel,))
OSError: [Errno 19] No such device

When I use lsusb I get this:

pi@mainsailos:~/klipper $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 1d50:614e OpenMoko, Inc.
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I don't see the OpenMoko, Inc. Geschwister Schneider CAN adapter. Based on all the information I received from you, it seems that the problem lies with the fact that I still do not have a can0 interface which is up; despite me configuring the can0 file in /etc/network/interfaces.d

Once again, thank you so much for replying and for the assistance! Hope I can get this working soon!

numindast commented 1 year ago

Hello - the OpenMoko is probably the UCAN. Unplug it and do another lsusb to see if that entry disappears. I'm not sure what it means that the OpenMoko USB descriptor in the output is different. I had the bad fortune not to have any issues so I'm not in a position to have a good idea. If you aren't already on the Voron discord, definitely ask there in the #voron_electronics sub. There are a lot of people there with more experience (and brains!) than me!

I can think of one question: what OS are you operating on your RPi? Is it Raspberry Pi OS? Debian Buster or Debian Bullseye (newer)? I wonder if your Pi really is ready for can0. I don't recall installing anything but I'm using a new Bullseye install from the Pi foundation, and used Kiauh to set up all the "stuff" for me for Klipper (etc).