hardbyte / python-can

The can package provides controller area network support for Python developers
https://python-can.readthedocs.io
GNU Lesser General Public License v3.0
1.31k stars 604 forks source link

Multiple connections to PCAN bus #378

Open stefanhoelzl opened 6 years ago

stefanhoelzl commented 6 years ago

Hello,

is it possible to open multiple connection to a PCAN bus?

When I have established a connection with python-can, it is still possible to connect with PCAN View (not being able to change bitrates), so generallly it is possible.

Thanks!

christiansandberg commented 6 years ago

I’m not too familiar with the API, but it could be that if the CAN_Initialize call fails (perhaps with some specific error code) we could just keep on going. If you can test that it would be helpful as we can’t test ourselves.

stefanhoelzl commented 6 years ago

Looks like opening multiple connections is only supported by PCAN Developer not PCAN-Basic

https://www.peak-system.com/PCAN-Developer-4.461.0.html?&L=1&sword_list%5B0%5D=nets One or multiple Clients can be connected with a Net

milhead2 commented 6 years ago

I've been looking at the PCAN_BASIC documentation and it shows examples of opening channels of PCAN_USBBUS1 thru PCAN_SUBBUS16 on a single PCAN_USB device.

tigershadowclaw commented 6 years ago

@stefanhoelzl is correct. PCAN-Basic only allows one program at a time to connect to a PCAN device channel. PEAK make several PCAN-USB devices with multiple channels on them. PCAN-View can still be used to open a channel because it uses the PCAN-Developer API not the PCAN-Basic API

tinix84 commented 4 years ago

@stefanhoelzl is correct. PCAN-Basic only allows one program at a time to connect to a PCAN device channel. PEAK make several PCAN-USB devices with multiple channels on them. PCAN-View can still be used to open a channel because it uses the PCAN-Developer API not the PCAN-Basic API

can you show me how? Im not able to manage it I have first PCANview in listen-mode on brusa_net_HW16, then I launch python program but this give me Exception has occurred: PcanError The PCAN-Hardware is already being used by a PCAN-Net

image image