System freezes with can0 up (PCAN-Chip USB Eval Module)

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
rr_iav
Posts: 6
Joined: Wed 15. Mar 2017, 16:50

System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by rr_iav » Wed 15. Mar 2017, 17:38

I am encountering problems while trying to get a PCAN-Chip USB Eval Module (CAN FD) running through a ubuntu based BeagleBoneBlack Rev. C. Linux kernel is 4.4.52-ti-r91. pcan module (Version 8.3.1) has been compiled successfully with NET=NETDEV_SUPPORT on the system. Whenever I try to have can0 up and running, the entire system stalls and gets back to life only after unplugging the USB connector of the PCAN Module. dmesg then outputs for the time from "ip link set can0 up" to unplugging the module:

Code: Select all

[ 2146.440561] usb 1-1: new high-speed USB device number 3 using musb-hdrc
[ 2146.569681] usb 1-1: New USB device found, idVendor=0c72, idProduct=0013
[ 2146.569744] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2146.569775] usb 1-1: Product: PCAN-Chip USB
[ 2146.569805] usb 1-1: Manufacturer: PEAK-System Technik GmbH
[ 2146.592375] pcan: PCAN-USB FD (01h PCB03h) fw v2.2.3
[ 2146.599102] pcan: PCAN-USB FD channel 1 device number=0
[ 2146.612492] pcan: registered CAN-FD netdevice can0 for usbfd hw (245,32)
[ 2146.612546] pcan: usb device minor 32 found
[ 2189.931846] usb 1-1: USB disconnect, device number 3
[ 2189.932522] pcan: unhandled read data stream turned off (err -108)
This error is reproducible (even with different Linux images for the BBB).

cat /proc/pcan produces:

Code: Select all

ubuntu@arm:~/Peak/peak-linux-driver-8.3.1$ cat /proc/pcan
*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20170214_n (8.3.1) Mar 15 2017 15:35:42 --------------
*---------------------- [mod] [isa] [dng] [usb] [net] -----------------------
*--------------------- 1 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32  usbfd   can0        0 000 0x001c 00000000 00000000 00000000 00000000 0x0000
usb-devices produces:

Code: Select all

ubuntu@arm:~/Peak/peak-linux-driver-8.3.1$ usb-devices
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 1
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=04.04
S:  Manufacturer=Linux 4.4.52-ti-r91 musb-hcd
S:  Product=MUSB HDRC host driver
S:  SerialNumber=musb-hdrc.1.auto
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0c72 ProdID=0013 Rev=00.00
S:  Manufacturer=PEAK-System Technik GmbH
S:  Product=PCAN-Chip USB
C:  #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 4 Cls=00(>ifc ) Sub=00 Prot=00 Driver=pcan
What have I missed in the installation process? Thanks for your help.
Last edited by M.Gerber on Thu 16. Mar 2017, 15:34, edited 2 times in total.
Reason: Inserted Code tags for better readability

rr_iav
Posts: 6
Joined: Wed 15. Mar 2017, 16:50

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by rr_iav » Fri 17. Mar 2017, 11:36

Update: To rule out insufficient power supply after turning on can0, I connected the Peak Module through a powered USB Hub. Still the same behavior. So undervoltage does not seem to be the reason.

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

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by S.Grosjean » Fri 17. Mar 2017, 14:42

Hello,

Could you rebuild the driver but in chardev mode, please?

Code: Select all

$ cd peak-linux-driver-8.3.1/driver
$ make clean; make
Then unlod the current one and load this new one:

Code: Select all

$ sudo rmmod pcan
$ sudo insmod pcan.ko
Finally, go into the "test" dir, launch the pcanfdtst (in rx mode) with the desired baudrate, to test:

Code: Select all

$ cd ../test
$ ./pcanfdtst rx -b 500k /dev/pcan32
(the above example sets the channel bitrate to 500kbps)

Now, if there is any traffic on the CAN bus, you should see CAN frames being displayed (use ^C to stop)...

Thanks for your feedback,

