PCAN Driver Linux Raspberry Pi

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
JeanSmith
Posts: 4
Joined: Thu 26. Mar 2020, 06:34

PCAN Driver Linux Raspberry Pi

Post by JeanSmith » Mon 30. Mar 2020, 11:38

I am trying to install the driver: https://www.peak-system.com/fileadmin/m ... /index.htm on my Raspberry Pi 2B, with Raspbian (Version:February 2020
Release date:2020-02-13, Kernel version:4.19).
I followed the instruction in the documentation chatper 3 in: https://www.peak-system.com/fileadmin/m ... /index.htm. Unfortunately i didn't get so far. I got following error.
I appreciate every help. Thanks

Code: Select all

pi@raspberrypi:~/peak-linux-driver-8.10.0 $ make
make[1]: Verzeichnis „/home/pi/peak-linux-driver-8.10.0/driver“ wird betreten
***
*** Making pcan driver in chardev mode
***
*** Host OS Release=Raspbian GNU/Linux v10
*** Host machine kernel version=4.19.97-v7+
*** Driver kernel version=4.19.97-v7+ (4.19.97)
*** Path to kernel sources=/usr/src/linux-headers-4.19.97-v7+
*** use KBUILD=yes
*** gcc version=8
***
make -C /usr/src/linux-headers-4.19.97-v7+  EXTRA_CFLAGS="-I/home/pi/peak-linux-driver-8.10.0/driver -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DDONGLE_SUPPORT -DPCCARD_SUPPORT -DNO_NETDEV_SUPPORT -DNO_RT   -Wno-date-time" V=0 modules SUBDIRS=/home/pi/peak-linux-driver-8.10.0/driver
make[2]: Verzeichnis „/usr/src/linux-headers-4.19.97-v7+“ wird betreten
  CC [M]  /home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.o
/home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.c: In function ‘pcan_pci_enable_msi’:
/home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.c:272:2: error: implicit declaration of function ‘pci_alloc_irq_vectors_affinity’; did you mean ‘pci_alloc_consistent’? [-Werror=implicit-function-declaration]
  pci_alloc_irq_vectors_affinity(a, b, c, PCI_IRQ_MSI, NULL)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.c:369:18: note: in expansion of macro ‘pcan_pci_enable_msi_range’
  pa->msi_count = pcan_pci_enable_msi_range(pa->dev, 1, msi_max);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.c:272:42: error: ‘PCI_IRQ_MSI’ undeclared (first use in this function); did you mean ‘PCI_IOBASE’?
  pci_alloc_irq_vectors_affinity(a, b, c, PCI_IRQ_MSI, NULL)
                                          ^~~~~~~~~~~
/home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.c:369:18: note: in expansion of macro ‘pcan_pci_enable_msi_range’
  pa->msi_count = pcan_pci_enable_msi_range(pa->dev, 1, msi_max);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.c:272:42: note: each undeclared identifier is reported only once for each function it appears in
  pci_alloc_irq_vectors_affinity(a, b, c, PCI_IRQ_MSI, NULL)
                                          ^~~~~~~~~~~
/home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.c:369:18: note: in expansion of macro ‘pcan_pci_enable_msi_range’
  pa->msi_count = pcan_pci_enable_msi_range(pa->dev, 1, msi_max);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:304: /home/pi/peak-linux-driver-8.10.0/driver/src/pcan_pci.o] Fehler 1
make[2]: *** [Makefile:1522: _module_/home/pi/peak-linux-driver-8.10.0/driver] Fehler 2
make[2]: Verzeichnis „/usr/src/linux-headers-4.19.97-v7+“ wird verlassen
make[1]: *** [Makefile:508: all] Fehler 2
make[1]: Verzeichnis „/home/pi/peak-linux-driver-8.10.0/driver“ wird verlassen
make: *** [Makefile:72: all] Fehler 2

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

Re: PCAN Driver Linux Raspberry Pi

Post by M.Heidemann » Mon 30. Mar 2020, 12:09

Hello,

When installing our driver on a raspbian system, there are a few things to note. (You need to install the Kernel-headers, for example)

Have you seen the post by my colleague Michael?

viewtopic.php?f=59&t=3381&p=11967&hilit=raspbian#p11967

This post exaplains in detail how you get our driver to work on a raspbian system.

Please follow the steps outlined in the forum post first and see if this resolves your issue.

