pcan_make_devices and modprobe problems

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
alberto.c
Posts: 4
Joined: Fri 14. Feb 2020, 15:11

pcan_make_devices and modprobe problems

Post by alberto.c » Fri 14. Feb 2020, 15:40

Hi,
I'm a student of Politecnico di Torino and i'm working on my master Thesis. In particular I have to use a Linux pc (kernel version 2.6.32.11, RT, and is not running UDEV) that has a PCAN-PCI board (IPEH 002065) installed. Before me other people used and installed correctly the driver (chardev) to work with a Schunk arm and all worked perfectly. Then I was trying to use the second channel to work with a force torque sensor but I couldn't find /dev/pcan1, so I tried to reinstall the driver (bad idea). The installation went fine but seems that the command pcan_make_devices 2 doesn't see that the module pcan.ko is inserted, in fact I discovered later that the workframe for the arm, the first time that is launched, automatically perfom the modprobe and pcan_make_devices, but now it doesn't work anymore since pcan_make_devices 2 gives this output:

Code: Select all

Info: Please do first a "modprobe pcan.o or modprobe pcan.ko .. (depends on kernel version)"
Output of lsmod:

Code: Select all

Module                  Size  Used by
pcan                   20587  0 
rtai_rtdm             108697  1 pcan
rtai_serial            10869  0 
rtai_msg               15610  0 
rtai_mbx                7498  0 
rtai_sem               13815  4 pcan,rtai_rtdm,rtai_serial,rtai_mbx
rtai_lxrt              83828  6 pcan,rtai_rtdm,rtai_serial,rtai_msg,rtai_mbx,rtai_sem
rtai_hal              185442  6 rtai_rtdm,rtai_serial,rtai_msg,rtai_mbx,rtai_sem,rtai_lxrt
uinput                  5028  0 
serio_raw               3216  0 
joydev                  7004  0 
parport                17072  1 pcan
pcspkr                  1302  0 
iTCO_wdt                7484  0 
iTCO_vendor_support     1939  1 iTCO_wdt
e1000e                 99541  0 
nvidia               8469978  28 
ata_piix               17960  3 
ata_generic             2347  0 
pata_acpi               2187  0 
dm_mirror               9518  0 
dm_region_hash          7359  1 dm_mirror
dm_log                  6880  2 dm_mirror,dm_region_hash
dm_mod                 46622  2 dm_mirror,dm_log
Output of cat /proc/pcan:

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20130131_n (7.8.0) Feb 14 2020 11:50:48 --------------
*------------------- [mod] [isa] [pci] [dng] [par] [rt] ---------------------
*--------------------- 2 interfaces @ major 000 found -----------------------
*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
 0    pci -NA- fbfe0000 017 0x001c 00000000 00000000 00000000 00000000 0x0000
 1    pci -NA- fbfe0400 017 0x001c 00000000 00000000 00000000 00000000 0x0000
Output of cat /proc/devices:

Code: Select all

Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  7 vcs
 10 misc
 13 input
 21 sg
128 ptm
136 pts
166 ttyACM
180 usb
189 usb_device
195 nvidia
202 cpu/msr
203 cpu/cpuid
251 hidraw
252 usbmon
253 bsg
254 rtc

Block devices:
  1 ramdisk
259 blkext
  7 loop
  8 sd
 11 sr
 65 sd
 66 sd
 67 sd
 68 sd
 69 sd
 70 sd
 71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
I've also tried to add the device node manually as pcan_make_devices do (with major=0 and minor=0 for pcan0), the node is added in /dev but nor the workframe for the arm nor the test programs can find the device node.
PLEASE HELP ME!!

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

Re: pcan_make_devices and modprobe problems

Post by M.Heidemann » Fri 14. Feb 2020, 16:13

Hello,

Can you please show us your output for:

Code: Select all

$ ls /dev
?

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

alberto.c
Posts: 4
Joined: Fri 14. Feb 2020, 15:11

Re: pcan_make_devices and modprobe problems

Post by alberto.c » Mon 17. Feb 2020, 13:20

Hello,
this is the output of ls /dev:

Code: Select all

