How to list down all the channels available for pcan using python-pcan library?

How to list down all the channels available for pcan using python-pcan library?
I used following:

canConfig = can.detect_available_configs(interfaces='pcan')

But the above function returns only one channel i.e. PCAN_USBBUS1.
Since the laptop has more than 1 USB port how to detect all the channels?
Your help is appreciated.
Thanks in advance.

Regards,
Vikram A. Kashelikar

I can’t find a python-pcan package online. Did you mean the PCAN module of python-can?

If detect_available_configs only returns PCAN_USBBUS1, that means the underlying driver could only detect that channel. If PCAN provides a utility to view available channels, you can check whether it detects the same number of channels as python-can.

Since the laptop has more than 1 USB port how to detect all the channels?

Just to clarify, do you have multiple PCAN-USB adapters? If you only have the one adapter you will only have one channel, regardless of how many USB ports your computer has.

Hello dear Alexander,

Thanks for the response.
I tried with two PCANs connected to two different USB ports and ran my code.
for both PCANs even if the USB ports were different it showed same channel number PCAN_USBBUS1.
I will provide you the link for python-pcan package documentation:
“chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://python-can.readthedocs.io/_/downloads/en/2.2.0/pdf/
To install the package you need to run the following command:
“pip install python-can”

Thanks and Regards,
Vikram Kashelikar

That package is called python-can, not python-pcan. That version of the documentation is also very old; 2.2.0 was released in 2018. You should use a more recent version.

You must verify that the PCAN driver can detect your channels. python-can is just a wrapper around this driver; if the driver doesn’t see the second channel, neither will python-can.

Parameters interfaces – either - the name of an interface to be searched in as a string, - an
iterable of interface names to search in, or - None to search in all known interfaces.

It might be worth running a search with interfaces=None once, just to see what it returns.

Interfaces=None returns a lot of information most of it is error because my laptop has only pcan connected with hardware and nothing else.
As far as pcan information in the details provided by setting interfaces=None it shows only PCAN_USBBUS1 only with the device id of my pcan.

Thanks and Regards,
Vikram Kashelikar

Hello Alexander,

Where to get the driver information on google.
I searched google links by giving following search query:
“python-can is a wrapper around which driver?”

Do you know any link for the same.
It will be great help if you can provide me the link to the driver or the right search query for google.

Thanks and Regards,
Vikram Kashelikar

python-can wraps many different CAN drivers. Since you are using PCAN hardware, in your case it wraps PCAN’s driver. You already have this driver installed, or python-can wouldn’t find any PCAN channels.

The PCAN driver includes two utilities, PEAK-settings and PCAN-view, which may tell which channels are detected by the driver.

1 Like