differentiate between two pcan

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
mojoity@yahoo.com
Posts: 2
Joined: Mon 16. Feb 2015, 22:09

differentiate between two pcan

Post by mojoity@yahoo.com » Mon 16. Feb 2015, 22:15

Hi,
I got a ubuntu system where i am connecting two PCAN-USB devices at the same time. Interface name for these devices are assigned as can0 and can1 but not in certain order(at times PCAN-USB 1 is assigned can0 at other times it is assigned can1). my program writes the data based on the interface names. Is there any way to harcode this two name to each of the devices or is there way certain way to differentiate between these two devices?

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

Re: differentiate between two pcan

Post by M.Maidhof » Tue 17. Feb 2015, 12:56

Hi,

you can set/flash device numbers into the PCAN-USB. Please see info in our manual on page 32/33 on how to use that device number to fix your network names (with driver 7.13 or higher).

http://www.peak-system.com/fileadmin/me ... ng_7.x.pdf

regards

Michael

mojoity@yahoo.com
Posts: 2
Joined: Mon 16. Feb 2015, 22:09

Re: differentiate between two pcan

Post by mojoity@yahoo.com » Wed 18. Feb 2015, 19:21

Thanks Michael for your help.
i am able to set the names as i want now. But i run into another problem.
Each of the PCAN-USB are getting the data at different bit rate and i am not able to use the normal(easy) ,method of setting the bitrate :
sudo ip link set canX up type can bitrate 200000.
I get the error :
RTNETLINK answers: Operation not supported.
though bringing the link up without any options works fine. same is mentioned at http://www.peak-system.com/forum/viewto ... =59&t=1120.

Is there any other of setting the bitrate instead of the echo option.

*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb can0 ffffffff 255 0x001c 00000000 00000000 00000000 00000000 0x0000
33 usb canX ffffffff X 0x001c 00000000 00000000 00000000 00000000 0x0000


thanks

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

Re: differentiate between two pcan

Post by M.Maidhof » Thu 19. Feb 2015, 09:33

Hi,

to use the ip link commands, you need to use the kernel drivers for our hardware. When using a kernel >3.7 simply call rmmod pcan and make install, than reboot, to have the kernel drivers active again.

With the installed peak-linux-driver you have to set the baudrate with the echo command, please see manual of our driver for more details: echo "i 0x031C e">/dev/pcan0 (example for 125k)

regards

Michael

Post Reply