PEAK CAN Device Not Initialized

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
AnnaMariePea
Posts: 8
Joined: Thu 30. Jun 2022, 23:40

PEAK CAN Device Not Initialized

Post by AnnaMariePea » Thu 30. Jun 2022, 23:56

I am developing software in C/C++ that will use a CAN bus. I have the PEAK CAN dongle hardware connected as follows: the USB end of the PEAK dongle is connected to the LInux box (a Vecow), the other end of the PEAK dongle is connected to a resistor, then connected to a Kvaser Leaf, which is connected to a Windows laptop via a USB port. I would like to have the software on the Vecow transmit CAN data to the laptop.

I'm running the software on Ubuntu 18.4, and easily built and installed the drivers. I built the test code, but I am unable to get it to work. Every one of the test software executables report that they can't open the device, for example:

transmitest: can't open /dev/pcan0

Going through your documentation, I believe that the CAN device is not initialized. How can I initialize it? I have included some diagnostic information that I hope will be helpful. Thank you!!

Code: Select all

lmerpk@JB2:~/Desktop$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 04d8:0205 Microchip Technology, Inc. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 04d8:0205 Microchip Technology, Inc. 
Bus 001 Device 002: ID 0c72:000c PEAK System PCAN-USB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Code: Select all

lmerpk@JB2:~/Desktop$ ls /dev | grep can
pcan32
pcan-usb
pcanusb32

Code: Select all

lmerpk@JB2:~/Desktop$ lsmod | grep ^peak
lmerpk@JB2:~/Desktop$ lsmod | grep can
pcan                  172032  0
i2c_algo_bit           16384  3 igb,pcan,i915
pinctrl_cannonlake     36864  0
pinctrl_intel          28672  1 pinctrl_cannonlake
lmerpk@JB2:~/Desktop$ cat /proc/pcan

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20220124_n (8.14.0) Jun 28 2022 15:12:41 --------------
*---------------------- [mod] [isa] [pci] [pec] [usb] -----------------------
*--------------------- 1 interfaces @ major 239 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb   -NA- ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
Last edited by K.Wagner on Fri 1. Jul 2022, 07:38, edited 1 time in total.
Reason: Code formatting for better reading

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: PEAK CAN Device Not Initialized

Post by M.Maidhof » Fri 1. Jul 2022, 07:49

Hi,

typically a PCAN-USB will be handled as device pcan32 (as you could see in your cat /proc/pcan output). So please change the code from pcan0 to pcan32 to let it work with the PCAN-USB. You can also use the test examples or pcanview to transmit/receive data with the chardev driver. In those examples you have to set the output device with the following parameter -f=/dev/pcan32

regards

Michael

AnnaMariePea
Posts: 8
Joined: Thu 30. Jun 2022, 23:40

Re: PEAK CAN Device Not Initialized

Post by AnnaMariePea » Sat 2. Jul 2022, 00:19

Thank you! This is very helpful. I am now able to connect, and move data, although with errors. I will read the documentation you supplied to get rid of the errors. :)

Post Reply