# Canbus bytes\_invalid increase during Z move

**URL:** https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347
**Category:** General Discussion
**Created:** [December 17, 2023, 8:09am UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347 "2023-12-17T08:09:13Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![wiphoenix](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wiphoenix](https://klipper.discourse.group/u/wiphoenix)
#### Post date: [December 17, 2023, 8:09am UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/1 "2023-12-17T08:09:13Z")

</div>

### Basic Information:

Printer Model: Tronxy X5SA  
 MCU / Printerboard: RPi 3B+, BTT Pico, BTT U2C v2.1, EBB42 v1.2  
 `klippy.log`

### Problem:

I’ve just set up CAN bus, checked the 120R jumper. Do a couple of HOME ALL AXIS and still got bytes\_invalid increase. I use a pair of wires from CAT5 as Can-L and Can-H. Tried to troubleshoot with some instructions but it’s hard to figure out what happen in this case.

Sometime, the machine does nothing but bytes\_invalid also increase a bit.  
…  
[klippy (5).log](https://klipper.discourse.group/uploads/short-url/jSbB7Foxlmq4GmbhlhfV5BNWiaE.log) (326.1 KB)

---

<div class="post-metadata">

### Author: ![hcet14](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@hcet14](https://klipper.discourse.group/u/hcet14)
#### Post date: [December 17, 2023, 7:54pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/2 "2023-12-17T19:54:07Z")

</div>

Did you read this about an old firmware version on your BTT U2C v2.1  
[https://www.klipper3d.org/CANBUS\_Troubleshooting.html#check-for-incrementing-bytes\_invalid-counter](https://www.klipper3d.org/CANBUS_Troubleshooting.html#check-for-incrementing-bytes_invalid-counter)  
Maybe the manufacturer flashed erroneous some old version.

Good luck, hcet14

---

<div class="post-metadata">

### Author: ![wiphoenix](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wiphoenix](https://klipper.discourse.group/u/wiphoenix)
#### Post date: [December 17, 2023, 10:38pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/3 "2023-12-17T22:38:53Z")

</div>

I flashed the latest version from BTT to my U2C, it’s built 11 months ago, it’s hard to tell if it’'s old or not as there is no time reference from the url you mentioned ☹

---

<div class="post-metadata">

### Author: ![hcet14](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@hcet14](https://klipper.discourse.group/u/hcet14)
#### Post date: [December 17, 2023, 11:02pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/4 "2023-12-17T23:02:47Z")

</div>

> [@wiphoenix](#):
>
> I flashed the latest version from BTT to my U2C

Did you do that before starting this thread?

I was searching the www for a command which gives any “FW version information” of the FW on an USB2CAN adapter. I was not successful. Does anyone knows a command achieving this?

---

<div class="post-metadata">

### Author: ![wiphoenix](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wiphoenix](https://klipper.discourse.group/u/wiphoenix)
#### Post date: [December 17, 2023, 11:21pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/5 "2023-12-17T23:21:40Z")

</div>

I know about re-ordering problem before starting this thread but there is no way to tell if re-ordering is my problem or not

I dont know how to get the version of the firmware from U2C, I use the firmware from here [U2C/firmware at master · bigtreetech/U2C · GitHub](https://github.com/bigtreetech/U2C/tree/master/firmware)  
as the last commit date of the file is 11 months ago, I expect that it should not be that old. Docs from Klipper page said `old version` but dont have any other reference so I don’t know if my version is considered as ‘old’ or not.

---

<div class="post-metadata">

### Author: ![hcet14](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@hcet14](https://klipper.discourse.group/u/hcet14)
#### Post date: [December 18, 2023, 11:20am UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/6 "2023-12-18T11:20:20Z")

</div>

> [@wiphoenix](#):
>
> I use the firmware from here [U2C/firmware at master · bigtreetech/U2C · GitHub](https://github.com/bigtreetech/U2C/tree/master/firmware)

That should be the actual firmware.

What is written on the MCU on your BTT U2C v2.1?

---

<div class="post-metadata">

### Author: ![wiphoenix](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wiphoenix](https://klipper.discourse.group/u/wiphoenix)
#### Post date: [December 18, 2023, 7:19pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/7 "2023-12-18T19:19:56Z")

</div>

What do you mean? I just write the firmware on btt u2c. Is there anything else?

---

<div class="post-metadata">

### Author: ![hcet14](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@hcet14](https://klipper.discourse.group/u/hcet14)
#### Post date: [December 18, 2023, 8:55pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/8 "2023-12-18T20:55:22Z")

</div>

Just make sure your BTT U2C v2.1 has the supposed MCU.

Your version should have a marking on the chip like “STM32G0…”  
Older BTT U2C used an other chip like “STM32F072…”

> [@wiphoenix](#):
>
> I know about re-ordering problem

Sounds like China.

---

<div class="post-metadata">

### Author: ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)
#### Post date: [December 18, 2023, 9:04pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/9 "2023-12-18T21:04:38Z")

</div>

- Make sure that both CAN endpoints have the same baud-rate set during `make menuconfig` and that this baud-rate is also reflected in the CAN interface settings
- If you are running a 64bit kernel on your host, try switching to a 32bit one

---

<div class="post-metadata">

### Author: ![wiphoenix](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wiphoenix](https://klipper.discourse.group/u/wiphoenix)
#### Post date: [December 18, 2023, 10:26pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/10 "2023-12-18T22:26:58Z")

</div>

> [@hcet14](#):
>
> Just make sure your BTT U2C v2.1 has the supposed MCU.
> 
> Your version should have a marking on the chip like “STM32G0…”  
> Older BTT U2C used an other chip like “STM32F072…”

mine is STM32G0B1

> [@Sineos](#):
>
> - Make sure that both CAN endpoints have the same baud-rate set during `make menuconfig` and that this baud-rate is also reflected in the CAN interface settings
> - If you are running a 64bit kernel on your host, try switching to a 32bit one

I’m 100% sure baud-rate are matched, as otherwise I cannot connect to MCU.  
I’m also pretty sure that I’m using 32bit as I’m using RPi 3B+ which has ~ 1GB RAM. Btw, how OS kernel version affect CAN bus?

---

<div class="post-metadata">

### Author: ![wiphoenix](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wiphoenix](https://klipper.discourse.group/u/wiphoenix)
#### Post date: [December 19, 2023, 10:35am UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/11 "2023-12-19T10:35:28Z")

</div>

I tried a couple of print and get mcu timeout. I cannot RESTART or FIRMWARE\_RESTART.  
I ssh into the RPI and try  
`~/klipper/scripts/canbus_query.py can0` and got error as attached screenshot. I suspect that the U2C may have problem so I unplug and replug the U2C and klipper can connect again.  
Any idea?

 ![Screenshot 2023-12-19 210029](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/5/57fe4819936c6ce023171d18b4a0bcfd21e82887.png)

---

<div class="post-metadata">

### Author: ![hcet14](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@hcet14](https://klipper.discourse.group/u/hcet14)
#### Post date: [December 20, 2023, 6:01pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/12 "2023-12-20T18:01:38Z")

</div>

What is your “transmit queue length” setting? The value of “txqueuelen”?

You may read this.

> [@Voron 2.4: Can not update MCU 'mcu' config as it is shutdown](https://klipper.discourse.group/t/voron-2-4-can-not-update-mcu-mcu-config-as-it-is-shutdown/10218/10):
>
> Both @Kromka_z_maslem and @patrik-zitko logs contains a lot of Got error -1 in can write: (105)No buffer space available So far you both are first ones, where I see this error. So I would guess it is not a common problem, given the fact that CAN usage in Klipper is quite widespread nowadays. Unfortunately I cannot contribute more than referring to the CAN Troubleshooting document as linked above. You might also try to increase the queue length, e.g.: allow-hotplug can0 iface can0 can static…

---

<div class="post-metadata">

### Author: ![wiphoenix](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wiphoenix](https://klipper.discourse.group/u/wiphoenix)
#### Post date: [December 20, 2023, 10:22pm UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/13 "2023-12-20T22:22:42Z")

</div>

my txqueuelen is 256

---

<div class="post-metadata">

### Author: ![LifeOfBrian](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/lifeofbrian/32/2380_2.png) [@LifeOfBrian](https://klipper.discourse.group/u/LifeOfBrian)
#### Post date: [December 21, 2023, 8:09am UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/14 "2023-12-21T08:09:21Z")

</div>

Try with increased value to 1024.

---

<div class="post-metadata">

### Author: ![koconnor](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@koconnor](https://klipper.discourse.group/u/koconnor)
#### Post date: [December 27, 2023, 12:19am UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/15 "2023-12-27T00:19:38Z")

</div>

There are two known causes of incrementing `bytes_invalid` on CANbus:

- Old firmware on the “usb to canbus” adapter that is buggy. This could be the results of the firmware reordering CAN bus packets (known to occur on some old versions of candlelight\_fw) or it could be lost packets on the USB interface (known to occur on old version of Klipper running in usb2can mode).
- Buggy Linux kernel versions that are reordering CAN bus packets.

Unfortunately, it can be difficult to track down a solution for one of the above two issues, as it can be hard to determine which Linux versions are impacted, and it can be hard to update the firmware of the USB adapter.

It is important to note that “bytes\_invalid” is not the result of:

- not related to canbus wiring
- not related to terminating resistors
- not related to configured canbus speed
- not related to txqueuelen

Those issues will typically result in a bus that does not function at all, or functions erratically with intermittent “Timer too close” errors.

-Kevin

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)
#### Post date: [February 25, 2024, 12:19am UTC](https://klipper.discourse.group/t/canbus-bytes-invalid-increase-during-z-move/12347/16 "2024-02-25T00:19:58Z")

</div>

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