HowTo install the peak-linux-driver on a RPI Raspbian image

This forum covers PCAN-Linux and Linux development issues concerning our products
M.Maidhof
Support
Support
Posts: 1434
Joined: Wed 22. Sep 2010, 14:00

HowTo install the peak-linux-driver on a RPI Raspbian image

Post by M.Maidhof » Thu 15. Aug 2019, 11:34

Hi,

we often get asked about how to install the drivers for our PCAN-USB devices on a Raspberry PI. Here a small guide which I have tested on my RPI 4 with the 2019-07-10-raspbian-buster.img:

- download the latest raspbian image and install it on a sd card using Win32DiskImager or any other tool
- boot your RPI, and setup all necessary settings (language, network etc.)
- now update your PI to the latest version and reboot once:
- sudo apt get update
- sudo apt get upgrade
- reboot
- install the kernel headers: sudo apt-get install raspberrypi-kernel-headers
- install libpopt-dev: sudo apt-get install libpopt-dev

Now download the peak-linux driver-8.9 (or newer) from our linux website and put it into the /home/pi directory:
- tar -xzf peak-linux-driver-8.9.0.tar.gz
- cd peak-linux-driver-8.9.0
- make clean
- make PCC=NO PCI=NO ISA=NO DNG=NO
- sudo make install
- sudo modprobe pcan
- cat /proc/pcan should now show all connected PCAN-USB devices.
- you can now use all chardev tools and libs to work with the PCAN-USB devices

If you want to use the SocketCAN driver, simply uninstall the driver again, and compile it with the following option:
- sudo make uninstall
- make clean
- make PCC=NO PCI=NO ISA=NO DNG=NO NET=NETDEV_SUPPORT
- sudo make install
- sudo modprobe pcan
- cat /proc/pcan should now show all connected PCAN-USB as canX devices.
- you can now install the can-utils and setup the devices with sudo ip link set can0 up type can bitrate 500000 and use the can-utils tools like "candump can0" to trace the connected CAN bus.

regards

Michael

lchen
Posts: 1
Joined: Fri 13. Sep 2019, 17:10

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by lchen » Fri 13. Sep 2019, 17:16

Hi,

Thank you for the detailed instructions.

I am trying to install the peak can driver on my raspberry pi, I followed the instructions but met a problem when executing the make command. the following error occurred.

Code: Select all

make PCC=NO PCI=NO ISA=NO DNG=NO

make[1]: Entering directory '/home/pi/peak-linux-driver-8.9.0/driver'
***
*** Making pcan driver in chardev mode
***
*** Host machine kernel version=4.9.76-rt60-v7+
*** Driver kernel version=4.9.76-rt60-v7+ (4.9.76)
*** Path to kernel sources=/usr/src/linux-headers-4.9.76-rt60-v7+
*** use KBUILD=yes
*** gcc version=6.3.0
***
make -C /usr/src/linux-headers-4.9.76-rt60-v7+  EXTRA_CFLAGS="-I/home/pi/peak-linux-driver-8.9.0/driver -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DNO -DNO_PCIEC_SUPPORT -DNO -DNO -DNO -DNO_NETDEV_SUPPORT -DNO_RT  -Wno-date-time" V=0 modules SUBDIRS=/home/pi/peak-linux-driver-8.9.0/driver
make[2]: Entering directory '/usr/src/linux-headers-4.9.76-rt60-v7+'
  CC [M]  /home/pi/peak-linux-driver-8.9.0/driver/src/pcan_main.o
/bin/sh: 1: scripts/basic/fixdep: not found
scripts/Makefile.build:293: recipe for target '/home/pi/peak-linux-driver-8.9.0/driver/src/pcan_main.o' failed
make[3]: *** [/home/pi/peak-linux-driver-8.9.0/driver/src/pcan_main.o] Error 127
Makefile:1497: recipe for target '_module_/home/pi/peak-linux-driver-8.9.0/driver' failed
make[2]: *** [_module_/home/pi/peak-linux-driver-8.9.0/driver] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.9.76-rt60-v7+'
Makefile:474: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/pi/peak-linux-driver-8.9.0/driver'
Makefile:91: recipe for target 'all' failed
make: *** [all] Error 2
It seems that fixdep couldn't be found in the installed kernel header. I can find a fixdep.c in the script/basic folder though.

Could you please let me know how to fix this?
Thank you in advance for your help.
Last edited by M.Gerber on Mon 16. Sep 2019, 11:24, edited 1 time in total.
Reason: Inserted [code] tags for improved readability

User avatar
S.Grosjean
Software Development
Software Development
Posts: 311
Joined: Wed 4. Jul 2012, 17:02

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by S.Grosjean » Mon 16. Sep 2019, 09:08

Hi,

Either your linux-headers package is wrong or it has not been correctly installed. Try to purge then reinstall it.

Regards,
— Stéphane

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

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by M.Maidhof » Tue 17. Sep 2019, 09:45

@Ichen: it looks like you didn't use the Raspbian image: 2019-07-10-raspbian-buster.img

with this image you will have a kernel 4.19 and my guide was made for this image only!

regards

Michael

Cluni
Posts: 5
Joined: Mon 16. Dec 2019, 09:18

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by Cluni » Mon 16. Dec 2019, 09:28

Good morning,

I have a problem with installing the drivers on my Raspbian Buster (Linux version 4.19.88-v7+). Last week I could follow your instructions and everything was fine - I could connect to my PCAN-USB. Suddenly - I don't know what happened in between - I couldn't connect anymore to the PCAN-USB. For this reason I tried to reinstall everything again. Now I still get errors while follow your instructions:
pi@RPi-Logger:~/peak-linux-driver-8.9.3 $ make clean
make[1]: Verzeichnis „/home/pi/peak-linux-driver-8.9.3/driver“ wird betreten
Makefile:104: *** "Unable to automatically find the Kernel headers. These are mandatory to build the pcan driver. Please set the KERNEL_LOCATION variable to the root directory of your own built Kernel.". Schluss.
make[1]: Verzeichnis „/home/pi/peak-linux-driver-8.9.3/driver“ wird verlassen
make: *** [Makefile:106: clean] Fehler 2
EDIT: I also reinstalled the kernel headers and libpopt-dev. Without success... :(

I hope you can tell me what I am doing wrong....

Best regards,
Bernd

M.Heidemann
Sales & Support
Sales & Support
Posts: 786
Joined: Fri 20. Sep 2019, 13:31

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by M.Heidemann » Mon 16. Dec 2019, 10:05

Hello Bernd,

How did you update to Kernel 4.19.88?

Using official sources (via apt-get upgrade) the latest kernel you can update to is 4.19.75.

Did you use rpi-update by any chance?


Best Regards

Marvin

Cluni
Posts: 5
Joined: Mon 16. Dec 2019, 09:18

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by Cluni » Mon 16. Dec 2019, 10:12

Hi Marvin,

thank you for your fast reply. Indeed I did an rpi-update - I can't remember for what reason. I think I tried it to get rid of another problem. Is there a chance to get back? :shock:

Best regards,
Bernd

M.Heidemann
Sales & Support
Sales & Support
Posts: 786
Joined: Fri 20. Sep 2019, 13:31

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by M.Heidemann » Mon 16. Dec 2019, 10:26

Hello Bernd,

Unfortunately, once rpi-update has done its work there are two options available:
You either get the kernel-headers for the kernel or you have to start from scratch again.

If possible, do not use rpi-update when using our devices/drivers, since it introduces issues like this.


Best Regards

Marvin

Cluni
Posts: 5
Joined: Mon 16. Dec 2019, 09:18

Re: HowTo install the peak-linux-driver on a RPI Raspbian im

Post by Cluni » Mon 16. Dec 2019, 10:54

Hi Marvin,

big thx for your help. I did a rollback to 4.19.75 by rpi-update. The hint how to do this I found at this website:
https://www.elektronik-kompendium.de/si ... 006061.htm

So I was able to rollback with "sudo rpi-update d9321aceacfc6619b4238c6c764203b1122f2f9b"

It seems that everything is fine again... :)

Best regards,
Bernd

luthfan.taris
Posts: 1
Joined: Tue 1. Sep 2020, 03:46

Re: HowTo install the peak-linux-driver on a RPI Raspbian image

Post by luthfan.taris » Thu 18. Nov 2021, 03:47

Hello,

i dont know if anyone would answer this 2 years old thread

I am having same problem with @Bernd, but my kernel version is 4.19.75-v7l+
make[1]: Entering directory '/home/pi/peak-linux-driver-8.10.1/driver'
Makefile:117: *** "Unable to automatically find the Kernel headers. These are mandatory to build the pcan driver. Please set the KERNEL_LOCATION variable to the root directory of your own built Kernel.". Stop.
make[1]: Leaving directory '/home/pi/peak-linux-driver-8.10.1/driver'
make: *** [Makefile:87: clean] Error 2
Is it only works for exact same Peak driver version ?

Regards,
Luthfan

Post Reply