PCAN driver installation on IMX6
Posted: Mon 19. Aug 2019, 18:08
Dear Peak-System team,
I have an imx6 based embedded system on which I would like to use a PCAN-USB device.
My ultimate goal is to install the PCAN driver on this system so my PCAN-USB device is recognized as a serial port and appears as, for example, /dev/pcan0. Eventually, I'll be able to read a PCAN bus from a Python script using PCAN API.
I use a home made kernel version which is a modified version of the last stable version of the imx6 kernel provided by SolidRun.
Here are the several steps of my journey:
1. Download the peak-linux-driver-8.8.0 zipped folder, unzip and copy it on the embedded system
2. Download the headers of the stable kernel version
3. Inside the peak-linux-driver-8.8.0 folder, modify the KERNEL_LOCATION option in the driver/Makefile.
4. Compile the binaries with: $ make DNG=NO PCI=NO PCC=NO PCIEC=NO ISA=NO
5. Note that the compilation is ok (which means no error messages are displayed)
6. Install the driver with: $ sudo make install
7. Note that the installation is ok (again, no error messages are displayed), I launch the command pcaninfo, I can find the files /usr/lib/libpcanbasic.so and /usr/include/PCANBasic.h
8. Load the pcan module with: $ sudo modprobe pcan
The "pcaninfo" command fails with this message:
ERROR: failed to scan directory (errno=2) '/sys/class/pcan'
ERROR: failed to open file (errno=2) '/sys/class/pcan/version'.
PCAN driver not found
The 8th fails with this message:
modprobe: ERROR: could not insert 'pcan': Exec format error
modprobe: ERROR: ../libkmod/libkmod-module.c:977 command_do() Error running install command for pcan
modprobe: ERROR: could not insert 'pcan': Operation not permitted
The pcan.ko file can be found in /lib/modules/4.9.150-imx6-sr/misc/ folder. It seems to be the right place as it is the same kernel version as the one written in KERNEL_LOCATION Makefile option.
So I've tried to move this pcan.ko file to this place /lib/modules/my-kernel-version/drivers/misc/ folder.
Now, the following command can be autocompleted with 'pcan': $ sudo modprobe
I guess it means that tha pcan.ko file is now at a place where the module can be loaded but I still get the same message error as above.
In keeping with other discussion about driver installation problems, I ran the command after the modprobe command:
$ dmesg
It gives me the following answer:
[ 2093.333297] pcan: disagrees about version of symbol module_layout
I don't really understand this message and I would like to have some advice and some highlights about my attemps, especially if I've made obvious mistakes.
Also, the /proc/pcan file does not exist.
Finally, I succeeded in installing the PCAN_USB module by including the option "CONFIG_CAN_PEAK_USB=m" in the kernel compilation configuration file. When I plug the device in my system, it is well recognized but, this time, as a network interface (typing the command "ip a", I see a new "can1" interface). But it is not satisfying as I want my device to be a serial port.
Actually, it makes me think that installing manually the driver so I can see my device as a serial port seems to be possible.
NB: When connecting the USB device to my system, I can see it is well recognized with the dmesg command:
[ 2472.200778] usb 1-1: new full-speed USB device number 3 using ci_hdrc
[ 2472.340513] usb 1-1: New USB device found, idVendor=0c72, idProduct=000c
[ 2472.347522] usb 1-1: New USB device strings: Mfr=10, Product=4, SerialNumber=0
[ 2472.355031] usb 1-1: Product: PCAN-USB
[ 2472.358816] usb 1-1: Manufacturer: PEAK-System Technik GmbH
[ 2472.499993] pcan: disagrees about version of symbol module_layout
And as you can see, each time I plug the device, the "pcan: disagrees about version of symbol module_layout" appears, which means that some Peak software is activated when I plug the USB device.
Those are lots of informations about my trials which are linked with several topics about the pcan driver installation I've been reading so far in this forum.
Feel free to ask more information if I didn't give enough or if my problem is not clear enough.
Regards,
Aurélien
I have an imx6 based embedded system on which I would like to use a PCAN-USB device.
My ultimate goal is to install the PCAN driver on this system so my PCAN-USB device is recognized as a serial port and appears as, for example, /dev/pcan0. Eventually, I'll be able to read a PCAN bus from a Python script using PCAN API.
I use a home made kernel version which is a modified version of the last stable version of the imx6 kernel provided by SolidRun.
Here are the several steps of my journey:
1. Download the peak-linux-driver-8.8.0 zipped folder, unzip and copy it on the embedded system
2. Download the headers of the stable kernel version
3. Inside the peak-linux-driver-8.8.0 folder, modify the KERNEL_LOCATION option in the driver/Makefile.
4. Compile the binaries with: $ make DNG=NO PCI=NO PCC=NO PCIEC=NO ISA=NO
5. Note that the compilation is ok (which means no error messages are displayed)
6. Install the driver with: $ sudo make install
7. Note that the installation is ok (again, no error messages are displayed), I launch the command pcaninfo, I can find the files /usr/lib/libpcanbasic.so and /usr/include/PCANBasic.h
8. Load the pcan module with: $ sudo modprobe pcan
The "pcaninfo" command fails with this message:
ERROR: failed to scan directory (errno=2) '/sys/class/pcan'
ERROR: failed to open file (errno=2) '/sys/class/pcan/version'.
PCAN driver not found
The 8th fails with this message:
modprobe: ERROR: could not insert 'pcan': Exec format error
modprobe: ERROR: ../libkmod/libkmod-module.c:977 command_do() Error running install command for pcan
modprobe: ERROR: could not insert 'pcan': Operation not permitted
The pcan.ko file can be found in /lib/modules/4.9.150-imx6-sr/misc/ folder. It seems to be the right place as it is the same kernel version as the one written in KERNEL_LOCATION Makefile option.
So I've tried to move this pcan.ko file to this place /lib/modules/my-kernel-version/drivers/misc/ folder.
Now, the following command can be autocompleted with 'pcan': $ sudo modprobe
I guess it means that tha pcan.ko file is now at a place where the module can be loaded but I still get the same message error as above.
In keeping with other discussion about driver installation problems, I ran the command after the modprobe command:
$ dmesg
It gives me the following answer:
[ 2093.333297] pcan: disagrees about version of symbol module_layout
I don't really understand this message and I would like to have some advice and some highlights about my attemps, especially if I've made obvious mistakes.
Also, the /proc/pcan file does not exist.
Finally, I succeeded in installing the PCAN_USB module by including the option "CONFIG_CAN_PEAK_USB=m" in the kernel compilation configuration file. When I plug the device in my system, it is well recognized but, this time, as a network interface (typing the command "ip a", I see a new "can1" interface). But it is not satisfying as I want my device to be a serial port.
Actually, it makes me think that installing manually the driver so I can see my device as a serial port seems to be possible.
NB: When connecting the USB device to my system, I can see it is well recognized with the dmesg command:
[ 2472.200778] usb 1-1: new full-speed USB device number 3 using ci_hdrc
[ 2472.340513] usb 1-1: New USB device found, idVendor=0c72, idProduct=000c
[ 2472.347522] usb 1-1: New USB device strings: Mfr=10, Product=4, SerialNumber=0
[ 2472.355031] usb 1-1: Product: PCAN-USB
[ 2472.358816] usb 1-1: Manufacturer: PEAK-System Technik GmbH
[ 2472.499993] pcan: disagrees about version of symbol module_layout
And as you can see, each time I plug the device, the "pcan: disagrees about version of symbol module_layout" appears, which means that some Peak software is activated when I plug the USB device.
Those are lots of informations about my trials which are linked with several topics about the pcan driver installation I've been reading so far in this forum.
Feel free to ask more information if I didn't give enough or if my problem is not clear enough.
Regards,
Aurélien