Page 1 of 2

pcan: pcan_xxxdev_rx(1) failure

Posted: Wed 24. May 2017, 13:47
by lepalom
Hi,

I'm using a 3.16.39 kernel with Xenomai 2.6.4 patches. I installed peak driver 7.14 and we used with a pcan-usb device without problems during long time.

One day, it suddenly stop working. Probably it was because I did some upgrade, or whatever. The error code I got was:

pcan: pcan_xxxdev_rx(1) failure
pcan: @offset 0: message decoding error -28

As the driver was a bit old I though that it could be a good idea to upgrade so I put 8.3.1. The question was that it worked but after reboot I got:

pcan_xxxdev_rx(1) failed err=-28

So, probably I'm doing some stupid mistake or something obvious that I don't see.

Any idea?

Thanks in advance,

Leopold

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Thu 25. May 2017, 14:38
by lepalom
just an clarification. I'm not using the Xenomai driver. Just the standard Linux driver. In any case, I have tested it with another kernels (non-RT) and it fails in the same way.

Best regards,

Leopold

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Fri 26. May 2017, 12:37
by PEAK-Support
Please give us the results of:

Code: Select all

$ uname -a
$ lsusb -d 0c72: -v
$ grep -i 0c72 /lib/modules/`uname -r`/modules.alias
as well as the FULL output of:

Code: Select all

$ cat /proc/pcan
pcan: pcan_xxxdev_rx(1) failed err=-28
Is a msg that is displayed when processing msgs received from the PCAN-USB only failed.
So it is not CAN-USB specific problem, it is USB specific problem.

Didi you use the system in a VM ?
If yes, you have to check that all "guest extension packs" are installed on that VM.
But, finally, we recommend you to run our driver in a native Linux system.

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Mon 29. May 2017, 09:02
by lepalom

Code: Select all

$ uname -a

Linux grasp 4.9.0-0.bpo.2-amd64 #1 SMP Debian 4.9.18-1~bpo8+1 (2017-04-10) x86_64 GNU/Linux
I have tested it too in

Code: Select all

Linux spectra 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux
with the same result.

Code: Select all

$ lsusb -d 0c72: -v

Bus 004 Device 004: ID 0c72:000c PEAK System PCAN-USB
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        16
  idVendor           0x0c72 PEAK System
  idProduct          0x000c PCAN-USB
  bcdDevice           1c.ff
  iManufacturer           0 
  iProduct                3 
  iSerial                 0 
  bNumConfigurations      3
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     2
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              394mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     3
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1

Bus 004 Device 003: ID 0c72:000c PEAK System PCAN-USB
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        16
  idVendor           0x0c72 PEAK System
  idProduct          0x000c PCAN-USB
  bcdDevice           1c.ff
  iManufacturer           0 
  iProduct                3 
  iSerial                 0 
  bNumConfigurations      3
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     2
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              394mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              20
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     3
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1

Code: Select all

$ grep -i 0c72 /lib/modules/`uname -r`/modules.alias
alias usb:v0C72p0014d*dc*dsc*dp*ic*isc*ip*in* peak_usb
alias usb:v0C72p0011d*dc*dsc*dp*ic*isc*ip*in* peak_usb
alias usb:v0C72p0012d*dc*dsc*dp*ic*isc*ip*in* peak_usb
alias usb:v0C72p000Dd*dc*dsc*dp*ic*isc*ip*in* peak_usb
alias usb:v0C72p000Cd*dc*dsc*dp*ic*isc*ip*in* peak_usb
alias usb:v0C72p0014d*dc*dsc*dp*ic*isc*ip*in* pcan
alias usb:v0C72p0011d*dc*dsc*dp*ic*isc*ip*in* pcan
alias usb:v0C72p0012d*dc*dsc*dp*ic*isc*ip*in* pcan
alias usb:v0C72p000Dd*dc*dsc*dp*ic*isc*ip*in* pcan
alias usb:v0C72p000Cd*dc*dsc*dp*ic*isc*ip*in* pcan

Code: Select all

$ cat /proc/pcan

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20170214_n (8.3.1) May 25 2017 12:47:49 --------------
*------------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] --------------
*--------------------- 2 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb   -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
33    usb   -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
I can imagine that it's an USB problem.

No, I'm not using a VM, I'm using a physical box.

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Mon 29. May 2017, 09:13
by lepalom
I have used again the peak-usb device and then:

Code: Select all

$  cat /proc/pcan

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20170214_n (8.3.1) May 25 2017 12:47:49 --------------
*------------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] --------------
*--------------------- 2 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb   -NA- ffffffff 000 0x0014 0000020d 00000015 000031ac 00006105 0x0002
33    usb   -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Mon 29. May 2017, 10:05
by M.Maidhof
Hi,

do you use any USB hubs or extension cables in your setup? What kind of CAN hardware/CAN cables do you use on your CAN system, and which baudrate do you use? (pcan32 uses 1Mbit/s while pcan33 is on 500k)

regards

Michael

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Mon 29. May 2017, 10:12
by S.Grosjean
Hello,

Generally speaking, the -28 error occurs when the Rx FIFO of the driver receiving messages from the hardware is full.
$ cat /proc/pcan

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20170214_n (8.3.1) May 25 2017 12:47:49 --------------
*------------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] --------------
*--------------------- 2 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 000 0x0014 0000020d 00000015 000031ac 00006105 0x0002
33 usb -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
Your first line says your application has read 525 CAN msgs from the driver, while it has written 15 CAN messages on the CAN bus. Last column "'status" says your Rx FIFO is full (see pcan.h):

Code: Select all

#define CAN_ERR_OVERRUN        0x0002  // overrun in receive buffer
So it appears that the PCAN-USB is always sending messages to the driver and the application is not reading them. These messages can be CAN frames OR status messages. Can you tell us more about your application please? Does it always wait for read from the driver? What are these 525 messages read, please? Moreover, the above says that you have setup the PCAN-USB with a bitrate=1 Mbps. Are you certain that the equipment connected to your CAN bus are all setup with the same bit timings?
When you're running in failure, can you give us the result of this command, please :

Code: Select all

$ for f in `ls /sys/class/pcan/pcanusb32/`; do echo -n "$f:"; cat /sys/class/pcan/pcanusb32/$f; done
Regards,

Stéphane

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Mon 29. May 2017, 11:06
by lepalom
M.Maidhof wrote:Hi,

do you use any USB hubs or extension cables in your setup? What kind of CAN hardware/CAN cables do you use on your CAN system, and which baudrate do you use? (pcan32 uses 1Mbit/s while pcan33 is on 500k)

regards

Michael
I don't use any USB hub or extension cable.

I'm using a robotic hand (Allegro hand) connected directly to the USB-Can from peak.

We are using 1Mbit/s. We have two USB-Can and nothing is connected in the other USB.

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Mon 29. May 2017, 11:32
by lepalom
S.Grosjean wrote:Hello,

Generally speaking, the -28 error occurs when the Rx FIFO of the driver receiving messages from the hardware is full.
$ cat /proc/pcan

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20170214_n (8.3.1) May 25 2017 12:47:49 --------------
*------------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] --------------
*--------------------- 2 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 000 0x0014 0000020d 00000015 000031ac 00006105 0x0002
33 usb -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
Your first line says your application has read 525 CAN msgs from the driver, while it has written 15 CAN messages on the CAN bus. Last column "'status" says your Rx FIFO is full (see pcan.h):

Code: Select all

#define CAN_ERR_OVERRUN        0x0002  // overrun in receive buffer
So it appears that the PCAN-USB is always sending messages to the driver and the application is not reading them. These messages can be CAN frames OR status messages. Can you tell us more about your application please?
Yes, it's a simple application with a loop sending an receiving information about the state of the hand.

Does it always wait for read from the driver? What are these 525 messages read, please? Moreover, the above says that you have setup the PCAN-USB with a bitrate=1 Mbps. Are you certain that the equipment connected to your CAN bus are all setup with the same bit timings?
my problem is that this software was running during the last two years but some upgrade (??) made it failed. It could be a problem of the software or some hide incompatibility with the USB system.
When you're running in failure, can you give us the result of this command, please :

Code: Select all

$ for f in `ls /sys/class/pcan/pcanusb32/`; do echo -n "$f:"; cat /sys/class/pcan/pcanusb32/$f; done

Code: Select all

adapter_name:PCAN-USB
@adapter_number:0
adapter_version:2.8
@base:0x0
btr0btr1:0x0014
bus_state:1
clock:8000000
ctrlr_number:0
dev:245:32
devid:255
errors:34325
hwtype:11
init_flags:0x00000002
irq:0
irqs:18292
minor:32
nom_bitrate:1000000
nom_brp:1
nom_sample_point:7500
nom_sjw:1
nom_tq:125
nom_tseg1:5
nom_tseg2:2
power:read:1185
rx_fifo_ratio:100.00
status:0x0002
subsystem:tx_fifo_ratio:0.00
type:usb
uevent:MAJOR=245
MINOR=32
DEVNAME=pcanusb32
write:681

Thanks for check it!!!

Re: pcan: pcan_xxxdev_rx(1) failure

Posted: Mon 29. May 2017, 11:52
by S.Grosjean
Hi,

Could you please rebuild the pcan driver but in DEBUG mode, that is:

Code: Select all

$ cd peak-linux-driver-8.3.1/driver
$ make clean
$ make DBG=DEBUG
$ sudo make install
Remove current driver then load new (dbg) one:

Code: Select all

$ sudo rmmod pcan
$ sudo modprobe pcan
Then, run your application. When it fails, do:

Code: Select all

$ dmesg | grep pcan > /tmp/pcan.txt
Then send us the file /tmp/pcan.txt please.
Regards,

Stéphane