Page 15 of 16
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Mon 26. Feb 2018, 12:51
by BitGid
Hi all!
I'm having difficulty loading the compiled module for a PCAN-USB module on Raspbian Wheezy.
Has anyone had success with this? And if so is there a resource somewhere that could help me install the driver correctly?
Thanks for your help!
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Mon 26. Feb 2018, 14:11
by M.Maidhof
Hi,
please follow this instruction, but please use driver 8.5.1:
http://www.peak-system.com/forum/viewto ... t=90#p5327
regards
Michael
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Wed 28. Feb 2018, 13:24
by michaelgierer3
Hallo,
ich habe Probleme mit dem pcan-Treiber auf meinem Raspberry Pi 3 mit Debian Jessie.
Ich kann den Treiber erfolgreich mit folgenden Optionen erstellen:
Code: Select all
make PCI=NO PCIEC=NO PCC=NO DNG=NO PAR=NO ISA=NO
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
make[1]: Nothing to be done for 'depend'.
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
***
*** Host machine kernel version=4.14.18-v7+
*** Driver kernel version=4.14.18-v7+ (4.14.18)
*** Path to kernel sources=/lib/modules/4.14.18-v7+/build
*** use KBUILD=yes
*** cc version=4.9.2
***
make -C /lib/modules/4.14.18-v7+/build SUBDIRS=/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver EXTRA_CFLAGS="-I/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver -DNO_DEBUG -DMODVERSIONS -DNO -DUSB_SUPPORT -DNO -DNO -DNO -DNO -DNO -DNO_NETDEV_SUPPORT -DNO_RT -Wno-date-time" V=0 modules
make[2]: Entering directory '/root/linux-90ac037dbeecbb514b677e43b53bc5b1a452ea22'
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_main.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_fops.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_fifo.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_filter.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_parse.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_sja1000.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_common.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_timing.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcanfd_core.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcanfd_ucan.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_usb_core.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_usb.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcan_usbpro.o
CC [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/src/pcanfd_usb.o
LD [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/pcan.o
Building modules, stage 2.
MODPOST 1 modules
CC /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/pcan.mod.o
LD [M] /root/Schreibtisch/can/peak-linux-driver-8.5.1/driver/pcan.ko
make[2]: Leaving directory '/root/linux-90ac037dbeecbb514b677e43b53bc5b1a452ea22'
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/lib'
cc -DNO_RT -I. -I../driver -fPIC -Wall -Wcast-align -Wredundant-decls -DPCANFD_OLD_STYLE_API -c src/libpcan.c -o obj/libpcan.o
cc -shared -Wl,-soname,libpcan.so.0 -o lib/libpcan.so.0.6 obj/libpcan.o
cd lib/; ln -sf libpcan.so.0.6 libpcan.so
cc -DNO_RT -I. -I../driver -fPIC -Wall -Wcast-align -Wredundant-decls -DPCANFD_OLD_STYLE_API -c src/libpcanfd.c -o obj/libpcanfd.o
cc -shared -Wl,-soname,libpcanfd.so.0 -o lib/libpcanfd.so.0.1 obj/libpcanfd.o
cd lib/; ln -sf libpcanfd.so.0.1 libpcanfd.so
ar rcs lib/libpcanfd.a obj/libpcanfd.o
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/lib'
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/test'
cc -DNO_RT -g -I. -I../lib -I../driver src/receivetest.c src/common.c -lpcanfd -L../lib/lib -o receivetest
cc -DNO_RT -g -I. -I../lib -I../driver src/transmitest.cpp src/common.c src/parser.cpp -lpcanfd -lstdc++ -L../lib/lib -o transmitest
cc -DNO_RT -g -I. -I../lib -I../driver src/bitratetest.c src/common.c -lpcanfd -L../lib/lib -o bitratetest
cc -DNO_RT -g -I. -I../lib -I../driver src/filtertest.cpp src/common.c -lpcanfd -lstdc++ -L../lib/lib -o filtertest
cc -DNO_RT -g -I. -I../lib -I../driver src/pcanfdtst.c -lpcanfd -L../lib/lib -o pcanfdtst
cc -DNO_RT -g -I. -I../lib -I../driver src/pcan-settings.c -lpopt -L../lib/lib -g -o pcan-settings
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/test'
... und auch installieren:
Dann ist der angeschlossene CAN-USB-Converter auch zu finden und das Modul kann geladen werden.
Code: Select all
sudo make install
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
Info: /lib/modules/4.14.18-v7+/misc exists.
Info: Copied 45-pcan.rules to /etc/udev/rules.d.
Info: mainline drivers removed and blacklisted in
/etc/modprobe.d/blacklist-peak.conf
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/lib'
mkdir -p /usr/lib
cp -d lib/* /usr/lib
if [ -d lib32 ]; then \
mkdir -p /usr/lib32; \
cp -d lib32/* /usr/lib32; \
fi
mkdir -p /usr/include
chmod 644 libpcan.h libpcanfd.h
cp libpcan.h libpcanfd.h /usr/include
/sbin/ldconfig
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/lib'
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/test'
cp receivetest transmitest bitratetest filtertest pcanfdtst pcan-settings /usr/local/bin
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/test'
root@Raspi_DataHarvest:~/Schreibtisch/can/peak-linux-driver-8.5.1# sudo modprobe pcan
root@Raspi_DataHarvest:~/Schreibtisch/can/peak-linux-driver-8.5.1# cat /proc/pcan
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20171027_n (8.5.1) Feb 19 2018 20:11:01 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 1 interfaces @ major 242 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 022 0x001c 00000000 00000000 00000000 00000000 0x0000
Allerdings ist manchmal nach dem Neustart des Systems (egal ob mit 'shutdown' oder Stecker ziehen) der pcan-Treiber nicht mehr vorhanden!! Warum dies der Fall ist, kann ich mir nicht erklären.
Code: Select all
root@Raspi_DataHarvest:~# cat /proc/pcan
cat: /proc/pcan: Datei oder Verzeichnis nicht gefunden
root@Raspi_DataHarvest:~/Schreibtisch/can/peak-linux-driver-8.5.1# modprobe pcan
modprobe: ERROR: could not insert 'pcan': Invalid argument
modprobe: ERROR: ../libkmod/libkmod-module.c:960 command_do() Error running install command for pcan
modprobe: ERROR: could not insert 'pcan': Operation not permitted
Ich die aktuellen RPI-Kernel-Headers und das "libpopt-dev" Package installiert. Ich habe wie oben ersichtlich keinen NETDEV-Installation, sondern eine CHARDEV-Installation durchgeführt.
Hier meine Kernel-Version:
Code: Select all
root@Raspi_DataHarvest:~/Schreibtisch/can/peak-linux-driver-8.5.1# uname -a
Linux Raspi_DataHarvest 4.14.22-v7+ #1096 SMP Mon Feb 26 19:14:22 GMT 2018 armv7l GNU/Linux
Der CAN-USB-Converter war zwischen den Neustarts IMMER angeschlossen:
Code: Select all
root@Raspi_DataHarvest:~/Schreibtisch/can/peak-linux-driver-8.5.1# lsusb
Bus 001 Device 005: ID 1546:01a7 U-Blox AG
Bus 001 Device 004: ID 2a0b:00f5
Bus 001 Device 006: ID 0c72:000c PEAK System PCAN-USB
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Wenn ich nur make install neu ausführe, bekomme ich sofort einen Fehler:
Code: Select all
root@Raspi_DataHarvest:~/Schreibtisch/can/peak-linux-driver-8.5.1# make install
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
Info: /lib/modules/4.14.22-v7+/misc exists.
cp: der Aufruf von stat für „pcan.ko“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
Makefile:514: recipe for target 'install_files' failed
make[1]: *** [install_files] Error 1
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/driver'
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/lib'
mkdir -p /usr/lib
cp -d lib/* /usr/lib
if [ -d lib32 ]; then \
mkdir -p /usr/lib32; \
cp -d lib32/* /usr/lib32; \
fi
mkdir -p /usr/include
chmod 644 libpcan.h libpcanfd.h
cp libpcan.h libpcanfd.h /usr/include
/sbin/ldconfig
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/lib'
make[1]: Entering directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/test'
cp receivetest transmitest bitratetest filtertest pcanfdtst pcan-settings /usr/local/bin
make[1]: Leaving directory '/root/Schreibtisch/can/peak-linux-driver-8.5.1/test'
root@Raspi_DataHarvest:~/Schreibtisch/can/peak-linux-driver-8.5.1# cat /proc/pcan
cat: /proc/pcan: Datei oder Verzeichnis nicht gefunden
Wenn ich den pcan-Treiber neu installiere (rpi-source; make clean; make <options>; make install) dann funktioniert er wieder - bis irgendwann nach dem Neustart der Treiber wieder nicht verfügbar ist bzw. funktioniert. Woran kann das liegen??
MfG Michael
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Wed 28. Feb 2018, 14:42
by M.Maidhof
Hallo,
bitte pruefen Sie das verwendete Netzteil Ihres Raspberry Pi. Bitte ein ausreichend starkes Netzteil verwenden, damit nach dem Neustart der PCAN_USB und der Treiber geladen werden kann.
Falls der Treiber nach dem Neustart nicht geladen wurde, bitte mal pruefen on der PCAN-USB in dmesg immer erkannt wurde. In diesem Falle sollte ein "sudo modprobe pcan" als pi user (nicht root) ausfuehren genuegen, um den Treiber erneut zu laden.
Sollte das immer noch nichts nuetzen, dann bitte mal einen extern gepowerten USB Hub verwenden.
Mit freundlichen Gruessen
Michael Maidhof
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Mon 19. Mar 2018, 14:47
by felgo
Hi,
I installed the driver on RPi with Raspbian and kernel
4.9.80-v7+
It brings up the netdev device but I can't send/receive messages via the CAN bus.
modprobe pcan && dmesg brings the following output:
Code: Select all
[ 1088.616028] pcan: Tx fifo full: frame 123 dropped, net queue stopped
[ 1198.208767] pcan: PCAN-USB CAN1: BUS OFF
[ 1344.671514] usbcore: deregistering interface driver pcan
[ 1344.671579] pcan: unhandled read data stream turned off (err -108)
[ 1344.671592] pcan: pcan_usb_write_notify(215): USB abnormal err -108
This is the output of cat /proc/pcan:
Code: Select all
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20171027_n (8.5.1) Mar 19 2018 12:57:22 --------------
*---------------------------- [mod] [usb] [net] -----------------------------
*--------------------- 1 interfaces @ major 244 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb can0 ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
I recompiled the driver again for some times with this options:
Code: Select all
make NET=NETDEV_SUPPORT PCI=NO PAR=NO ISA=NO PCC=NO DNG=NO
Thank you for some help with this issue.
Regards Felix
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Mon 19. Mar 2018, 15:14
by S.Grosjean
Hi,
Why do you use the pcan driver instead of our mainline driver peak_usb?
Tip: Uninstall pcan (sudo make uninstall), then reboot your Pi.
As soon as you plug the PCAN-USB then the mainline driver peak_usb should be automatically loaded by the system.
If it isn't, check your Kernel config whether the CONFIG_CAN_PEAK_USB option is set.
Regards,
Stéphane
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Mon 19. Mar 2018, 15:37
by felgo
Hi Stephané,
thanks for your fast response. It seems that on the current Raspbian this option is disabled. So I'll recompile the kernel and try again.
Best regards
Felix
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Wed 15. Aug 2018, 13:52
by newbi
S.Grosjean wrote:Hi,
Why do you use the pcan driver instead of our mainline driver peak_usb?
Tip: Uninstall pcan (sudo make uninstall), then reboot your Pi.
As soon as you plug the PCAN-USB then the mainline driver peak_usb should be automatically loaded by the system.
If it isn't, check your Kernel config whether the CONFIG_CAN_PEAK_USB option is set.
Regards,
Stéphane
Hello Stephane,
I seem to have the same issue, but I have no clue how to set the option CONFIG_CAN_PEAK_USB. I tried this
https://www.raspberrypi.org/documentati ... iguring.md for the Rasberry Pi 3 but I get the error "make: *** No rule to make target 'bcm2709_defconfig'. Stop."
Is there any other way to set this option?
Thanks a lot,
Daniela
Re: PEAK-Linux Driver on Raspberry Pi
Posted: Thu 16. Aug 2018, 11:01
by S.Grosjean
Hi Daniela,
The link you have provided explains how to (cross-)configure a kernel for RPi 1, 2 or 3.
Code: Select all
$ make (blah-blah) bcm2709_defconfig
is the make command that sets the default Kernel configuration that specifically matches the RPi. It must be done on top of the Kernel sources tree. Once done, you will be able to run:
And then, you could set the CONFIG_CAN_PEAK_USB option, following this path:
Code: Select all
[*] Networking support --->
<*> CAN bus subsystem support --->
CAN Device Drivers --->
CAN USB interfaces --->
<M> PEAK PCAN-USB/USB Pro interfaces for CAN 2.0b/CAN-FD
Finally, you should be able to build the Kernel according to:
https://www.raspberrypi.org/documentati ... uilding.md
Regards,
Recipe for target 'all' failed
Posted: Wed 10. Oct 2018, 20:10
by Graf24
Hello,
I am trying to install the PCAN-USB driver on a raspberry pi running Raspbian 4.9, and I am running into a lot of difficulties. Most of the issues have been centered around getting the correct headers installed, but I think I finally did that successfully. Now I am getting the following output when I try to make the makefile:
Code: Select all
pi@raspberrypi:~/Downloads/peak-linux-driver-8.6.0 $ make
make[1]: Entering directory '/home/pi/Downloads/peak-linux-driver-8.6.0/driver'
make[1]: Nothing to be done for 'depend'.
make[1]: Leaving directory '/home/pi/Downloads/peak-linux-driver-8.6.0/driver'
make[1]: Entering directory '/home/pi/Downloads/peak-linux-driver-8.6.0/driver'
***
*** Host machine kernel version=4.9.28-v7+
*** Driver kernel version=4.9.28-v7+ (4.9.28)
*** Path to kernel sources=/usr/src/linux-headers-4.9.28-v7+
*** use KBUILD=yes
*** cc version=4.9.2
***
make -C /usr/src/linux-headers-4.9.28-v7+ SUBDIRS=/home/pi/Downloads/peak-linux-driver-8.6.0/driver EXTRA_CFLAGS="-I/home/pi/Downloads/peak-linux-driver-8.6.0/driver -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DDONGLE_SUPPORT -DPCCARD_SUPPORT -DNO_NETDEV_SUPPORT -DNO_RT -Wno-date-time" V=0 modules
make[2]: Entering directory '/usr/src/linux-headers-4.9.28-v7+'
CC [M] /home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.o
/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.c: In function ‘pcan_pci_enable_msi’:
/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.c:369:2: error: implicit declaration of function ‘pci_alloc_irq_vectors’ [-Werror=implicit-function-declaration]
pa->msi_count = pcan_pci_enable_msi_range(pa->dev, 1, msi_max);
^
/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.c:276:33: error: ‘PCI_IRQ_MSI’ undeclared (first use in this function)
pci_alloc_irq_vectors(a, b, c, PCI_IRQ_MSI)
^
/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.c:369:18: note: in expansion of macro ‘pcan_pci_enable_msi_range’
pa->msi_count = pcan_pci_enable_msi_range(pa->dev, 1, msi_max);
^
/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.c:276:33: note: each undeclared identifier is reported only once for each function it appears in
pci_alloc_irq_vectors(a, b, c, PCI_IRQ_MSI)
^
/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.c:369:18: note: in expansion of macro ‘pcan_pci_enable_msi_range’
pa->msi_count = pcan_pci_enable_msi_range(pa->dev, 1, msi_max);
^
cc1: some warnings being treated as errors
scripts/Makefile.build:293: recipe for target '/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.o' failed
make[3]: *** [/home/pi/Downloads/peak-linux-driver-8.6.0/driver/src/pcan_pci.o] Error 1
Makefile:1490: recipe for target '_module_/home/pi/Downloads/peak-linux-driver-8.6.0/driver' failed
make[2]: *** [_module_/home/pi/Downloads/peak-linux-driver-8.6.0/driver] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.9.28-v7+'
Makefile:452: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/pi/Downloads/peak-linux-driver-8.6.0/driver'
make[1]: Entering directory '/home/pi/Downloads/peak-linux-driver-8.6.0/lib'
cc -DNO_RT -I. -I../driver -fPIC -Wall -Wcast-align -Wredundant-decls -DPCANFD_OLD_STYLE_API -c src/libpcan.c -o obj/libpcan.o
cc -shared -Wl,-soname,libpcan.so.0 -o lib/libpcan.so.0.6 obj/libpcan.o
cd lib/; ln -sf libpcan.so.0.6 libpcan.so
cc -DNO_RT -I. -I../driver -fPIC -Wall -Wcast-align -Wredundant-decls -DPCANFD_OLD_STYLE_API -c src/libpcanfd.c -o obj/libpcanfd.o
cc -shared -Wl,-soname,libpcanfd.so.0 -o lib/libpcanfd.so.0.1 obj/libpcanfd.o
cd lib/; ln -sf libpcanfd.so.0.1 libpcanfd.so
ar rcs lib/libpcanfd.a obj/libpcanfd.o
make[1]: Leaving directory '/home/pi/Downloads/peak-linux-driver-8.6.0/lib'
make[1]: Entering directory '/home/pi/Downloads/peak-linux-driver-8.6.0/test'
cc -DNO_RT -g -I. -I../lib -I../driver src/receivetest.c src/common.c -lpcanfd -L../lib/lib -o receivetest
cc -DNO_RT -g -I. -I../lib -I../driver src/transmitest.cpp src/common.c src/parser.cpp -lpcanfd -lstdc++ -L../lib/lib -o transmitest
cc -DNO_RT -g -I. -I../lib -I../driver src/bitratetest.c src/common.c -lpcanfd -L../lib/lib -o bitratetest
cc -DNO_RT -g -I. -I../lib -I../driver src/filtertest.cpp src/common.c -lpcanfd -lstdc++ -L../lib/lib -o filtertest
cc -DNO_RT -g -I. -I../lib -I../driver src/pcanfdtst.c -lpcanfd -L../lib/lib -o pcanfdtst
cc -DNO_RT -g -I. -I../lib -I../driver src/pcan-settings.c -lpopt -L../lib/lib -g -o pcan-settings
make[1]: Leaving directory '/home/pi/Downloads/peak-linux-driver-8.6.0/test'
Is this working as intended? It doesn't seem to be because if I try to move forward with make install, it tells me that the recipe for target 'install' failed.