PEAK-Linux Driver on Raspberry Pi

This forum covers PCAN-Linux and Linux development issues concerning our products
felgo
Posts: 7
Joined: Tue 16. Feb 2016, 18:57

Re: PEAK-Linux Driver on Raspberry Pi

Post by felgo » Wed 17. Feb 2016, 18:19

Hi Michael,

I'm working with RPi2 and kernel 4.1.13. (current Raspbian), I can modprobe the can modules but ifconfig -a doesn't show any can device. Booting with the 3.18 kernel everthing works fine. Do I have to recompile the 4.1.13 kernel for activating socketcan?
BTW: If I try to compile the peak-linux-driver like you've written above, the pcan module could not be found

Thanks for your support!
Regards
Felix

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Thu 18. Feb 2016, 14:02

Hi,

please follow the follwing post, to check if SocketCAN Config is enabled in your kernel.

http://www.peak-system.com/forum/viewto ... t=80#p4706

Yes, worst case will be to recompile the kernel with that option

To get behind the problem with your peak-linux-driver, we need the output of your build process.

regards

Michael

felgo
Posts: 7
Joined: Tue 16. Feb 2016, 18:57

Re: PEAK-Linux Driver on Raspberry Pi

Post by felgo » Thu 18. Feb 2016, 14:18

Hi Michael,

like Rob discribed above, this file is also not present in my system.

Code: Select all

pi@raspberrypi:~ $ uname -r
4.1.13-v7+
pi@raspberrypi:~ $ ls /boot/config*
/boot/config-3.18.0-trunk-rpi  /boot/config-3.18.0-trunk-rpi2  /boot/config.txt
The output of my driver installation looks like this:

Code: Select all

pi@raspberrypi:~/peak-linux-driver-7.15.2 $ make NET=NO PCI=NO PAR=NO ISA=NO PCC=NO DNG=NO
make[1]: Entering directory '/home/pi/peak-linux-driver-7.15.2/driver'
Makefile:102: *** "Can't find /include/linux/version.h".  Schluss.
make[1]: Leaving directory '/home/pi/peak-linux-driver-7.15.2/driver'
make[1]: Entering directory '/home/pi/peak-linux-driver-7.15.2/driver'
Makefile:102: *** "Can't find /include/linux/version.h".  Schluss.
make[1]: Leaving directory '/home/pi/peak-linux-driver-7.15.2/driver'
make[1]: Entering directory '/home/pi/peak-linux-driver-7.15.2/lib'
cc src/libpcan.c -DNO_RT -I. -I../driver -fPIC -shared -O2 -Wall  -Wl,-soname,libpcan.so.0 -lc  -o libpcan.so.0.6
ln -sf libpcan.so.0.6 libpcan.so
make[1]: Leaving directory '/home/pi/peak-linux-driver-7.15.2/lib'
make[1]: Entering directory '/home/pi/peak-linux-driver-7.15.2/test'
cc -DNO_RT -g -I. -I../lib -I../driver  src/receivetest.c src/common.c  -lpcan -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o receivetest
cc -DNO_RT -g -I. -I../lib -I../driver  src/transmitest.cpp src/common.c src/parser.cpp  -lpcan -L../lib -L/lib -L/usr/lib -L/usr/local/lib -lstdc++ -o transmitest
cc -DNO_RT -g -I. -I../lib -I../driver  src/bitratetest.c src/common.c  -lpcan -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o bitratetest
cc -DNO_RT -g -I. -I../lib -I../driver  src/filtertest.cpp src/common.c  -lpcan -L../lib -L/lib -L/usr/lib -L/usr/local/lib -lstdc++ -o filtertest
cc -DNO_RT -g -I. -I../lib -I../driver  src/pcan-settings.c  -lpcan -L../lib -L/lib -L/usr/lib -L/usr/local/lib -lpopt -g -o pcan-settings
make[1]: Leaving directory '/home/pi/peak-linux-driver-7.15.2/test'
pi@raspberrypi:~/peak-linux-driver-7.15.2 $ sudo make install
make[1]: Entering directory '/home/pi/peak-linux-driver-7.15.2/driver'
Makefile:102: *** "Can't find /include/linux/version.h".  Schluss.
make[1]: Leaving directory '/home/pi/peak-linux-driver-7.15.2/driver'
make[1]: Entering directory '/home/pi/peak-linux-driver-7.15.2/lib'
mkdir -p /usr/lib
cp libpcan.so.0.6 /usr/lib/libpcan.so.0.6
ln -sf /usr/lib/libpcan.so.0.6 /usr/lib/libpcan.so.0
ln -sf /usr/lib/libpcan.so.0 /usr/lib/libpcan.so
mkdir -p /usr/include
cp libpcan.h ../driver/pcan.h /usr/include
chmod 644 /usr/include/libpcan.h /usr/include/pcan.h
/sbin/ldconfig
make[1]: Leaving directory '/home/pi/peak-linux-driver-7.15.2/lib'
make[1]: Entering directory '/home/pi/peak-linux-driver-7.15.2/test'
cp receivetest transmitest bitratetest filtertest pcan-settings /usr/local/bin
make[1]: Leaving directory '/home/pi/peak-linux-driver-7.15.2/test'
pi@raspberrypi:~/peak-linux-driver-7.15.2 $ sudo modprobe pcan
modprobe: FATAL: Module pcan not found.
I have installed all packages that may be necessary (linux-headers, build-essential etc.)

