PCAN-USB Driver install on Debian Beaglebone - version.h err

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
chintanp
Posts: 4
Joined: Wed 3. Aug 2016, 22:31

PCAN-USB Driver install on Debian Beaglebone - version.h err

Post by chintanp » Wed 3. Aug 2016, 23:37

Dear Forum,

I have referred to the posts:
1. Howto install the PEAK Linux driver on a fresh Ubuntu
2. PCAN USB Driver for Beagle Bone Black with Ubuntu

and while the OP in the later post does say he moves to Debian eventually, the steps he mentioned to reach the solution did not work for me.

About my system:
PCAN-USB adapter bought in July-2016.
Beaglebone black with Debian 8.4 released 2016-05-13
uname -a : Linux beaglebone 4.4.9-ti-r25 #1 SMP Thu May 5 23:08:13 UTC 2016 armv7l GNU/Linux
Peak linux driver used: 7.4 (from http://www.peak-system.com/fileadmin/me ... /index.htm)

make clean

Code: Select all

root@beaglebone:~/peak-linux-driver-7.4# make clean
make[1]: Entering directory '/root/peak-linux-driver-7.4/driver'
Makefile:94: *** "Can't find /lib/modules/4.4.9-ti-r25/build/include/linux/version.h !".  Stop.
make[1]: Leaving directory '/root/peak-linux-driver-7.4/driver'
make[1]: Entering directory '/root/peak-linux-driver-7.4/lib'
rm -f src/*~ src/*.o *~ *.so.*
make[1]: Leaving directory '/root/peak-linux-driver-7.4/lib'
make[1]: Entering directory '/root/peak-linux-driver-7.4/test'
rm -f src/*~ src/*.o *~ receivetest transmitest bitratetest filtertest pcan-settings
make[1]: Leaving directory '/root/peak-linux-driver-7.4/test'
I had tried the other commands with suggested flags, but I am getting the same error of version.h in all.

A solution to this on the later link was to install 'kernel headers' from https://eewiki.net/display/linuxonarm/B ... inuxKernel , but I am getting the same error on running

Code: Select all

git checkout origin/am33x-v4.4 -b tmp
and

Code: Select all

./build_kernel.sh
Are there any other steps I need to follow after the building step? Is this the correct version of PeakCAN USB driver I should be using? Any other suggestions, help in debugging is highly appreciated.

Thanks

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

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by M.Maidhof » Thu 4. Aug 2016, 15:21

Hi,

do you like to use the PCAN-USB with the SocketCAN netdev driver or with the Chardev driver?

If you like to use the chardev driver, you need to install the kernel headers:

http://elinux.org/Beagleboard:BeagleBon ... el_headers

regards

Michael

chintanp
Posts: 4
Joined: Wed 3. Aug 2016, 22:31

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by chintanp » Thu 4. Aug 2016, 19:14

Thanks Michael for your response.

I think I prefer the SocketCAN drivers. What is the difference between the two implementations ?

Also, which version of the PeakCAN linux driver is suitable for my system ?

chintanp
Posts: 4
Joined: Wed 3. Aug 2016, 22:31

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by chintanp » Fri 5. Aug 2016, 00:11

Also, I am getting the same error after installing the linux headers via the apt-get command.

apt-get install

Code: Select all

root@beaglebone:~/peak-linux-driver-7.4# sudo apt-get install linux-headers-`uname -r`
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-4.4.9-ti-r25 is already the newest version.
The following packages were automatically installed and are no longer required:
  libaudio2 libmng1 libqt4-network libqt4-xml libqtcore4 libqtdbus4 libqtgui4 qtcore4-l10n
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
make clean

Code: Select all

root@beaglebone:~/peak-linux-driver-7.4# make clean
make[1]: Entering directory '/root/peak-linux-driver-7.4/driver'
Makefile:94: *** "Can't find /lib/modules/4.4.9-ti-r25/build/include/linux/version.h !".  Stop.
make[1]: Leaving directory '/root/peak-linux-driver-7.4/driver'
make[1]: Entering directory '/root/peak-linux-driver-7.4/lib'
rm -f src/*~ src/*.o *~ *.so.*
make[1]: Leaving directory '/root/peak-linux-driver-7.4/lib'
make[1]: Entering directory '/root/peak-linux-driver-7.4/test'
rm -f src/*~ src/*.o *~ receivetest transmitest bitratetest filtertest pcan-settings
make[1]: Leaving directory '/root/peak-linux-driver-7.4/test'
root@beaglebone:~/peak-linux-driver-7.4#

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by O.Hartkopp » Fri 5. Aug 2016, 21:37

chintanp wrote:Thanks Michael for your response.

I think I prefer the SocketCAN drivers. What is the difference between the two implementations ?

Also, which version of the PeakCAN linux driver is suitable for my system ?
With Linux Kernel 4.4 you already have the latest & greatest SocketCAN drivers installed.

Just plug-in your PEAK USB adapter,check with 'dmesg' that it was recognized and then you can configure the bitrate with the 'ip' tool (you already have on your Beaglebone).

See https://www.kernel.org/doc/Documentatio ... ng/can.txt (chapter 6.5).

You can also run 'apt-get install can-utils' there to get the tools you usually find at https://github.com/linux-can/can-utils .

The Mainline Linux CAN driver (aka SocketCAN) is the Linux standard.
Fortunately PEAK System also supports the Mainline drivers for all their PC CAN Hardware.

Additionally PEAK provides an out-of-tree driver which provides a character device driver model and a netdevice driver model which supports older Kernels too. But you don't need to compile the PEAK driver for your use-case. Just plug-in the USB adapter & have fun :)

chintanp
Posts: 4
Joined: Wed 3. Aug 2016, 22:31

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by chintanp » Sat 6. Aug 2016, 01:03

Thanks for your reply O. Hartkopp.

It works. Yay!!

I wasted a lot of hours trying to compile something I didnt need. Maybe no one else will have to.

Just to detail the answer,

dmesg

Code: Select all

root@beaglebone:/var/lib/cloud9# dmesg | grep can
[   12.079539] peak_usb 1-1:1.0 can0: attached to PCAN-USB channel 0 (device 255)
[   23.105197] c_can_platform 481cc000.can: c_can_platform device registered (regs=fa1cc000, irq=207)
[   23.149377] c_can_platform 481d0000.can: c_can_platform device registered (regs=fa1d0000, irq=208)
and then I just had to

Code: Select all

ip link set can0 up type can bitrate 500000


Replace 500000 with the bitrate for your device and then

Code: Select all

ifconfig can0 up

to bring the interface up.

Finally,

Code: Select all

candump -l any,0:0,#FFFFFFFF
and voila, the data starts flowing.

Thanks again. ;) :D

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by O.Hartkopp » Sun 7. Aug 2016, 17:49

chintanp wrote:I wasted a lot of hours trying to compile something I didnt need. Maybe no one else will have to.
I wonder if it would make sense for PEAK to emphasize their effort for the Mainline Linux support?!?

E.g. by placing some prominent Pop-Up/Note on the Linux driver download site when the user wants to start the download, which gives an overview which PEAK hardware which is already supported by Mainline Linux (e.g. PCAN-USB FD since Linux 4.0,...).

So that they make to absolutely clear under which conditions it makes sense to download and use the PEAK Linux driver, e.g. when you have software that already supports the chardev driver model or when the hardware is not supported in the Linux kernel the user wants to run.

Regards,
Oliver

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

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by M.Maidhof » Mon 8. Aug 2016, 09:45

Hi,

well, thats why I asked, which driver version should be used. And when you have read the manual of our driver, you will see a big highlighted note about the use of the mainline kernel drivers, when you like to use SocketCAN.
So reading the manual will always be very helpfull to save time!
Linux-manual.JPG
Linux-manual.JPG (114.14 KiB) Viewed 13955 times
regards

Michael

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by O.Hartkopp » Mon 8. Aug 2016, 10:58

M.Maidhof wrote: So reading the manual will always be very helpfull to save time!
:D

It is. But the question is whether we can assume that people are always reading the manual ...

The usual way may be:
  • 1. Buy some PEAK hardware
    2. See the driver DVD shipped with the hardware
    3. Check for the latest version on the website
    4. Oh! A Linux driver!
    5. Download & unpack the Linux driver
    6. try make && make install
    7. When it fails -> read PDF manual / contact PEAK forum
In the case of chintanp it took him hours to get to the point that he didn't need the extra driver.

That's why I suggested to give that hint about the already existing Linux Mainline drivers more visible.
E.g. when downloading the driver - or when invoking 'make'.
Maybe 'make' could take a look into the kernel modules that are already installed in the system and give some output like:

"The drivers for PEAK hardware PCAN USB, PCAN USB pro, PCAN PCMCIA , ... are already installed on your system. Please check the PDF manual if you really want to use this driver (Continue/Quit)"

... just an idea.

Best regards,
Oliver

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

Re: PCAN-USB Driver install on Debian Beaglebone - version.h

Post by M.Maidhof » Tue 9. Aug 2016, 09:29

Hi Oliver,

yes, looking from the "SocketCAN" side on that issue you are right. But we have lot of customers prefering the chardev driver instead. So should the kernel driver also display "when you like to use the PEAK chardev driver, please install latest peak-linux-driver-X.XX"? :D

regards

Michael

Post Reply