PCAN USB Driver for Beagle Bone Black with Ubuntu

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
Naqqash
Posts: 5
Joined: Wed 24. Sep 2014, 12:12

PCAN USB Driver for Beagle Bone Black with Ubuntu

Post by Naqqash » Mon 3. Nov 2014, 17:49

Hi,

I am trying to install the driver of the Peak PCAN USB for my Beagle Bone Black. I am running ubuntu 14.04 on the beagle bone black with kernel version 3.8.13.bone59.. here is the wiki

http://elinux.org/Beagleboard:Ubuntu_On ... Bone_Black

Thanks to Michael for referring me this post

http://www.peak-system.com/forum/viewto ... f=59&t=256

it helped a lot in installing the driver on my Ubuntu virtual machine and it is working. I mean the driver is successfully installed and I can see it is connected.

Now by using the same procedure I am trying to install the driver for my beagle bone. Initially it was giving me error that version.h file is missing. I found a post here

http://www.peak-system.com/forum/viewto ... bian#p1934

and I have updated the source file headers of beagle bone black. I have used these instruction from the developer may be useful for someone else

https://groups.google.com/forum/#!topic ... 5RLNUGYrAc

Now after updating the kernel header the version.h problem was solved. I again tried to follow the steps mentioned in the previous post for installing drivers for ubuntu but still not successful, see below for the response,

1) make clean

respone:
ubuntu@arm:~$ uname -r
3.8.13-bone59
ubuntu@arm:~$ cd peak-linux-driver-7.13
ubuntu@arm:~/peak-linux-driver-7.13$ make clean
make[1]: Entering directory `/home/ubuntu/peak-linux-driver-7.13/driver'
rm -f src/*o src/*~ src/.*cmd *o *ko *~ .*cmd pcan.mod.c
make[1]: Leaving directory `/home/ubuntu/peak-linux-driver-7.13/driver'
make[1]: Entering directory `/home/ubuntu/peak-linux-driver-7.13/lib'
rm -f src/*~ src/*.o *~ *.so.*
make[1]: Leaving directory `/home/ubuntu/peak-linux-driver-7.13/lib'
make[1]: Entering directory `/home/ubuntu/peak-linux-driver-7.13/test'
rm -f src/*~ src/*.o *~ receivetest transmitest bitratetest filtertest pcan-settings
make[1]: Leaving directory `/home/ubuntu/peak-linux-driver-7.13/test
So far its fine no version.h file problem as before,

2) make NET=NO

response:
ubuntu@arm:~/peak-linux-driver-7.13$ make NET=NO

make[1]: Entering directory `/home/ubuntu/peak-linux-driver-7.13/driver'
make[1]: *** No rule to make target `depend'. Stop.
make[1]: Leaving directory `/home/ubuntu/peak-linux-driver-7.13/driver'
make[1]: Entering directory `/home/ubuntu/peak-linux-driver-7.13/driver'
***
*** Host machine kernel version=3.8.13-bone59
*** Driver kernel version=3.8.13
*** Path to kernel sources=/lib/modules/3.8.13-bone59/build
*** use KBUILD=yes
***
make -C /lib/modules/3.8.13-bone59/build SUBDIRS=/home/ubuntu/peak-linux-driver-7.13/driver EXTRA_CFLAGS="-I/home/ubuntu/peak-linux-driver-7.13/driver -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DDONGLE_SUPPORT -DPCCARD_SUPPORT -DNO -DNO_RT " V=0 modules
make[2]: Entering directory `/usr/src/linux-3.8.13-bone59'
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_main.o
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_fops.o
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_fifo.o
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_filter.o
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_parse.o
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_sja1000.o
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_common.o
CC [M] /home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_pci.o
/home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_pci.c: In function ‘pcan_pci_probe’:
/home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_pci.c:610:2: error: implicit declaration of function ‘pcim_enable_device’ [-Werror=implicit-function-declaration]
err = pcim_enable_device(pciDev);
^
cc1: some warnings being treated as errors
make[3]: *** [/home/ubuntu/peak-linux-driver-7.13/driver/src/pcan_pci.o] Error 1
make[2]: *** [_module_/home/ubuntu/peak-linux-driver-7.13/driver] Error 2
make[2]: Leaving directory `/usr/src/linux-3.8.13-bone59'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/ubuntu/peak-linux-driver-7.13/driver'
make[1]: Entering directory `/home/ubuntu/peak-linux-driver-7.13/lib'
# ln -sf ../driver/pcan.h pcan.h
cc src/libpcan.c -fPIC -shared -O2 -Wall -Wl,-soname,libpcan.so.0 -lc -I. -I../driver -DNO_RT -o libpcan.so.0.6
ln -sf libpcan.so.0.6 libpcan.so
make[1]: Leaving directory `/home/ubuntu/peak-linux-driver-7.13/lib'
make[1]: Entering directory `/home/ubuntu/peak-linux-driver-7.13/test'
cc src/receivetest.c src/common.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o receivetest -lpcan -DNO_RT
cc src/transmitest.cpp src/common.c src/parser.cpp -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o transmitest -lpcan -lstdc++ -DNO_RT
cc src/bitratetest.c src/common.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o bitratetest -lpcan -DNO_RT
cc src/filtertest.cpp src/common.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o filtertest -lpcan -lstdc++ -DNO_RT
cc src/pcan-settings.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o pcan-settings -lpopt -g
make[1]: Leaving directory `/home/ubuntu/peak-linux-driver-7.13/test'
Now if I compare this with my Ubuntu virtual machine when I was installing, the response is not the same because I am having some errors hence can't create the .ko file for the driver and installer is giving an error that .ko file is missing.

