Compilation error with PCAN-miniPCIe Single Channel

This forum covers PCAN-Linux and Linux development issues concerning our products
aperlado
Posts: 7
Joined: Fri 6. Jul 2018, 12:25

Compilation error with PCAN-miniPCIe Single Channel

Post by aperlado » Fri 6. Jul 2018, 13:23

Hello,
I'm a bit desperate with the driver of mi can board.
First of all I'm try to establish CAN communication between my PC (Linux Ubuntu 16.04) (kernel 4.13.0-45-generic) and another PC. For that I'm using a PCAN-miniPCIe Single Channel (https://www.peak-system.com/PCAN-miniPC ... html?&L=1#). I download the driver 8.5.1 from the official website (https://www.peak-system.com/fileadmin/m ... /index.htm) and follow all the steps in the documentation, but when I'm try to compile it I obtain two different errors, as you can see in the picture bellow. What i should do?
Attachments
Captura de pantalla de 2018-07-06 13-17-09.png
Captura de pantalla de 2018-07-06 13-17-09.png (254.27 KiB) Viewed 8598 times

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by S.Grosjean » Fri 6. Jul 2018, 15:09

Hi,

The code with "pci_enable_msi_range()" shouldn't be compiled since everything looks like you're running Kernel 4.13:

src/pcan_pci.c; line 278:

Code: Select all

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
#define pcan_pci_enable_msi_range(a, b, c)      \
        pci_alloc_irq_vectors_affinity(a, b, c, PCI_IRQ_MSI, NULL)

#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
#define pcan_pci_enable_msi_range(a, b, c)      pci_enable_msi_range(a, b, c)

#else
Can you give us the output of:

Code: Select all

$ uname -a
About your 2nd issue: the enclosed Documentation says that you have to install the libpopt-dev package to be able to successfully compile the test programs:

Code: Select all

$ sudo apt-get install libpopt-dev
Regards,

Stéphane
— Stéphane

aperlado
Posts: 7
Joined: Fri 6. Jul 2018, 12:25

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by aperlado » Mon 9. Jul 2018, 12:34

Now the second issue its fixed, I don't obtain the error of the popt.h.
The output of "uname -a" is: Linux Carretilla-MXE210 4.13.0-45-generic #50~16.04.1-Ubuntu SMP Wed May 30 11:18:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
And don't understand what i should do with the code of "pci_enable_msi_range()", should i remove it?
Thanks for the support.

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by S.Grosjean » Mon 9. Jul 2018, 13:25

Hi,

Please edit "driver/src/pcan_pci.c" and change line ~278:

Code: Select all

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
into:

Code: Select all

#if 1//LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
then save and rebuild the driver with:

Code: Select all

$ make -C driver
Tell us what happens please...

Regards,

Stéphane
— Stéphane

aperlado
Posts: 7
Joined: Fri 6. Jul 2018, 12:25

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by aperlado » Tue 10. Jul 2018, 08:25

Hi,
I modified the code as you explained to me, for compile it later with "make -C driver". I obtain the next lines, it seems that now its working fine.
Attachments
Captura de pantalla de 2018-07-10 08-14-06.png
Captura de pantalla de 2018-07-10 08-14-06.png (67.24 KiB) Viewed 8502 times

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by S.Grosjean » Tue 10. Jul 2018, 10:15

Hi,

Yes it should. But I don't explain why you have had to do this change: according to your system configuration, your Kernel is 4.13, so the piece of code I told you to change should have been compiled by the compiler...

Tell us now if everything works.

Regards,

Stéphane
— Stéphane

aperlado
Posts: 7
Joined: Fri 6. Jul 2018, 12:25

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by aperlado » Mon 16. Jul 2018, 11:55

Hi,
I still have issues with the communication. My problem now is the next:
First of all I'm using socketcan_bridge to establish the communication, so when I write "ls /dev" to see what devices I can use, I see this:
Captura de pantalla de 2018-07-16 11-48-31.png
Captura de pantalla de 2018-07-16 11-48-31.png (102.69 KiB) Viewed 8326 times
. So i know I can use pcan0 and pcan1, but when I type "sudo ip link set pcan0 up type can bitrate 500000" I obtain the message: "Cannot find device "pcan0"". the same with pcan1.
I dont kwon how test if I configure the driver properly but, I compile it with "make PCC=NO DNG=NO ISA=NO USB=NO PAR=NO" and installed it with: "sudo make install".

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

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by M.Maidhof » Mon 16. Jul 2018, 14:47

please try:

ip link ls

and check which devices you see. Typically they are named can0, can1....

regards

Michael

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by S.Grosjean » Tue 17. Jul 2018, 10:23

Hello,
First of all I'm using socketcan_bridge to establish the communication, so when I write "ls /dev" to see what devices I can use, I see this:
Well if you plan to use "socket-CAN" then you certainly should build the driver with the NET option too:

Code: Select all

$ cd driver
$ make NET=NETDEV_SUPPORT ...
$ sudo make install
Then, you won't see any /dev/pcan* device node anymore but "canX" network interfaces instead.
Then, you'll be able to configrue them with "ip link" tool...

Stéphane
— Stéphane

aperlado
Posts: 7
Joined: Fri 6. Jul 2018, 12:25

Re: Compilation error with PCAN-miniPCIe Single Channel

Post by aperlado » Fri 20. Jul 2018, 11:53

Hi,
I follow your indications, and i obtain new error messages, in this case the error codes are the ones you can see in the next picture:
Captura de pantalla de 2018-07-20 12-00-27.png
Captura de pantalla de 2018-07-20 12-00-27.png (187.95 KiB) Viewed 8255 times

Post Reply