When using multiple PCAN-USB adapters together with PCAN-Basic on the same machine it is possible to connect a certain device ID with a hardware handle so that access to a specific unit is independent from the sequence these adapters are plugged into the USB ports. The following steps must be taken to accomplish that:
Each PCAN-USB-Hardware (PCAN-USB, PCAN-USB ISO, PCAN-USB Pro, PCAN-HUB) has a DeviceID (by default this is FFh). This DeviceID can be changed using the current version of PCAN-View (see screenshot below).
Make sure that you assign unique IDs for each of the adapters connected to the same machine, don't duplicate the same device ID because then this entire process will not work.
After changing the DeviceID a few values must be added/created in the Registry.
Here is a small example using 3 USB adapters with the following DeviceIDs:
1. USB-Adapter = 0x01h
2. USB-Adapter = 0x02h
3. USB-Adapter = 0x05h
The following keys must be created:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pcan_usb]
"Hardware16"="0x201,0x01,0"
"Hardware15"="0x201,0x02,0"
"Hardware14"="0x201,0x05,0"
Description of Parameter 1:
Hardware16 = HardwareHandle16
Hardware15 = HardwareHandle15
.....
Hardware8 = HardwareHandle8
.....
Hardware1 = HardwareHandle1
Description of Parameter 2:
0x201 = PCAN-USB and PCAN-USB ISO
0x202 = PCAN-USB Pro
0x203 = PCAN-USB HUB
0x206 = PCAN-USB Pro FD
0x207 = PCAN-USB FD
Description of Parameter 3:
the corresponding (selected) DeviceID
0x00 = don´t care
0x01 through 0xff
In our little example we must use 0x01, 0x02 and 0x05
Description of Parameter 4 (only applicable for USB-PRO, because there we can have 1 DeviceID with 2 CANchannels per device):
0 = Channel 1
1 = Channel 2
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
The application that is started first will always connect to the adapter with ID01h, the second application connects to the adapter with ID02h and the third application connects to the adapter with ID05h.
PS: Thanks to René from Phytec America
Tutorial: Fixed device ID/channel assignment with PCAN-USB
Re: Fixed device ID/channel assignment with PCAN-USB
I'm using PCAN-USB light API and have 2 dll-files: PCAN_USB.dll for adapter1 and PCAN_2USB.dll for adpater2. Adapter1 has device id 0x1 and adapter2 has 0x2. The keys are also inserted into the windows registry (Hardware16='0x201,0x1,0' and Hardware15='0x201,0x2,0'). I hope that adapter1 is in use if the PCAN_USB.dll is called and adapter2 is in use if PCAN_2USB.dll is called. But it seems that it does not work. What's wrong?
Softwareentwicklung, OOD/OOP, C/C++, Delphi, Java, QT
Modellierung, Simulation, Datenvisualisierung, Testautomatisierung
Modellierung, Simulation, Datenvisualisierung, Testautomatisierung
Re: Fixed device ID/channel assignment with PCAN-USB
The PCAN-Light DLL use the same enumaration as the PCAN-Basic API. You only did not see the used Handles.
Here they are:
Light DLL
pcan_usb.dll --> 0x51
pcan_2usb.dll --> 0x52
pcan_pci.dll --> 0x41
pcan_2pci.dll --> 0x42
etc. see Header File of PCAN Basic API
Here they are:
Light DLL
pcan_usb.dll --> 0x51
pcan_2usb.dll --> 0x52
pcan_pci.dll --> 0x41
pcan_2pci.dll --> 0x42
etc. see Header File of PCAN Basic API
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Fixed device ID/channel assignment with PCAN-USB
Updated list for parameter 2 (CAN_GetDriverName)
PCI and PCIexpress based cards
0x101 = PCAN-PCI
0x101 = PCAN-PCI Express (the Tundra powered version, sold till ~2014)
0x103 = PCAN-PCI Express (current version)
0x113 = PCAN-PCI Express FD
0x101 = PCAN-PC/104-Express (the Tundra powered version, sold till ~2014)
0x107 = PCAN-PC/104-Express (current version)
0x117 = PCAN-PC/104-Express FD
0x101 = PCAN-PC/104-Plus
0x106 = PCAN-PC/104-Plus Quad (4-channel version)
0x101 = PCAN-cPCI
0x101 = PCAN-miniPCI
0x108 = PCAN-miniPCIe
0x118 = PCAN-miniPCIe FD
0x102 = PCAN-ExpressCard
0x10A = PCAN-ExpressCard 34
0x109 = PCAN-Chip PCIe
0x119 = PCAN-Chip PCIe FD
0x11A = PCAN-M.2
USB based interfaces
0x201 = PCAN-USB
0x201 = PCAN-USB ISO
0x207 = PCAN-USB FD
0x202 = PCAN-USB Pro
0x206 = PCAN-USB Pro FD
0x201 = PCAN-USB Hub
0x209 = PCAN-USB X6
0x208 = PCAN-Chip USB
PC Card based cards
0x401 = PCAN-PC Card
PCI and PCIexpress based cards
0x101 = PCAN-PCI
0x101 = PCAN-PCI Express (the Tundra powered version, sold till ~2014)
0x103 = PCAN-PCI Express (current version)
0x113 = PCAN-PCI Express FD
0x101 = PCAN-PC/104-Express (the Tundra powered version, sold till ~2014)
0x107 = PCAN-PC/104-Express (current version)
0x117 = PCAN-PC/104-Express FD
0x101 = PCAN-PC/104-Plus
0x106 = PCAN-PC/104-Plus Quad (4-channel version)
0x101 = PCAN-cPCI
0x101 = PCAN-miniPCI
0x108 = PCAN-miniPCIe
0x118 = PCAN-miniPCIe FD
0x102 = PCAN-ExpressCard
0x10A = PCAN-ExpressCard 34
0x109 = PCAN-Chip PCIe
0x119 = PCAN-Chip PCIe FD
0x11A = PCAN-M.2
USB based interfaces
0x201 = PCAN-USB
0x201 = PCAN-USB ISO
0x207 = PCAN-USB FD
0x202 = PCAN-USB Pro
0x206 = PCAN-USB Pro FD
0x201 = PCAN-USB Hub
0x209 = PCAN-USB X6
0x208 = PCAN-Chip USB
PC Card based cards
0x401 = PCAN-PC Card