PEAK-Linux Driver on Raspberry Pi

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

Re: PEAK-Linux Driver on Raspberry Pi

Post by Naqqash » Thu 30. Oct 2014, 14:46

M.Maidhof wrote:Hi,

thanks for the info. We have tested our driver on an older BeagleBoard XM with Ubuntu 12.04 without problems, so I see no problem to use the PCAN-USB with the Beagle bone black too, as long as your used distribution offers the kernel headers for the installed kernel.

BTW: PCAN-Explorer is a Windows software and will not work on any Linux based system.

regards

Michael

Hey Michael,

Thank you very much for the reply. Can you please provide some documentation about using the 'peak usb to can adapter' with linux (beaglebone) systems. I am trying to use it with beagle bone black. Any help in this regard will be appreciated.

Actually, it will be really nice if you can provide detailed information of installing the driver on beagle bone like you did for Raspberry Pi here (http://www.peak-system.com/forum/viewto ... t=10#p2015)

At the moment I am using the Angström distribution kernel 3.8.13. I can change the distribution to Debain if Angström is a problem or not supported.


Regards,
Naqqash

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

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Thu 30. Oct 2014, 16:51

Hi,

when you use a debian or ubuntu based system on your BeagleBoard/BeagleBone, please follow the guide as written in the manual of our driver or here in the forum:

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

btw: please start a new thread for your beaglebone problems, we should keep that one for RaspberryPi questions only

regards

Michael

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

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Fri 21. Nov 2014, 13:09

Hi,

after all those offtopic posts, here some news regarding the use of the PCAN-USB with the latest RASPIAN Debian Wheezy from September 2014 (2014-09-09):

After setup the sd card, boot the system, expand the file system and connect your PI by WLAN or Ethernet to your network. Follow the following steps:

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
sudo reboot
sudo apt-get install linux-image-rpi-rpfv
sudo nano /boot/config.txt

- insert the following lines at the end of that file:
kernel=vmlinuz-3.12-1-rpi
initramfs initrd.img-3.12-1-rpi followkernel

- save the settings and call sudo reboot again.

- after the reboot uname -r will show:
3.12-1-rpi

- with that rpi kernel you could directly use the PCAN-USB with the netdev driver, ifconfig will show a can0 device:

ifconfig -a
can0 Link encap:UNSPEC Hardware Adresse 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 Metrik:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

- set the baudrate and activate the device:
sudo ip link set can0 type can bitrate 500000
sudo ip link set can0 up

- now you can use the NetDev Tools to communicate with the PCAN-USB.

****************************************************************************************************************

- if you like to use our chardev driver instead, you have to install the kernel headers first:
sudo apt-get install linux-headers-3.12-1-rpi

- download the PEAK Linux driver:
wget http://www.peak-system.com/fileadmin/me ... .13.tar.gz

- Install libpopt, to prevent a missing file error for the test tools:
sudo apt-get install libpopt-dev

- and unpack and install the driver:
tar -xzf peak-linux-driver-7.13.tar.gz
cd peak-linux-driver-7.13/
make clean
make NET=NO PCC=NO PCI=NO ISA=NO DNG=NO PAR=NO
sudo make install
sudo modprobe pcan
cat /proc/pcan

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20141017_n (7.13.0) Nov 21 2014 13:01:54 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 1 interfaces @ major 247 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 003 0x001c 00000000 00000000 00000000 00000000 0x0000

- receive messages @500k:
cat /dev/pcan32
m s 0x00000111 8 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 93486 003
m s 0x00000111 8 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 94047 667
m s 0x00000112 8 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 95269 256
m s 0x00000112 8 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 95525 597
m s 0x00000113 8 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 96301 491
m s 0x00000113 8 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 96801 544

regards

Michael

aptjnuec
Posts: 1
Joined: Wed 4. Feb 2015, 15:52

Re: PEAK-Linux Driver on Raspberry Pi

Post by aptjnuec » Wed 4. Feb 2015, 17:17

Hello Michael,
can you please direct me to some API's or some sample code to test netDev driver.
I have tried testing it with general socket programming something similar to sample code available here http://en.wikipedia.org/wiki/SocketCAN, but I am not able to see transmitted messages at the output of PCAN USB device.

output for the command
#ip -d link show can0

12: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10
link/can
can state ERROR-ACTIVE restart-ms 0
bitrate 500000 sample-point 0.875
tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
clock 8000000

Regards,
Arpit

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

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Thu 5. Feb 2015, 10:34

Hi,

which software/tools did you use to transmit frames? Please use the SocketCAN Tools

- Install git:
sudo apt-get install git
- Get the SocketCAN Tools:
git clone https://github.com/linux-can/can-utils
- build and install the tools:
cd can-utils
make

See also: https://www.kernel.org/doc/Documentatio ... ng/can.txt

regards

Michael

vission
Posts: 1
Joined: Tue 31. Mar 2015, 22:33

Re: PEAK-Linux Driver on Raspberry Pi

Post by vission » Tue 31. Mar 2015, 22:39

Hi,

I tried your installation guidline from 21.11 to get the PCAN USB running on RASPBIAN!

But it didn't work, after changing config.txt the system was not starting up anymore!

So my question is how to procced with RASPBIAN 2015-02-16 with Kernel
3.18.10+

I'm quite new in Raspberry and Linux!

Thanks a lot
Andi

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

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Wed 1. Apr 2015, 09:47

Hi,

here a short info, how it works on the new RPI2:

sudo apt-get install -y linux-image-rpi2-rpfv linux-headers-rpi2-rpfv
echo -e "kernel=vmlinuz-3.18.0-trunk-rpi2\ninitramfs initrd.img-3.18.0-trunk-rpi followkernel" | sudo tee -a /boot/config.txt
sudo reboot

wget http://www.peak-system.com/fileadmin/me ... .14.tar.gz

tar -xzf peak-linux-driver-7.14.tar.gz
cd peak-linux-driver-7.14/
sudo apt-get install libpopt-dev
make clean
make NET=NO PCI=NO PCC=NO ISA=NO DNG=NO PAR=NO
sudo make install
sudo modprobe pcan
cat /proc/pcan

pi@raspberrypi ~/peak-linux-driver-7.14 $ cat /proc/pcan

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20141219_n (7.14.0) Mar 4 2015 16:10:01 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 2 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usbpfd -NA- ffffffff 255 0x001c 00000000 00000000 00000000 00000000 0x0000
33 usbpfd -NA- ffffffff 255 0x001c 00000000 00000000 00000000 00000000 0x0000

Note: you have to set the config.txt depending on the kernel version you have installed! When you have a rpi instead of a rpi2, you have to load the rpi kernel.

regards

Michael

nexulm
Posts: 2
Joined: Wed 1. Apr 2015, 13:28

Re: PEAK-Linux Driver on Raspberry Pi

Post by nexulm » Wed 1. Apr 2015, 17:04

M.Maidhof wrote: *------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20141219_n (7.14.0) Mar 4 2015 16:10:01 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 2 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usbpfd -NA- ffffffff 255 0x001c 00000000 00000000 00000000 00000000 0x0000
33 usbpfd -NA- ffffffff 255 0x001c 00000000 00000000 00000000 00000000 0x0000
Is CAN-FD already supported with the chardev driver as mentioned here?
I didn't find a hint within the driver manual (v7.14) how to set up the two different bitrate. Only the standard bitrate is mentioned within the manual.

At the end I've patched my Raspbian Kernel 3.18.9 with the latest netdev driver (peak_usb) changes from current mainline kernel 4.0rc6.
It was more tricky than expected but now the PCAN-USB pro FD is running fine for me on my ODROID-W with Raspbian (2015-02-16).

Regards
Michael

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

Re: PEAK-Linux Driver on Raspberry Pi

Post by M.Maidhof » Wed 1. Apr 2015, 17:59

Hi,

the PCAN-USB-FD and PCAN-USB-Pro FD are supported since driver 7.14, but only for CAN 2.0a/b (non FD). When you like to use FD under Linux, please use Kernel Version 4.x (in which both devices will be supported with SocketCAN/NetDev interface). The support for the chardev FD driver will be released soon.

regards

Michael

Johnny
Posts: 2
Joined: Mon 23. Nov 2015, 11:03

Re: PEAK-Linux Driver on Raspberry Pi

Post by Johnny » Mon 23. Nov 2015, 12:07

M.Maidhof wrote:Hi,

the PCAN-USB-FD and PCAN-USB-Pro FD are supported since driver 7.14, but only for CAN 2.0a/b (non FD). When you like to use FD under Linux, please use Kernel Version 4.x (in which both devices will be supported with SocketCAN/NetDev interface). The support for the chardev FD driver will be released soon.

regards

Michael
Hello Michael,

regarding to your last post I tried to get the PCAN-USB-Pro FD running on a Raspi using the newest Kernel (4.1.7-v7+).
Unfortunately it does not work.
To my opinion (I’m not very experienced in Linux :| ) I have two mayor problems.
1) Using ifconfig -a -> No CAN-Device is shown
2) I’m not able to locate the header files for this Kernel
Do you have any idea to get your DONGLE running on this system?

regards

Johnny

Post Reply