I am not sure, what I am doing wrong or if this is a fundamental problem with 4.1.x kernel.
Regards

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Thu 18. Feb 2016, 15:40

Hi,

the missing version.h means that you haven´t installed the kernel headers. Without headers it is not possible to build a kernel module. It is a known problem, that some of the PI images don´t offer the suitable kernel headers. Please see some older posts in that thread regarding that issue. A good solution was always to install an rpi kernel, for which the needed headerfiles and kernel source were available.

Remember: when you have a kernel image without availabe kernel source, it will also not be possible to configure and recompile the kernel. So this will always be a bad choice under linux, when you want to build own kernel modules.

regards

Michael

felgo
Posts: 7
Joined: Tue 16. Feb 2016, 18:57

Re: PEAK-Linux Driver on Raspberry Pi

Post by felgo » Thu 18. Feb 2016, 18:16

Thanks Michael,
you are right, I installed the linux-headers for the wrong kernel version ;-)
And 4.1.13-v7+ is shipped without kernel-headers.
I now got the driver installed using precompiled heades from here:
https://www.niksula.hut.fi/~mhiienka/Rp ... aders-rpi/
For the installation I used the NET=NETDEV_SUPPORT option and now modprobe pcan an cat /dev/pcan* are working. But now I am faced with the next issue. I can't use socketcan. can0 could not be found. Ifconfig -a doesn't show me any CAN device. I modprobed all the can modules:

Code: Select all

 pi@raspberrypi:~ $ lsmod | grep can
can_bcm                13041  0
can_raw                 7204  0
can_dev                 9607  0
can                    27535  2 can_bcm,can_raw
pcan                   56655  0
Do you have an idea how to get soketcan running?

Regards
Felix

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Fri 19. Feb 2016, 09:30

Hi,

please post the output of cat /proc/pcan

regards

Michael

felgo
Posts: 7
Joined: Tue 16. Feb 2016, 18:57

Re: PEAK-Linux Driver on Raspberry Pi

Post by felgo » Fri 19. Feb 2016, 15:25

Hi,
after reinstalling everything, SocketCAN seems to work now.
For everyone with the same probs, installing PCAN with netdev support on the PRi, I used this manual:
http://qiita.com/mt08/items/6d50193df85 ... B%E3%83%89
(just replace NET=NO with NET=NETDEV_SUPPORT in the make call)
For me, this is running with kernel versions 4.1.17-v7+ and 4.1.13-v7+.
Thanks Micheal and regards

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Tue 28. Jun 2016, 11:39

Hi,

to compile our peak-linux-driver on a RPI you always need the kernel headers which fits to your installed kernel version. When you can´t find the exact kernel headers with apt-get, you could use the following tool, which works perfect on my RPI3 with raspbian jessie and kernel 4.4.13-v7+:

# get & install kernel headers
git clone https://github.com/notro/rpi-source
cd rpi-source
chmod +x rpi-source
sudo apt-get install bc
./rpi-source

# get & install PEAK drivers
wget http://www.peak-system.com/fileadmin/me ... 8.1.tar.gz
tar -xzf peak-linux-driver-8.1.tar.gz
cd peak-linux-driver-8.1

# install required dependencies (peak-driver)
sudo apt-get install libpopt-dev
# build chardev driver
make PCI=NO PCIEC=NO PCC=NO DNG=NO PAR=NO ISA=NO
sudo make install
sudo modprobe pcan

# check PEAK devices
cat /proc/pcan

done!

regards

Michael

roitherm
Posts: 2
Joined: Wed 1. Feb 2017, 15:59

Re: PEAK-Linux Driver on Raspberry Pi

Post by roitherm » Wed 1. Feb 2017, 16:01

Hello!

I tried installing our PAK can adapter on a raspberry pi 2.
most things I found failed, until I read the lines above - I followed that, and now "cat /proc/pcan" gives me:

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20170110_n (8.3.0) Feb  1 2017 14:07:03 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 1 interfaces @ major 243 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb   -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
However I sill don't have a "can0" or similar to talk to. What am I doing wrong?

ps: I need to talk can-open on that interface. preferrably using node-red. does anyone have an idea how I can accomplish this?

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Wed 1. Feb 2017, 16:19

Hi,

you have build the driver 8.3 for chardev (which is the default build since 8.x). If you like to build the driver for Netdev, simply build it again with make NET=NETDEV_SUPPORT.

See driver manual for more details.

regards

Michael

Post Reply