0

Hi I'm trying to connect my Linux VM to a physical CAN-Bus.

The USB Passthrough and setup of the CAN interface is working perfectly fine, but I have trouble sending messages from the VM.

First of all here is my VM version and Hardware:

user@usb-can:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

USB2CAN adapter and Documentation http://www.inno-maker.com/product/usb-can/ https://github.com/INNO-MAKER/usb2can/blob/master/Document/USB2CAN%20UserManual%20v.1.8.pdf

So first of all if I'm sending 15 CAN Messages from my VM to my CAN interface with cansend can0 123#DEADBEEF. and the first 2-3 messages are registered and also shown when I do a candump can0:

user@usb-can:~$ candump can0
  can0  123   [4]  DE AD BE EF
  can0  123   [4]  DE AD BE EF
  can0  123   [4]  DE AD BE EF

However the remaining 12 are not sent anymore and when I send additional frames I get:

user@usb-can:~cansend can0 123#DEADBEEF
write: No buffer space available

So I found out that I could inspect the buffer, and it showed this:

user@usb-can:~$ tc -s qdisc show dev can0
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 144 bytes 9 pkt (dropped 3, overlimits 0 requeues 1)
 backlog 176b 11p requeues 1

And this locks the whole device and I cant send anything because packages get dropped.

However this is with nothing attached to the adapter so I assume that is normal? Maybe somebody can verify this with knowledge about USB to CAN devices or with his own device?

Because there is no termination resistor so it would make sense that its not working properly.

BUT When I connect a Termination resistor of 120 Ohm and use the jumper to enable the 120 Ohm in the adapter, I should have the 2 required termination resistors and thus being able to send the CAN frames. But I get the same error as before:

user@usb-can:~$ tc -s qdisc show dev can0
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 80 bytes 5 pkt (dropped 0, overlimits 0 requeues 1)
 backlog 176b 11p requeues 1

So in my mind the CAN Network looks like this:

                USB 2 CAN adapter
        _________________/\_________________
       /                                   \
                               _________
                               |usb2can|
                               ---------
                               |    |  
       CAN HIGH     ___________*____|______________________________
                    |               |                              |
               __________           |                      _______________
               |120 Ohm |           |                      |120 Ohm      |  
               ----------           |                      ---------------
                    |               |                              |
       CAN LOW      ----------------*------------------------------

Do I need to add another device to the network to make it work or shouldn't it work like that?

I already tried using different termination resistors if maybe one would be broken and also tried attaching an additional device. But no success yet.

Philipp
  • 26
  • 4

0 Answers0