Ubuntu – Mount usb to serial adapter CANBUS and can-utils ubuntu

canserial portusb

I have this adapter and I'm trying desperately to mount it in Ubuntu so I can use can-utils to monitor the device but I'm failing.

I'm trying to communicate with a serial to the can-bus adapter in 14.04 with can-utils
this is the canopen device I'm trying to get at and this is the adapter I'm using

dmesg:

[ 4316.555254] usb 3-3: new full-speed USB device number 8 using xhci_hcd
[ 4316.572534] usb 3-3: New USB device found, idVendor=1a86, idProduct=7523
[ 4316.572541] usb 3-3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 4316.572545] usb 3-3: Product: USB2.0-Serial
[ 4316.573058] ch341 3-3:1.0: ch341-uart converter detected
[ 4316.574083] usb 3-3: ch341-uart converter now attached to ttyUSB1
[ 4836.845113] CAN device driver interface
[ 5389.346203] can: broadcast manager protocol (rev 20120528 t)
[ 5570.910652] systemd-hostnamed[23407]: Warning: nss-myhostname is not installed. Changing the local hostname might make it unresolveable. Please install nss-myhostname!

That is dmesg output
for the device

Which I think is the device.

lsusb gives me:

Bus 003 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

I've managed to mount it to slcan0
like so:

sudo slcand -o -s6 -t hw -S 3000000 /dev/ttyUSB2

ip link set up slcan0

IP link then gives me:

6: slcan1: <NOARP,UP,LOWER_UP> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can 

No matter what I then throw it via can-send I can't get a response back…

Best Answer

I know this is a very old thread. But it is still unanswered and while I was searching for a solution I stumbled upon this thread.

The solution to this problem is that slcand does not support this interface. To use it anyway a mapper between the interface and socket can must be used. This adapter can be found at https://github.com/alexmohr/usb-can

After install just run usbcan -s 500000 -d /dev/ttyUSB0

Related Question