How to: Fixed device ID/channel assignment with PCAN-USB
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:
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