I am not sure what to do about it now, any help in this regard will be highly appreciated. Please let me know if more information is required.

Regards,
Naqqash

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

Re: PCAN USB Driver for Beagle Bone Black with Ubuntu

Post by M.Maidhof » Tue 4. Nov 2014, 10:32

Hi,

your BeagleBone device has no PCI bus, so please build the driver without PCI. Best solution will be to build the driver for the PCAN-USB only (see RaspberryPI thread for the build options on such ARM devices):

make NET=NO PCI=NO PAR=NO ISA=NO PCC=NO DNG=NO

regards

Michael

Naqqash
Posts: 5
Joined: Wed 24. Sep 2014, 12:12

Re: PCAN USB Driver for Beagle Bone Black with Ubuntu

Post by Naqqash » Thu 6. Nov 2014, 12:57

Hi Michael,

I had some problem with the ubuntu version so I switched back to the Debain Wheezy and updated the source headers using the same process as I have mentioned above.

Thanks for the suggestion.


Below is the step by step commands and responses;

I have installed the libpopt.dev libarary and g++ before as suggested.

make clean
root@beaglebone:~/peak-linux-driver-7.13# make clean
make[1]: Entering directory `/root/peak-linux-driver-7.13/driver'
rm -f src/*o src/*~ src/.*cmd *o *ko *~ .*cmd pcan.mod.c
make[1]: Leaving directory `/root/peak-linux-driver-7.13/driver'
make[1]: Entering directory `/root/peak-linux-driver-7.13/lib'
rm -f src/*~ src/*.o *~ *.so.*
make[1]: Leaving directory `/root/peak-linux-driver-7.13/lib'
make[1]: Entering directory `/root/peak-linux-driver-7.13/test'
rm -f src/*~ src/*.o *~ receivetest transmitest bitratetest filtertest pcan-settings
make[1]: Leaving directory `/root/peak-linux-driver-7.13/test'

then

make NET=NO PCI=NO PAR=NO ISA=NO PCC=NO DNG=NO
root@beaglebone:~/peak-linux-driver-7.13# make NET=NO PCI=NO PAR=NO ISA=NO PCC=NO DNG=NO
make[1]: Entering directory `/root/peak-linux-driver-7.13/driver'
make[1]: *** No rule to make target `depend'. Stop.
make[1]: Leaving directory `/root/peak-linux-driver-7.13/driver'
make[1]: Entering directory `/root/peak-linux-driver-7.13/driver'
***
*** Host machine kernel version=3.8.13-bone50
*** Driver kernel version=3.8.13
*** Path to kernel sources=/lib/modules/3.8.13-bone50/build
*** use KBUILD=yes
***
make -C /lib/modules/3.8.13-bone50/build SUBDIRS=/root/peak-linux-driver-7.13/driver EXTRA_CFLAGS="-I/root/peak-linux-driver-7.13/driver -DNO_DEBUG -DMODVERSIONS -DNO -DUSB_SUPPORT -DNO -DNO_PCIEC_SUPPORT -DNO -DNO -DNO -DNO -DNO_RT " V=0 modules
make[2]: Entering directory `/usr/src/linux-3.8.13-bone50'
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_main.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_fops.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_fifo.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_filter.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_parse.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_sja1000.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_common.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_usb_core.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_usb.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_usbpro.o
CC [M] /root/peak-linux-driver-7.13/driver/src/pcan_timing.o
LD [M] /root/peak-linux-driver-7.13/driver/pcan.o
Building modules, stage 2.
MODPOST 1 modules
CC /root/peak-linux-driver-7.13/driver/pcan.mod.o
LD [M] /root/peak-linux-driver-7.13/driver/pcan.ko
make[2]: Leaving directory `/usr/src/linux-3.8.13-bone50'
make[1]: Leaving directory `/root/peak-linux-driver-7.13/driver'
make[1]: Entering directory `/root/peak-linux-driver-7.13/lib'
# ln -sf ../driver/pcan.h pcan.h
cc src/libpcan.c -fPIC -shared -O2 -Wall -Wl,-soname,libpcan.so.0 -lc -I. -I../driver -DNO_RT -o libpcan.so.0.6
ln -sf libpcan.so.0.6 libpcan.so
make[1]: Leaving directory `/root/peak-linux-driver-7.13/lib'
make[1]: Entering directory `/root/peak-linux-driver-7.13/test'
cc src/receivetest.c src/common.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o receivetest -lpcan -DNO_RT
cc src/transmitest.cpp src/common.c src/parser.cpp -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o transmitest -lpcan -lstdc++ -DNO_RT
cc src/bitratetest.c src/common.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o bitratetest -lpcan -DNO_RT
cc src/filtertest.cpp src/common.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o filtertest -lpcan -lstdc++ -DNO_RT
cc src/pcan-settings.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o pcan-settings -lpopt -g
make[1]: Leaving directory `/root/peak-linux-driver-7.13/test'
then

sudo make install
root@beaglebone:~/peak-linux-driver-7.13# sudo make install
make[1]: Entering directory `/root/peak-linux-driver-7.13/driver'
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/peak-linux-driver-7.13/driver'
make[1]: Entering directory `/root/peak-linux-driver-7.13/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 /usr/include/libpcan.h
chmod 644 /usr/include/libpcan.h
/sbin/ldconfig
make[1]: Leaving directory `/root/peak-linux-driver-7.13/lib'
make[1]: Entering directory `/root/peak-linux-driver-7.13/test'
cp receivetest /usr/local/bin
cp transmitest /usr/local/bin
cp bitratetest /usr/local/bin
cp filtertest /usr/local/bin
cp pcan-settings /usr/local/bin
make[1]: Leaving directory `/root/peak-linux-driver-7.13/test'
sudo insmod pcan.ko

and then cat /proc/pcan
root@beaglebone:~/peak-linux-driver-7.13/driver# cat /proc/pcan

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20141017_n (7.13.0) Nov 6 2014 11:45:15 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 1 interfaces @ major 240 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 255 0x001c 00000000 00000000 00000000 00000000 0x0000
Thank you very much again Michael for your help.

I hope this post will be useful for anybody working on BBB with Debain or Ubuntu. Don't forget to connect the power cable to your BBB when you will connect the PCAN USB. If driver will not detect the PCAN USB after installing, try rebooting the system.

Regards,
Naqqash

Regards,
Naqqash
Last edited by Naqqash on Thu 6. Nov 2014, 13:46, edited 1 time in total.

Naqqash
Posts: 5
Joined: Wed 24. Sep 2014, 12:12

Re: PCAN USB Driver for Beagle Bone Black with Ubuntu

Post by Naqqash » Thu 6. Nov 2014, 13:08

Problem solved see the above post.

Post Reply