Stéphane
— Stéphane

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by O.Hartkopp » Thu 23. Mar 2017, 19:08

rr_iav wrote:I am encountering problems while trying to get a PCAN-Chip USB Eval Module (CAN FD) running through a ubuntu based BeagleBoneBlack Rev. C. Linux kernel is 4.4.52-ti-r91. pcan module (Version 8.3.1) has been compiled successfully with NET=NETDEV_SUPPORT on the system.

Code: Select all

[ 2146.569681] usb 1-1: New USB device found, idVendor=0c72, idProduct=0013
@Stephane: Would it make sense to add the product ID 0013 to pcan_usb_core.h

https://git.kernel.org/pub/scm/linux/ke ... inux-4.4.y

... and try to check the setup with the mainline driver too?

Or is the hardware ID 0013 not compatible with the current mainline driver?

Regards,
Oliver

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

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by S.Grosjean » Fri 24. Mar 2017, 09:18

Hello Oliver,

We already have prepared and successfully tested an oot version of peak_usb on a legacy Ubuntu PC. We actually are waiting for any feedback from this thread, before going on.

You should get some news by the linux-can ML channel sooner! ;-)

Regards,

Stéphane
— Stéphane

rr_iav
Posts: 6
Joined: Wed 15. Mar 2017, 16:50

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by rr_iav » Thu 30. Mar 2017, 13:45

Thanks for the hint to test the module as chardev. This is the result:

Code: Select all

ubuntu@arm:~/Peak/peak-linux-driver-8.3.1/test$ ./pcanfdtst rx -b 500k /dev/pcan32
1490873960.566150 /dev/pcan32 > BUS STATE=ACTIVE   [Rx:0 Tx:0]
1490873960.980544 /dev/pcan32 > 17f00010 .e... [20 10 00 00 00 00 00 80]
1490873961.480020 /dev/pcan32 > 17f00010 .e... [20 10 00 00 00 00 00 80]
1490873961.979510 /dev/pcan32 > 17f00010 .e... [20 10 00 00 00 00 00 80]
1490873962.479000 /dev/pcan32 > 17f00010 .e... [20 10 00 00 00 00 00 80]
^C/dev/pcan32 > [packets=4 calls=5 bytes=32 seq_err=0]
received frames: 4
So I suppose this implies that as chardev the module works.

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

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by S.Grosjean » Thu 30. Mar 2017, 15:27

Hi,

Yep, you're right. We do have prepared an out-of-tree driver "peak_usb" that is supposed to handle the PCAN-Chip USB device id 0x0013 (see attached).

This version is supposed to be the same than the one which is running into your system, except that it handles the PCAN-Chip USB device id.

To use this version, please untar it and make it:

Code: Select all

$ tar -xzf peak_usb-2.2.2.tar.gz
$ cd peak_usb-2.2.2
$ make
Then, you MUST unload either pcan or the mainline peak_usb:

Code: Select all

$ sudo rmmod pcan
$ sudo rmmod peak_usb
Finally, you can load this version with:

Code: Select all

$ sudo insmod peak_usb.ko
Thanks for your feedback,

Regards,

Stéphane
Attachments
peak_usb-2.2.2.tar.gz
(34.78 KiB) Downloaded 719 times
— Stéphane

rr_iav
Posts: 6
Joined: Wed 15. Mar 2017, 16:50

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by rr_iav » Fri 31. Mar 2017, 10:13

Thanks for the driver. Installation went smoothly.
As of now, candump and cansend work as desired. No kernel freeze so far after turning on can0.
I will test more extensively and post results in the coming days.

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

Re: System freezes with can0 up (PCAN-Chip USB Eval Module)

Post by S.Grosjean » Fri 31. Mar 2017, 10:50

Ok, thanks for the info.
When we have more sure results, we will be able to compare both drivers.
FYI, and thanks to your test, we were able to push a patch to the linux-can ML to include once for all the support of the PCAN-Chip USB into the Kernel. It is now waiting for being ACKed.

Regards,

Stéphane
— Stéphane

Post Reply