I'm new to compiling the Linux kernels. The answer from @0andriy was helpful. I managed to make the system work as expected. My way to the working version is described below.
Preparing Linux kernel for SocketCAN
I got everything set up and ready to go then I run the menuconfig
utility and selected all CAN modules under: Networking support ---> CAN bus subsystem support
.
Diff betwen default and modified configuration file (diff -u default.config can.config
):
--- default.config 2019-07-24 13:28:48.000000000 +0200
+++ can.config 2019-07-24 14:26:55.000000000 +0200
@@ -1409,21 +1409,26 @@
# CAN Device Drivers
#
CONFIG_CAN_VCAN=m
-# CONFIG_CAN_VXCAN is not set
+CONFIG_CAN_VXCAN=m
CONFIG_CAN_SLCAN=m
CONFIG_CAN_DEV=m
CONFIG_CAN_CALC_BITTIMING=y
-# CONFIG_CAN_FLEXCAN is not set
-# CONFIG_CAN_GRCAN is not set
-# CONFIG_CAN_TI_HECC is not set
-# CONFIG_CAN_C_CAN is not set
-# CONFIG_CAN_CC770 is not set
-# CONFIG_CAN_IFI_CANFD is not set
-# CONFIG_CAN_M_CAN is not set
-# CONFIG_CAN_RCAR is not set
-# CONFIG_CAN_RCAR_CANFD is not set
-# CONFIG_CAN_SJA1000 is not set
-# CONFIG_CAN_SOFTING is not set
+CONFIG_CAN_FLEXCAN=m
+CONFIG_CAN_GRCAN=m
+CONFIG_CAN_TI_HECC=m
+CONFIG_CAN_C_CAN=m
+# CONFIG_CAN_C_CAN_PLATFORM is not set
+CONFIG_CAN_CC770=m
+# CONFIG_CAN_CC770_ISA is not set
+# CONFIG_CAN_CC770_PLATFORM is not set
+CONFIG_CAN_IFI_CANFD=m
+CONFIG_CAN_M_CAN=m
+CONFIG_CAN_RCAR=m
+CONFIG_CAN_RCAR_CANFD=m
+CONFIG_CAN_SJA1000=m
+# CONFIG_CAN_SJA1000_ISA is not set
+# CONFIG_CAN_SJA1000_PLATFORM is not set
+CONFIG_CAN_SOFTING=m
#
# CAN SPI interfaces
#
# CONFIG_CAN_HI311X is not set
CONFIG_CAN_MCP251X=m
#
# CAN USB interfaces
#
-# CONFIG_CAN_8DEV_USB is not set
-# CONFIG_CAN_EMS_USB is not set
-# CONFIG_CAN_ESD_USB2 is not set
+CONFIG_CAN_8DEV_USB=m
+CONFIG_CAN_EMS_USB=m
+CONFIG_CAN_ESD_USB2=m
CONFIG_CAN_GS_USB=m
-# CONFIG_CAN_KVASER_USB is not set
-# CONFIG_CAN_MCBA_USB is not set
-# CONFIG_CAN_PEAK_USB is not set
-# CONFIG_CAN_UCAN is not set
-# CONFIG_CAN_DEBUG_DEVICES is not set
+CONFIG_CAN_KVASER_USB=m
+CONFIG_CAN_MCBA_USB=m
+CONFIG_CAN_PEAK_USB=m
+CONFIG_CAN_UCAN=m
+CONFIG_CAN_DEBUG_DEVICES=y
CONFIG_BT=m
CONFIG_BT_BREDR=y
CONFIG_BT_RFCOMM=m
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=m
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=m
CONFIG_BT_HS=y
CONFIG_BT_LE=y
CONFIG_BT_6LOWPAN=m
# CONFIG_BT_LEDS is not set
# CONFIG_BT_SELFTEST is not set
CONFIG_BT_DEBUGFS=y
Folowing README file, I got error when executing make
command:
make -C /lib/modules/4.19.59-v7+/build M=/root/dev/socketcan/usb-to-can_socketcan modules
make[1]: Entering directory '/root/dev/linux'
Building modules, stage 2.
MODPOST 1 modules
make[1]: Leaving directory '/root/dev/linux'
make -C /lib/modules/4.19.59-v7+/build M=/root/dev/socketcan/can-ibxxx_socketcan modules
make[1]: Entering directory '/root/dev/linux'
CC [M] /root/dev/socketcan/can-ibxxx_socketcan/ixx_pci_core.o
/root/dev/socketcan/can-ibxxx_socketcan/ixx_pci_core.c: In function ‘ixxat_pci_probe’:
/root/dev/socketcan/can-ibxxx_socketcan/ixx_pci_core.c:849:9: error: implicit declaration of function ‘pci_disable_msi’ [-Werror=implicit-function-declaration]
pci_disable_msi(dev);
^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:303: recipe for target '/root/dev/socketcan/can-ibxxx_socketcan/ixx_pci_core.o' failed
make[2]: *** [/root/dev/socketcan/can-ibxxx_socketcan/ixx_pci_core.o] Error 1
Makefile:1517: recipe for target '_module_/root/dev/socketcan/can-ibxxx_socketcan' failed
make[1]: *** [_module_/root/dev/socketcan/can-ibxxx_socketcan] Error 2
make[1]: Leaving directory '/root/dev/linux'
Makefile:7: recipe for target 'ixx_pci' failed
make: *** [ixx_pci] Error 2
Then I try to compile only the USB part of the driver with the command: make ixx_usb
. This was successful and I install all only the USB kernel modules by typing sudo make install_usb
.
After that I need to prepare and start the interface with typing command:
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up
I tested the device with can-utils and python-can utilities:
cangen can0
and
python -m can.player -c can0 -i socketcan -b 1000000 logged_data.log
And everything works as expected!
IXXAT Response
I also write the same question to IXXAT Support and got the answer with two possibilities:
Try to compile the actual beta version of the "SocketCAN driver for Linux for x86 architecture" from the attachment on the Raspberry Pi with ARM architecture.
Use the attached beta ECI for Linux for ARM instead of the SocketCAN
They also send me two attached files: SocketCAN-Driver-USB2CANv2.tar.gz (13.17 KB)
and ECI_Driver_1.10.2640.2_BETA_20150910_Linux_arm.zip (5.17 MB)
.
1. option
I removed already installed SocketCAN driver and installed attached SocketCAN-Driver-USB2CANv2.tar.gz (13.17 KB)
driver.
And everything works as expected!
Facts about this beta version of the driver:
- To get the driver ready for the Linux mainline kernel, it
was completely rewritten.
- The filenames and also the driver name itself changed.
2. option
I installed usb only part of ECI driver and started a demo.
root@rpi:~/dev/ECI_Driver_1.10.2640.2_BETA_20150910_Linux_arm/EciLinux_arm/bin/release# ./LinuxEciDemo
>> Linux ECI API Demo program <<
...
>> ECI Demo for USB-to-CAN V2 <<
ECI113_Initialize...succeeded.
ECI113_GetInfo...failed with errorcode: 0xE0FE000E. The device or resource could not be found.
-> Returning from ECI Demo for USB-to-CAN V2 <-
-> Closing Linux ECI API Demo program <-
And Device Admin with output level 6:
root@rpi:~/dev/ECI_Driver_1.10.2640.2_BETA_20150910_Linux_arm/EciLinux_arm/bin/release# ./LinuxEciDeviceAdmin -o 6
===========================================================================
ECI Device Admin : Command line parameter info
---------------------------------------------------------------------------
Show Help : "No"
Show Version : "No"
Output Level : "6"
Show Only : "No"
Auto Update : "Disabled"
Simulate Write : "Disabled"
Force Update : "No"
Force Verify : "No"
DevAdminRun -> Enter
Opening board 0 of type "PC-I 04/PCI" failed with error code 0xE0FE000E
Opening board 0 of type "PC-I 04/104" failed with error code 0xE0FE000E
Opening board 0 of type "CAN-IB1x0/PCIe (Mini), (104)" failed with error code 0xE0FE000E
Opening board 0 of type "iPC-I 320/PCI" failed with error code 0xE0FE000E
Opening board 0 of type "iPC-I 320/ISA (104)" failed with error code 0xE0FE000E
Opening board 0 of type "iPC-I XC16/PCI (PMC)" failed with error code 0xE0FE000E
Opening board 0 of type "USB-to-CAN compact" failed with error code 0xE0FE000E
Opening board 0 of type "USB-to-CAN II" failed with error code 0xE0FE000E
Opening board 0 of type "iPC-I XC16/PCIe" failed with error code 0xE0FE000E
Opening board 0 of type "CAN-IB2x0/PCIe (104)" failed with error code 0xE0FE000E
===========================================================================
ECI Hardware Name : "USB-TO-CAN V2"
ECI Driver Type : 0x0113
ECI Hardware Class : undefined
---------------------------------------------------------------------------
ECI Rel. Board Index: 0
Time elapsed : 11 ms for opening board
Hardware Type : "USB-to-CAN_V2"
Hardware Version : 00.00.00.00
Hardware Serial No. : "HW509705"
Boot Manager ID : "n/a"
Boot Manager Version: 00.00.00.00
HW Version Check : Ver1 = 0x00000000, Ver2 = 0x00010000, Result = -1
BM Version Check : Ver1 = 0x00000000, Ver2 = 0x00010504, Result = -1
Device Update : available
+++++++++++++++++++++
Perform Update? : Flash HW Ver:00.01.00.00, BM Ver:00.01.05.04 [y/n] n
Update aborted : Update was aborted upon user request
+++++++++++++++++++++
Time elapsed : 10 ms for downloading and starting ECI firmware
Controller Count : 0
Opening board 1 of type "USB-TO-CAN V2" failed with error code 0xE0FE000E
DevAdminRun -> Exited with error code 0xE0FE001A
The second option still not works. Waiting for feedback from IXXAT.