WE have 2 PCAN USB Hardware which is connected to same PC.
1) How to differentiate between that which one is active?
2) What is the significance of this USB PCAN Channel? When we can use PUDS_USBBUS2 ?
#define PUDS_USBBUS1 0x51U // PCAN-USB interface, channel 1
#define PUDS_USBBUS2 0x52U // PCAN-USB interface, channel 2
#define PUDS_USBBUS3 0x53U // PCAN-USB interface, channel 3
3) What is the significance of device id in PCAN View?
For Example : We have set device id to 0x52 how to make sure same PCAN USB Hardware used via SW?
You could use the PEAK-Hardware applet (Via windows control panel, symbolic view) and
have a look at the pcanbaisc tab:
Initialized devices will be listed here.
You could also iterate through all hardware handels and use "GetStatus" to see if an device is active.
Those are handles representing hardware present, if you want to have influence over which handles
these devices receive, please have a look at the following forum thread:
This will show you how to set device-ids and use them to permanently bind a hardware handle to it via a registry key.
No, those values are whats behind the handle defintions (aka. what the driver receives when asked for a specific channel).
Read the forum post mentioned above.
When using PnP (Plug&Play) devices the hardware handle is usually assigned starting at 16 and then counting down.
This means the first USB-Adapter will get Hardware-Handle16, the second adapter gets HardwareHandle15, the third Adapter HardwareHandle14 etc.
With PCAN-Basic the application that is started first uses Handle "PCAN_USBBUS1" = 0x51, the application that is started next will use Handle "PCAN_USBBUS2" = 0x52 etc..
This results in the following assignment scheme:
HardwareHandle 16 -> PCAN_USBBUS1 0x51
HardwareHandle 15 -> PCAN_USBBUS2 0x52
HardwareHandle 14 -> PCAN_USBBUS3 0x53
If you want for example the device with 0x52 to be PUDS_USBBUS2 permanently, do the following, like described in the forum post i mentioned:
Under the following path a new reg-key must be created.
if you want to use id 0x52h:
Please report back to me if this was helpful to you.
I'm working on the same configuration, 2 PCAN USB in same PC, reading different buses simultaneously.
I've been following your instructions but there is a point I can not achieve:
When I have two devices connected, then yes, 'A' is always PCAN_USBBUS1 and 'B' is always PCAN_USBBUS2, doesn't matter the order in which I connected them.
But when I connect only one, then it will always be PCAN_USBBUS1.
As you said, I want 'B' to be PCAN_USBBUS2 permanently, although it's the only devie connected.
(The point is that I want to "match" one device to one CAN bus, so I will be able to know from where wait for a specific message)
How can I solve it? Am I doing something wrong?
By the way, I'm using PCANBasic.py
Thank you very much for your attention.
Did you reboot your machine since setting the device id?
Also, PCANBasic will, if only 1 device is connected, resort to the default hardware-handle scheme.
So the first device connected will be PCAN_USBBUS1 if not other device is connected.
As Marvin said if you have only one USB device, the handle will always be PUDS_USBBUS1.
But there are possible workarounds to your problem. The device ID is your own value to identify devices, so:
- you can identify the device you are connected to within your application via the PCAN-Basic parameter PCAN_DEVICE_ID (previously known as device number).
- or before connecting, use PCAN-Basic and the parameter PCAN_ATTACHED_CHANNELS to list all the connected devices, then connect to the one that matches your requested device id.
You can find more information on those parameters in PCAN-Basic documentation.
Also, my system will have both devices permanently connected (using PCAN chips, not usb modules) so how can I distinguish which is which at any point when programming the ID?
You might want to check the Linux-Section of our Forum, the PCAN-UDS API is only available for Windows
and therefore no Linux-specific threads will come up here.
Are you using our mainline-driver (integrated in kernel) or do you use
our PCAN-Linux driver?
If you use the latter, do you use it as CharDev or NetDev?
One thread that explains how to use to set a device id and use the assign-parameter can be found here,
this feature is only implemented in the PCAN-Linux Driver, so it would be relevant to know if you are currently using
the mainline kernel driver or the PCAN-Linux driver:
As to your second question:
Can you please elaborate to which "PCAN-Chip" device you are refering to (IPEH-XXXXXX)?
We carry two products with that moniker and it will be easier to help knowing which
device exactly is used.
Thanks for the quick reply. I've got a question out to our software team regarding which Linux driver we're using. I'm not quite sure, but I'm guessing it's probably the default mainline-driver.
I can answer your second question though. We have part number: IPEH-004025. I noticed someone else in the thread you linked mentioned this:
We are designing our own COM Express carrier board so we have some flexibility in which part we use. It could be PCIE or USB. If there's a 2 chip solution that is cheaper or easier to integrate with software I'd be open to using that instead.AFAIK using a two channel card with the main line kernel driver should also work without mixing canX devices during different bootups.