CAN interface not showing up

This forum covers PCAN-Linux and Linux development issues concerning our products
Locked
walkerjitzu
Posts: 6
Joined: Wed 5. Feb 2020, 15:31

CAN interface not showing up

Post by walkerjitzu » Wed 5. Feb 2020, 15:46

Hi all, I'm developing an application in Java that communicates with CAN using a Java JNI porting of the Socket Can library. (https://github.com/entropia/libsocket-can-java)
I am using Ubuntu 19.10, and I have installed the peak linux drivers with

Code: Select all

make NET=NETDEV_SUPPORT
sudo make install
sudo modprobe pcan
and the build seems successful, and the driver initialized. I can see /dev/pcanusb32 and /dev/pcan-sb/0/can0 which points to /dev/pcanusb32.
If I open pcanview, I am able to connect to the interface, and correctly send and receive messages.

However, it is not listed in ifconfig.
When I try to retrieve the interface id by its name (pcanusb32) in my application, I get an error resulting from a ioctl call, saying "No such device".

I am not sure what I am doing wrong, any help is appreciated! I already search in this forum and tried many solutions, such as building a charnet or trying different arguments for the build, but they didn't work.

Alessandro

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

Re: CAN interface not showing up

Post by M.Heidemann » Wed 5. Feb 2020, 15:56

Hello Alessandro,

Please send us the output of:



$ cat /proc/pcan



Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

walkerjitzu
Posts: 6
Joined: Wed 5. Feb 2020, 15:31

Re: CAN interface not showing up

Post by walkerjitzu » Wed 5. Feb 2020, 15:59

Thank for the reply, here it is

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20191029_n (8.9.3) Feb  5 2020 15:26:24 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 1 interfaces @ major 235 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb   -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000

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

Re: CAN interface not showing up

Post by M.Heidemann » Wed 5. Feb 2020, 16:14

Hello Alessandro,

This would indicate you have the CharDev driver installed, not the NetDev-version.

The mainline-driver for use with socket can is already included in the kernel! You do not need to install it seperately.

To use SocketCan, do the following:

Change into your driver installation directory, from there execute:

Code: Select all

Sudo make uninstall
Afterwards reboot to reload the mainline kernel driver.

Now you can check your device by calling:

Code: Select all

ip link ls
and bring your device up like:

Code: Select all

sudo ip link set can0 up type can bitrate 500000

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

walkerjitzu
Posts: 6
Joined: Wed 5. Feb 2020, 15:31

Re: CAN interface not showing up

Post by walkerjitzu » Wed 5. Feb 2020, 16:36

Nice! It works... I was not aware of ip link. The only thing is that now pcanview can't find any device

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

Re: CAN interface not showing up

Post by M.Heidemann » Wed 5. Feb 2020, 16:44

Hi,

PCANView, like any appplication written in PCANBasic uses the CharDev-driver.

SocketCAN uses the NetDev-Driver (or Mainline driver, which is included in the kernel).

You have to choose the right driver for your usage.


Best Regards
---
Marvin Heidemann
PEAK-Support Team

walkerjitzu
Posts: 6
Joined: Wed 5. Feb 2020, 15:31

Re: CAN interface not showing up

Post by walkerjitzu » Thu 6. Feb 2020, 10:28

Ok, thank you for clearing that out.

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

Re: CAN interface not showing up

Post by M.Heidemann » Thu 6. Feb 2020, 12:28

Hello Alessandro,

You`re welcome!

closed!
---
Marvin Heidemann
PEAK-Support Team

Locked