autofs           loop0               ppp     sda2    tty23  tty46  ttyS2
block            loop1               ptmx    sda3    tty24  tty47  ttyS3
bsg              loop2               pts     sg0     tty25  tty48  uinput
bus              loop3               ram0    shm     tty26  tty49  urandom
char             loop4               ram1    stderr  tty27  tty5   usbmon0
console          loop5               ram10   stdin   tty28  tty50  usbmon1
core             loop6               ram11   stdout  tty29  tty51  usbmon2
cpu              loop7               ram12   systty  tty3   tty52  vcs
cpu_dma_latency  lp0                 ram13   tty     tty30  tty53  vcs1
disk             lp1                 ram14   tty0    tty31  tty54  vcs2
fb               lp2                 ram15   tty1    tty32  tty55  vcs3
fb0              lp3                 ram2    tty10   tty33  tty56  vcs4
fd               MAKEDEV             ram3    tty11   tty34  tty57  vcs5
full             mapper              ram4    tty12   tty35  tty58  vcs6
fuse             mcelog              ram5    tty13   tty36  tty59  vcsa
hidraw0          mem                 ram6    tty14   tty37  tty6   vcsa1
hidraw1          net                 ram7    tty15   tty38  tty60  vcsa2
hidraw2          network_latency     ram8    tty16   tty39  tty61  vcsa3
hpet             network_throughput  ram9    tty17   tty4   tty62  vcsa4
hugepages        null                random  tty18   tty40  tty63  vcsa5
hvc0             nvidia0             root    tty19   tty41  tty7   vcsa6
input            nvidiactl           rtc     tty2    tty42  tty8   vga_arbiter
kmem             nvram               rtc0    tty20   tty43  tty9   watchdog
kmsg             oldmem              sda     tty21   tty44  ttyS0  zero
log              port                sda1    tty22   tty45  ttyS1
As you can see there are no pcan0 and pcan1 even if I try to use the "pcan_make_devices 2" command. I tried (as super user) to do in a terminal the operations needed to create a new device node (for example for pcan0):

Code: Select all

      sudo mknod /dev/pcan0 c 0 0
      sudo chgrp root /dev/pcan0
      sudo chmod 666  /dev/pcan0
and now the node pcan0 in the folder /dev will show up, but still the test programs can't open it. Am I creating the pcan0 node in the wrong way? Can you confirm me that the major number is 0 and minor ones are 0 and 1 (from the output of cat /proc/pcan) ?

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

Re: pcan_make_devices and modprobe problems

Post by S.Grosjean » Mon 17. Feb 2020, 14:12

Hi,

Since RTDM devices ARE NOT Linux devices then it's normal that nothing about the pcan devices can be found under /dev. When the pcan driver is built in RT mode, then RT user has to deal with device names without any "/dev/" prefix.

Please use "pcan0" or "pcan1" as device name to point the first or second CAN channel of the card.

Regards,
— Stéphane

alberto.c
Posts: 4
Joined: Fri 14. Feb 2020, 15:11

Re: pcan_make_devices and modprobe problems

Post by alberto.c » Mon 17. Feb 2020, 16:10

Hi,
I don't understand what you are suggesting: for "device name" are you talking about the "device node"? The LINUX_CAN_Open(szDeviceNode, O_RDWR) function needs the device node, and in fact if I try to use pcan1 instead of /dev/pcan1 for example with the "bitratetest" test program I obtain this output:

Code: Select all

bitratetest -f=pcan1

bitratetest Version "Release_20060501_a"  (www.peak-system.com)
------- Copyright (C) 2004-2009 PEAK System-Technik GmbH ------
bitratetest comes with ABSOLUTELY NO WARRANTY.     This is free
software  and you are welcome  to redistribute it under certain
conditions.   For   details   see    attached   COPYING   file.

bitratetest: CAN_Open(): No such file or directory
bitratetest: finished (2).
Am I using the tests programs in the correct way?
If I install the driver not in RT mode the device node will be created in /dev/?

alberto.c
Posts: 4
Joined: Fri 14. Feb 2020, 15:11

Re: pcan_make_devices and modprobe problems

Post by alberto.c » Mon 17. Feb 2020, 16:51

SOLVED! It was sufficient to uninstall the driver and reinstall it with the option "make RT=NO_RT", thank you for the help!!!

Post Reply