I am a C# Software Developer and I am having some issues when trying to combine XCP and CAN features in the same port in PCAN-USB Pro FD device. I use the non-free PCAN-API 4 libraries which, theoretically, support this combination.
What I am doing is:
TXCPResult result = XCPApi.InitializeCanChannel(out _XcpChannel, PCANBasic.PCAN_USBBUS1, TPCANBaudrate.PCAN_BAUD_500K); --> Returns "TXCPResult.XCP_ERR_OK"
And then:
StatusErrors status = CanApi4.RegisterClient(PcanDevice.Usb, "Port" + 16, 0, out byte client); --> Returns "StatusErrors.Ok"
status = CanApi4.ConnectToHardware(PcanDevice.Usb, client, _comm_parameters, ref _nethandle); --> Returns "StatusErrors.HardwareInUse"
Where:
_comm_parameters = "hw_handle=16, f_clock=40000000, nom_brp=5, nom_tseg1=11, nom_tseg2=4, nom_sjw=1" --> which sould mean using USBBUS1 with 500K baudrate speed.
If I try to execute these instructions in reverse order, the CanApi4 instructions return "StatusErrors.Ok" but the XCPApi instruction returns "TXCPResult.XCP_ERROR_INVALID_HANDLE".
Maybe I am doing something wrong (or maybe I am not doing something

Thanks a lot in advance!