Page 1 of 2

Cannot connect with PCAN device

Posted: Thu 11. Apr 2019, 16:56
by afvillamil231
Hi,

I am trying to connect with a motor that uses CANopen through the PCAN-USB interface. once i try to connect a network from python with the command

network.connect(bustype='pcan', channel='PCAN_USBBUS1', bitrate=250000)

I get the following error

Code: Select all

1554993945.673387: ERROR: failed to scan directory (errno=2) '/sys/class/pcan'
1554993945.673405: ERROR: failed to open file (errno=2) '/sys/class/pcan/version'.
Traceback (most recent call last):
  File "1CANopen_com.py", line 14, in <module>
    network.connect(bustype='pcan', channel='PCAN_USBBUS1', bitrate=250000)
  File "/home/felipe/.local/lib/python2.7/site-packages/canopen/network.py", line 109, in connect
    self.bus = can.interface.Bus(*args, **kwargs)
  File "/home/felipe/.local/lib/python2.7/site-packages/can/interface.py", line 127, in __new__
    return cls(channel, *args, **config)
  File "/home/felipe/.local/lib/python2.7/site-packages/can/interfaces/pcan/pcan.py", line 108, in __init__
    raise PcanError(self._get_formatted_error(result))
can.interfaces.pcan.pcan.PcanError: The driver is not loaded
If I restart my pc and try again i only get

Code: Select all

1554993851.281737: ERROR: failed to scan directory (errno=2) '/sys/class/pcan'
1554993851.281785: ERROR: failed to open file (errno=2) '/sys/class/pcan/version'.
Segmentation fault (core dumped)

Please let me know if you know how to correct this error. Thanks in advance!!

Re: Cannot connect with PCAN device

Posted: Thu 11. Apr 2019, 17:22
by M.Maidhof
Hi,

we don´t know that canpopen python script your are using, but it looks like it is using the PCANBasic API and the chardev driver. Did you install both? Please post the output of cat /proc/pcan

BTW: please use a new thread for your topic! This has nothing to do with an error after a restart....
[Moderator] Merged the postings in a single thread.

regards

Michael

Re: Error after computer restart

Posted: Thu 11. Apr 2019, 17:39
by afvillamil231
Thanks,

I will create a new post.

Cannot connect with PCAN device

Posted: Thu 11. Apr 2019, 18:06
by afvillamil231
Update: I have already installed PCANBasic API and the chardev driver. The output of cat /proc/pcan

cat: /proc/pcan: No such file or directory

Re: Cannot connect with PCAN device

Posted: Thu 11. Apr 2019, 18:17
by afvillamil231
Now i just get this error

Code: Select all

1554999378.306827: ERROR: failed to scan directory (errno=2) '/sys/class/pcan'
1554999378.306855: ERROR: failed to open file (errno=2) '/sys/class/pcan/version'.
Segmentation fault (core dumped)

Re: Cannot connect with PCAN device

Posted: Fri 12. Apr 2019, 09:11
by M.Maidhof
cat: /proc/pcan: No such file or directory
= you don´t have the chardev driver installed.

regards

Michael

Re: Cannot connect with PCAN device

Posted: Fri 12. Apr 2019, 10:37
by afvillamil231
Thank you for the reply,

I already installed all the drivers coming from http://www.peak-system.com/fileadmin/me ... /index.htm on the section Driver Package for Proprietary Purposes. I followed the instructions of the user manual and normally it says that a simple make of the drivers will install also the chardev interface. Also, to be sure, I did a make chardev

Code: Select all

make NET=NO_NETDEV_SUPPORT
make[1]: Entering directory '/home/felipe/peak-linux-driver-8.7.0/driver'
***
*** Host machine kernel version=4.18.0-17-generic
*** Driver kernel version=4.18.0-17-generic (4.18.0)
*** Path to kernel sources=/usr/src/linux-headers-4.18.0-17-generic
*** use KBUILD=yes
*** cc version=7
***
make -C /usr/src/linux-headers-4.18.0-17-generic  SUBDIRS=/home/felipe/peak-linux-driver-8.7.0/driver EXTRA_CFLAGS="-I/home/felipe/peak-linux-driver-8.7.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
make[2]: Entering directory '/usr/src/linux-headers-4.18.0-17-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[2]: Leaving directory '/usr/src/linux-headers-4.18.0-17-generic'
make[1]: Leaving directory '/home/felipe/peak-linux-driver-8.7.0/driver'
Should I use another different flag for installing chardev drivers? I didn't find more information on google.

Thank you!

Re: Cannot connect with PCAN device

Posted: Fri 12. Apr 2019, 11:56
by M.Maidhof
the info about your make process is not complete. Did you load the driver? Please read manual of the driver to see how to install the chardev driver.

regards

Michael

Re: Cannot connect with PCAN device

Posted: Fri 12. Apr 2019, 12:51
by afvillamil231
Hey sorry to keep asking, I still don't have a good solution from you.

I did read the user manual, I also uninstalled and tried to install again. I even followed the instructions you presented here https://www.peak-system.com/forum/viewt ... f=59&t=256 to install the chardev interface. But I am not yet able to install your drivers.

Another hint could be... when I do sudo modprobe pcan I get this error messages

modprobe: ERROR: could not insert 'pcan': Operation not permitted
modprobe: ERROR: ../libkmod/libkmod-module.c:979 command_do() Error running install command for pcan
modprobe: ERROR: could not insert 'pcan': Operation not permitted

I really don't know what is happening, I just want to use your module to connect with my motors.

Thank you in advance.

Felipe

Re: Cannot connect with PCAN device

Posted: Fri 12. Apr 2019, 13:40
by M.Maidhof
please post the complete output of your make process