USB-to-CAN v2 Professional with Debian on a Raspberry Pi 4

Hi,
I am using a USB-to-CAN V2 professional to control a Maxon Epos 4 via canbus. This properly works on Windows with the VCI driver.
Now I need to make it run on a Raspberry Pi 4 using a Debian 64 bit OS. I installed the ECI driver for USB and it kind of works.

When executing lsusb, it is there:
~/ixxat/EciLinux_arm64/bin/release$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 08d8:000a IXXAT Automation GmbH USB-to-CAN V2
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I can see it in dmesg:
[ 5154.210600] usb 1-1.3: new high-speed USB device number 5 using xhci_hcd
[ 5154.316426] usb 1-1.3: New USB device found, idVendor=08d8, idProduct=000a, bcdDevice= 1.00
[ 5154.319882] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5154.322921] usb 1-1.3: Product: USB-to-CAN V2
[ 5154.324709] usb 1-1.3: Manufacturer: IXXAT
[ 5154.326385] usb 1-1.3: SerialNumber: HW510383

When executing the demo program, i can see the device, too:
Linux.so.1.13.1.0 libeci10EDriverLinux.so.1.13.1.0 libeci120DriverLinux.so.1.13.1.0
izfp_service@uerneo:~/ixxat/EciLinux_arm64/bin/release$ ./LinuxEciDemo

Linux ECI API Demo program <<

… a lot of stuff from devices that are not connected…

ECI Demo for USB-to-CAN V2 <<
ECI113_Initialize…succeeded.
ECI113_GetInfo…succeeded.
HwInfoVer: “1”
BoardType : “USB-to-CAN_V2”
HwSerial : “HW510383”
HwVersion : “0.1.5.0”
BmVersion : “0.0.0.0”
FwIdentif : “BAL V3”
FwVersion : “0.1.7.0”
EciApiVer : “0.1.13.1”
DevId : “0x0”
CtrlCount : “2”
CtrlIndex : “0”
CtrlClass : “0x0001”
CtrlState : “0x0000”
CtrlIndex : “1”
CtrlClass : “0x0001”
CtrlState : “0x0000”

ECI CAN Demo <<
ECI113_CtrlOpen…succeeded.
ECI113_CtrlGetCapabilities…succeeded.
CapsVer : “0”
CanType : “0x000b”
BusCoupl : “0x0002”
Feature : “0x005f”
PriClkFreq : “1000000”
TscDiv : “1”
DtxDiv : “1”
DtxMaxTic : “0”
PrioQueue : “1”
ECI113_CtrlStart…succeeded.
Now, sending 20480 CAN Messages
Time: 14, Type: 3, ID: 00000000, Flags: Data: 00 00 00 00
Time: 13284, Type: 2, ID: 00000000, Flags: Data: 02 00 00 00 F8
Time: 13292, Type: 3, ID: 00000000, Flags: Data: 1D 00 00 00

But if I try to access the device from an API delivered by Maxon Motors, this library cannot find the device or access it. Also: There is no can0 interface when performing ip addr list.

I thought I need to install the socket can driver to get the interface, but that fails, too:

make
make -C /lib/modules/5.10.0-9-arm64/build M=/home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb CONFIG_CAN_IXXAT_USB=m modules
make[1]: Entering directory ‘/usr/src/linux-headers-5.10.0-9-arm64’
CC [M] /home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.o
/home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.c: In function ‘ixxat_usb_handle_canmsg’:
/home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.c:645:13: error: implicit declaration of function ‘can_fd_dlc2len’; did you mean ‘can_dlc2len’? [-Werror=implicit-function-declaration]
645 | datalen = can_fd_dlc2len(dlc);
| ^~~~~~~~~~~~~~
| can_dlc2len
/home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.c:647:13: error: implicit declaration of function ‘can_cc_dlc2len’; did you mean ‘can_dlc2len’? [-Werror=implicit-function-declaration]
647 | datalen = can_cc_dlc2len(dlc);
| ^~~~~~~~~~~~~~
| can_dlc2len
In file included from /home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.c:24:
/home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.c: In function ‘ixxat_usb_encode_msg’:
/home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.c:1005:33: error: implicit declaration of function ‘can_fd_len2dlc’; did you mean ‘can_len2dlc’? [-Werror=implicit-function-declaration]
1005 | flags |= IXXAT_USB_ENCODE_DLC(can_fd_len2dlc(cf->len));
| ^~~~~~~~~~~~~~
/home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.h:116:38: note: in definition of macro ‘IXXAT_USB_ENCODE_DLC’
116 | #define IXXAT_USB_ENCODE_DLC(len) (((len) << 16) & IXXAT_USB_MSG_FLAGS_DLC)
| ^~~
cc1: some warnings being treated as errors
make[3]: *** [/usr/src/linux-headers-5.10.0-9-common/scripts/Makefile.build:285: /home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb/ixxat_usb_core.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.10.0-9-common/Makefile:1846: /home/izfp_service/ixxat/ix_usb_can_2.0.366-REL/kernel/drivers/net/can/usb/ixxat_usb] Error 2
make[1]: *** [/usr/src/linux-headers-5.10.0-9-common/Makefile:185: __sub-make] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-5.10.0-9-arm64’
make: *** [Makefile:15: all] Error 2

As I am not that deep in drivers and modules on linux systems, any help on that would be nice.

Thank you in advance!

Thanks for the quick reply. Sadly, I cannot access the link in the first place as many others, too.

If have found this link some posts below the one you linked here:
ECI_Driver_1.13.3731.0_20200124_Linux_arm64 (mediafire.com)

This is the ECI driver I use at the moment which grants me access with your example software but does not provide me an interface such as CAN0 or so.
So: What am I doing wrong when installing?

Do you know what version of the firmware you have on the USB-to-CAN V2?

Have you tried this version of SocketCAN?:

SocketCAN_USB-to-CAN-V2_20180920_Modified_Linux_Kernel_5_11

Also, did you follow these instructions? USB to CAN V2 on Raspberry Pi4 - #30 by kyle_HMS

Make sure to deinstall the ECI and do a clean install of the SocketCAN driver:

$ make clean
$ sudo make uninstall

Hello Kyle,
this modified Socket Can driver seems to work now. Still facing the issue that I do not have any communication running and the CAN1-LED is flashing red when trying to communicate, but I think this is a different issue.

Thank you very much for your help!

OK great! It sounds like there are errors on the bus that you will need to diagnose. Make sure you have the correct baud rate.

image

Here are some commands that you can try:

Init and start: $ sudo ip link set can0 up type can bitrate 500000

show data: $ candump can0

send data: $ cansend can0 123#DEADBEEF

Yeah, could figure out that I can send but there is something weird with the received frames. My current guess is that there is an issue with the remote device. I will try to find out.
Thank you again!

You’re welcome!