In search of the canboard limit (The need for speed...)

Hi,

Anyone who has followed my last posts will know about my fight to configure a Canboard, through CANBUS, not USB…

Now that it seems that I have achieved it… the next thing is to find the limit

The next thing is to optimize the connection, I am using the combination of Bigtreetch (U2C + EBB42), and in several of the guides, including the official one, they recommend setting the transfer speed to 250000.
But… I have read, in this forum and some other websites, that 250,000 is a fair speed, especially if the accelerometer is going to be used… which I did have in mind. They recommend 500000 or even 1000000. 4x the current setting. And I have some questions:

  • The combination that I use (U2C + EBB42), would it hold 500000? and 10000000?
  • The length of the cable or the type of cable. Does it affect top speed?
  • Is there any test that can be done to see the maximum limit? or if the connection supports 500000/1000000? (Perhaps with Ifconfig and see if the CAN 0 interface has many errors? or looking at the klipper log?)
  • That limit of 250000 recommended. By those? by EBB42 or by U2C? I ask because perhaps changing 1 of the two components would be enough.
  • Can you select any speed? for example 735415? Or does it have to be between specific values?
  • The only way to change the speed of the canboard, EBB42, is flashing the firmware again?
  • Users of this combination (U2C+EBB42) what speed configuration do they have? and in the CAN0 file what do you recommend to put? (I have seen that a value, I don’t remember now TXQ… from 128 to 1024, I don’t know if it influenced)

It seems you can set whatever value You want for the speed.

Per the CAN bus specifications the length of the bus wires effects the maximum speed without packet loss or errors.

What I have done is install can-util via sudo apt-get install can-utils

In a ssh terminal window run cangen can0 to generate random CAN bus traffic.

Open a second ssh terminal window and run ifconfig, note the packet loss and errors.

I have left it running for over five minutes then run ifconfig as long as the packet loss and errors doesn’t grow in numbers I have increased the bitrate. If the numbers grow then I have backed off on the bitrate speed.

This same process can be used while you debug if you have connection issues.

After changes to the bus speed in the /etc/network/interfaces.d/can0 and the firmware on all of the CAN bus hardware, you would shutdown and power off all devices then power back up and repeat the testing process. Note this gets all devices reset and insured running at the updated speed.

Using allow-hotplug can0 instead of auto can0 in your /etc/network/interfaces.d/can0 will help your connections. Also, increasing txqueuelen value can also help keeping up with bus data.

2 Likes

okay,

I guess the only way to change the speed is by flashing the firmware each time, and changing the CAN0 file…
There is no faster dynamic way, if not each test can take a while, especially for flashing the firmware…

Is there a recommended speed, if you want to use the integrated accelerometer? to know the minimum speed that I should look for…

I have read that with an adxl345 the CAN bus should be at least 500K

Depending on total length of your wires that make up CAN L & H end up effecting your overall speed without errors & packet loss. So try to keep them as short as possible.

hi,

i have try to this…

i send by SSH

cangen can0

And open a second terminal and send…

ifconfig can0

But after some seconds… in first terminal windows i receive these message:

write: No buffer space available

Edit /etc/network/interfaces.d/can0

Increase this number from your current value.

txqueuelen 1024

Save and reboot

If that doesn’t work, you might need to decrease your bitrate. bitrate range 1000000 to 10

From some other posts that bitrates below 500000 may not be able to keep up when using an adxl345 on a CAN bus device.