Please report back to me, if you were able to make it work.


Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

JeanSmith
Posts: 4
Joined: Thu 26. Mar 2020, 06:34

Re: PCAN Driver Linux Raspberry Pi

Post by JeanSmith » Mon 30. Mar 2020, 13:38

Hello Marvin,

thanks you for your reply. Yes it helped. Now i got it work.

But when i am starting candump: "candump any" for example, i do not get any output.


Also when i am starting the PCAN View for Linux, i got the following message:

Error: Unable to get any valid combiination of BRP/ TSEGx/ SJW for bitrate=2000000 bps, clock=80MHz and Sample Point 7,5o. But i am not able to change the settings.

Do you have an idea , why?

Thanks

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

Re: PCAN Driver Linux Raspberry Pi

Post by M.Heidemann » Mon 30. Mar 2020, 14:25

Hello Jean,

Please note:

There are 2 variants of our driver that serve different purposes:

CharDev driver: This driver is compatible with our PCANBasic API and PCAN-View for Linux. This version is not compatible with SocketCAN (Which candump uses)

NetDev driver: Compatible with the SocketCAN API and the CAN-utilities, such as candump, cansend , etc. This variant does not support PCANBasic and PCAN-View for Linux.

What is your intended usage and which variant of the driver did you install?(Note that the mentioned thread describes both variants)


Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

JeanSmith
Posts: 4
Joined: Thu 26. Mar 2020, 06:34

Re: PCAN Driver Linux Raspberry Pi

Post by JeanSmith » Tue 31. Mar 2020, 11:44

Hello Marvin,

thanks again. okay, if i understand it correctly: just with adding: "NET=NETDEV_SUPPORT" to "make PCC=NO PCI=NO ISA=NO DNG=NO", i can change from the chardev driver (which is the preconfigured driver) to the NETDEV driver?

Now i got both working. But with the NetDev Driver i still get no output with the command "candump any". I have to send a message with "cansend" from an other terminal to see any output.

My goal is to see the whole canbus traffic. With the CharDev driver und Canview it seems that i can see the whole traffic.

Is there a possibility to see the whole canbus traffic with candump ?

Best regards

Jean

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

Re: PCAN Driver Linux Raspberry Pi

Post by M.Heidemann » Tue 31. Mar 2020, 12:01

Hello Jean,

You cannot run both drivers at the same time, you may uninstall the undesired driver before installing the driver you need.

Switching between them would be done by uninstalling the current driver and then rebuilding and reinstalling the other driver.

Regarding candump:

How do you "bring up" (sudo ip link ... ) the device and does it match the bitrate / protocol you have to use (CAN/CAN FD)?

Using the same settings (by sending with the same device) will yield results since the configuration is the same.

Have you compared the Bitrate settings of PCAN-View with the one you want to use with SocketCAN?


Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

JeanSmith
Posts: 4
Joined: Thu 26. Mar 2020, 06:34

Re: PCAN Driver Linux Raspberry Pi

Post by JeanSmith » Wed 1. Apr 2020, 09:35

Regarding candump:

- i have compared both bitrates and tried to use for both the same
- i "bring it up" with: "sudo ip link set can0 type can bitrate 5000" and "sudo ip link set up can0"

I have also tried some other bitrate settings, but it doesn't work

Best Regards

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

Re: PCAN Driver Linux Raspberry Pi

Post by M.Heidemann » Wed 1. Apr 2020, 09:47

Hello,
- i "bring it up" with: "sudo ip link set can0 type can bitrate 5000" and "sudo ip link set up can0"
Using SocketCAN a bitrate-setting of 5000 would equate to 5Kb/s, which is quite the low bitrate.

Did you intent to use 500Kb/s? Then the bitrate would have to be configured as 500000.

Also you can combine the commands like this:

Code: Select all

sudo ip link set can0 up type can bitrate 500000
Also bitrates below 25Kb/s are not supported by our FD-interfaces (For example the PCAN-USB FD), see the product page under "technical specifications":

https://www.peak-system.com/PCAN-USB-FD.365.0.html

The PCAN-USB does support this bitrate, as you can see on the product page under "technical specifications":

https://www.peak-system.com/PCAN-USB.199.0.html

So this also a questions of whether or not the hardware you use is suited for your application.

May i ask which device you currently use?

Also what is you current setup and what devices are involved on the bus?

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Post Reply