I'd like to retrieve a CAN trace without resorting to a Windows virtual machine — since this is how I do so far with the Windows-only PCAN-View and it's boring me. I have a [relatively old] Peak PCAN-USB device that seems to be detected by my Manjaro laptop (4.4.17-1-MANJARO #1 SMP PREEMPT Wed Aug 10 19:50:37 UTC 2016 x86_64 GNU/Linux):

# lsusb
Bus 003 Device 027: ID 0c72:000c PEAK System PCAN-USB

# journalctl -b
kernel: usb 3-1: new full-speed USB device number 28 using xhci_hcd
NetworkManager[713]: <info>  [1471966456.5989] manager: (can0): new Generic device (/org/freedesktop/NetworkManager/Devices/27)
kernel: peak_usb 3-1:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial FFFFFFFF (1 channel)
kernel: peak_usb 3-1:1.0 can0: attached to PCAN-USB channel 0 (device 255)
mtp-probe[9153]: checking bus 3, device 28: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-1"
mtp-probe[9153]: bus: 3, device: 28 was not an MTP device

How can (ha-ha) I use that thing to get a trace @ 250 Kbits/sec for instance?


The procedure is made pretty simple with the help of package iproute2.

First configure the CAN interface (as root):

# ip link set can0 up type can bitrate 250000

... then dump traffic into a text file:

$ candump can0 > cantrace.txt
$ candump -tA can0 > cantrace.txt      # includes date/time
$ candump ... can0 | tee cantrace.txt  # so as to read what's logged

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy