How to use my PCAN-usb device with python-can on Ubuntu 18.04

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
balen_Muon
Posts: 2
Joined: Fri 12. Jan 2024, 10:49

How to use my PCAN-usb device with python-can on Ubuntu 18.04

Post by balen_Muon » Fri 12. Jan 2024, 12:24

Hi,

I am trying to make python-can work on Ubuntu 18.04 for a work project that will require me to use CAN messages to control a robot using ROS. Only problem is I am new to all of these things, I know how to use Ubuntu at a basic level and I have experience with python (using python 2 on the system because of ROS) but I have no experience with CAN devices.

I have downloaded the drivers and PCAN-Basic API but now I don't know how to use the python library with the PCAN-USB device I have access to at work. I have tried going through the python-can tutorials and the Peak-System documentations too and other online resources (including ChatGPT) but nothing seems to work.

If someone can guide me to how to make my device work/ get recognized in the python script (and then I can go from there) it would be very much appreciated. If anything is unclear or you need more info to help out please let me know.

Thanks.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: How to use my PCAN-usb device with python-can on Ubuntu 18.04

Post by PEAK-Support » Fri 12. Jan 2024, 12:32

As you could run different CAN Drivers on Linux (SocketCAN and the PEAK-System CharDev driver), which offers different APIs, you need first to know which one you use.

Based on the used driver, are different APIs available.
One from the community, the SocketCAN / NetDev Driver --> see SocketCAN API and also Python samples
And one from PEAK --> see PEAK-System API called PCAN-Basic which is available for Windows and LINUX - so you could use code on both Systems

But all samples codes etc. for our Driver / API is available from our WEB Page - also many samples , documentation etc.
For installing teh LINUX Driver you need to follow teh documentation - step by step - all is very well documented
https://www.peak-system.com/fileadmin/m ... /index.htm

The CAN Basics are a must - but also here you find many resources online. As this is a commercial Forum we only support original PEAK-System CAN Interfaces.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

balen_Muon
Posts: 2
Joined: Fri 12. Jan 2024, 10:49

Re: How to use my PCAN-usb device with python-can on Ubuntu 18.04

Post by balen_Muon » Fri 12. Jan 2024, 12:42

Thanks for the reply. I have installed the Peak-system driver (peak-linux-driver-8.16.0) and PCAN-Basic-Linux-4.7.0.3 API too. Could you please provide a link to the right documentation for my driver and API as I am kind of lost at the moment.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: How to use my PCAN-usb device with python-can on Ubuntu 18.04

Post by PEAK-Support » Fri 12. Jan 2024, 12:51

As we wrote - you need to know which driver do you use
The "PEAK Driver" could be used as CharDev or Socket CAN - PLEASE read the manual -
check with

Code: Select all

cat proc/pcan
PCAN-Basic API / Doku / Samples are available from the WEB Page
Which CAN-Interface do you use exactly ? As i wrote - we do ONLY support PEAK-System CAN Interfaces.
If you buy a PEAK-System CAN Interface you also have the manual that include all information to, also on the product page - all is available...
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply