Installing the drivers is relatively straight-foward on a clean linux system (a fair bit more complicated with a Xenomai based system), but there are still a few quirks that can get in your way. I've described a simple way that works for us.
Starting with a fresh install of linux, the first thing you probably want to do is add some new users, eg:
adduser (name)And perhaps add the user to admin group:
sudo usermod -a -G admin (name)Then you need to make sure gcc, g++ have been installed, and the system is up to date. Having wget and a browser are always handy too. With ubuntu we can use apt:
sudo apt-get update sudo apt-get install lynx sudo apt-get install gcc sudo apt-get install g++Next, we need to ensure we have our linux header files. Find out your linux version:
uname -rAnd install the linux headers, eg:
sudo apt-get install linux-headers-$(uname -r)Now we need a symbolic link to this for the CAN driver to compile.
So you need to find your linux 'version.h' file. (You can try whereis/locate). eg, mine is at:
/usr/src/linux-headers-2.6.31-14-generic-pae/include/linux/version.hSo you need to make a new symbolic link there:
cd /usr/src sudo ln -s linux-headers-2.6.31-14-generic-pae linux
We are now ready to compile the driver, but first, we need to get it. Go back to your home directory and download the driver:
cd ~/ wget http://www.peak-system.com/fileadmin/media/linux/files/peak-linux-driver.6.15.tar.gzThen extract:
tar -xvf peak-linux-driver.6.15.tar.gz cd peak-linux-driver-6.15Now we are ready to compile! (and install the libraries)
make clean make NET=NO sudo make installNow we can load the driver (if it isn't already):
cd driver sudo /sbin/modprobe pcanAnd we are all done!
Now, we can check if it is ok:
cat /proc/pcan cat /dev/pcan0 cat /dev/pcan1
If you have the dual-channel version you can try sending some data with a terminated CAN cable between the hardware modules. Example:
console1: cat /dev/pcan32 console2: echo "m s 0x111 2 0x12 0x34">/dev/pcan0console1 will receive:
m s 0x00000111 2 0x12 0x34 310146 619