-I’ve tried flashing different firmware to the USB to CAN board. Now I’m running Katapult/Klipper with the latest version from the git [v0.12.0-418-g0114d72a6].
-I’ve tried changing the TRSYNC_TIMEOUT from 0.025 to 0.05 and back again.
-Wires are properly crimped (had a job that was mainly just crimping xD).
-Twisted cables from UCAN to EBB board, pulled, pushed, shaken, flicked during printing. No issues.
-120 Ohm terminations in place.
bytes_invalid counter is only 0 for the printer mainboard MCU (USB).
For the USB to CAN adapter it maxed out at 22, but the EBB42 board continuously increases…
I have grounded the carriage (hot end, extruder…) to see if it helped.
I still see bytes invalid for the UCAN at nearly 700 and 1500 for the EBB42… klippy(33).log (4.6 MB) mycanlog.zip (4.7 MB)
According to your old logs, you always get
b’Got error -1 in can write: (105)No buffer space available
Oh, it is already reflashed.
Btw, there should be a common ground (GND) between EBB and UCAN, and in the end with RPI.
But looks like main mcu and ucan connected by usb, so mcu should share ground with power supply which is connected to ebb (hope this is the same power supply).
Aight… I’ve grounded the carriage, added a ground wire from the UCAN to the EBB (all PSU’s share a ground point in the electronics enclosure) and still getting bytes_invalid errors…
The canbus statistics PR was merged into the mainline Klipper earlier today. However, those statistics wont help as you have the “increasing bytes_invalid” problem - see: CANBUS Troubleshooting - Klipper documentation
You’ll have to find the fix for this and get the connection to a point where bytes_invalid no longer increases - nothing will solve your problems until you’re able to do that. Unfortunately it’s difficult to give advice on exactly how to fix your particular setup. A lot of people are reporting that switching Linux kernels (eg, going to 32bit kernel if one is available) can fix the issue, but that’ll depend on the hardware that you are running.
Hope that helps a little,
-Kevin
EDIT: Just to be clear, an increasing bytes_invalid is only known to occur due to Linux kernel bugs and/or canbus adapter firmware bugs. Wiring issues would not cause increasing bytes_invalid and thus this issue can not be fixed by changing wiring.
I’ve always assumed that bytes_invalid increasing could be caused by wiring problems/intermittent connections. I have definitely seen this with users that have U2C adapters (but none with main controller boards running the USB to CAN bridge software).
Are there any Linux Kernels which have been observed to be problematic in this regard?
@Sineos , could information be included in your (excellent) Knowledge Base posts? I’m not really sure what is the right topic.
Heh, just went through the manual install steps of Mainsail with the 32bit lite OS and it would not start… Just saw they have a prebuilt image in the git. Going to try that
Host is running version: v0.12.0-429-g01b0e98ab
MCU’s and CAN version: v0.12.0-425-ga849b143d
It seems better. Going to update all the MCU’s and try again.
It does seem like 64b vs 32b does affect it slightly? klippy(42).log (4.0 MB)
Update:
Host is running version: v0.12.0-429-g01b0e98ab-dirty
MCU’s and CAN version: v0.12.0-429-g01b0e98ab
UCAN got 128 bytes_invalid and EBB42 498.
Should I try increasing the txqueuelen? Or try again with TRSYNC_TIMEOUT?
You have the incrementing bytes_invalid issue. The only known cause is canbus packets being reordered by either a buggy USB-to-CANBUS firmware or a buggy Linux kernel. In your case it looks like you’ve got a buggy Linux kernel. You’ll need to somehow find a Linux kernel that is not buggy, or find some kernel settings (eg, irq routing or power management) that avoids the issue within the Linux kernel.
It may help if you share what OS you installed on the RPi, where you got it, and what kernel version you are currently running (uname -a ; getconf LONG_BIT).
None of my machines have this issue, so unfortunately I can’t give specific advice on how to fix it.
I don’t know which particular kernels are impacted. My speculation is that an error was introduced a couple of years ago, then fixed with can: gs_usb: convert to NAPI/rx-offload to avoid OoO reception · torvalds/linux@24bc41b · GitHub . Then over the last couple of years, various embedded Linux distributions have pulled in the buggy code and/or pulled in the fixed code. I also get the impression that even a buggy kernel can avoid the issue depending on how many cores are active and the routing of usb interrupts to those cores.
The above is speculation though - I’ve done enough investigations of this issue to know what’s going wrong, but I don’t know the exact issue within the Linux kernel nor the exact requirements to avoid it. A large number of people (like myself) don’t have this issue, so it’s definitely possible to fix it.
I will try changing the USB HUB from a MTT one to a STT and see if that has any effect on the bytes_invalid . I originally changed to a MTT HUB because of the issues…
As for the Fysetc UCAN adapted I’ve flashed it with Katapult and Klipper USB to CAN bridge. I’ve tried with what i believe is candlelight before but from my understanding the version in Klipper is a modified/fix version from BigTreeTech?
So if there is any particular FW to flash to the UCAN please let me know, it’s a STM32F072 based adapter.
Thanks a lot for the support from everyone so far!
Have you tried just using the 32bit Raspberry Pi OS Lite and not the Mainsail version?
I’ve tried the Mainsail version and found it to be a bit buggy when working with CAN (I believe I was using a U2C adapter and not a main controller board with CAN to USB bridge hardware built in).
After SSH’ing into the Raspberry Pi, add Klipper/Moonraker/Mainsail using KIAUH:
Other than Moonraker being very unhappy about some path stuff (well I am too, took me 3 tries to get Klipper, Moonraker and Mainsail on the 8GB CM3 ) and struggling with the Pi not finding the printer mainboard under /dev/serial/by-id/ (yeah yeah I should have listened to my own words) it’s printing…
Could you describe your host hardware in more detail?
You put originally that you have a “CM3+”. I’m guessing that it has 8GB eMMC and is mounted on an IO board?
As you’ve discovered, that’s pretty marginal. Trying to cut things down will lead to all kinds of problems that will take a long time to track down and fix.
My suggestions:
Run the CM3 only from an SD Card and eschew the on board eMMC? That way you have much more Flash available (I tell people to use at least 64GB) and the performance hit is very minimal.
Buy a Raspberry Pi 4B as the CM3 is going EOL shortly and take advantage of more Flash space and a higher performance CPU.