PassThru and multiple channels
PassThru and multiple channels
Hi there!
I've a question about PassThur API and usage of multiple channels with one device. In one of the changelists I see "support for multiple channels". But when trying to allocate a second channel with a different protocol I get an error "Channel in use". In an old version (Windows XP times...) of the J2534 peak drivers that worked fine. I'm am using PCAN USB and PCAN-FD USB devices and the most recent driver and PassThru packages available. Here is the example code I'm using:
lRet = PassThruOpen(NULL, &DeviceID);
lRet = PassThruConnect(DeviceID, CAN, 0x900, 125000, &ChannelID_CAN);
lRet = PassThruConnect(DeviceID, ISO15765, 900, 125000, &ChannelID_ISO15765);
The second PassThruConnect returns an error 0x14. (ERR_CHANNEL_IN_USE)
What is the correct way to establish two channels in parallel? Or isn't that possible due to the underlying basic API?
Thanks and regards,
Norbert
I've a question about PassThur API and usage of multiple channels with one device. In one of the changelists I see "support for multiple channels". But when trying to allocate a second channel with a different protocol I get an error "Channel in use". In an old version (Windows XP times...) of the J2534 peak drivers that worked fine. I'm am using PCAN USB and PCAN-FD USB devices and the most recent driver and PassThru packages available. Here is the example code I'm using:
lRet = PassThruOpen(NULL, &DeviceID);
lRet = PassThruConnect(DeviceID, CAN, 0x900, 125000, &ChannelID_CAN);
lRet = PassThruConnect(DeviceID, ISO15765, 900, 125000, &ChannelID_ISO15765);
The second PassThruConnect returns an error 0x14. (ERR_CHANNEL_IN_USE)
What is the correct way to establish two channels in parallel? Or isn't that possible due to the underlying basic API?
Thanks and regards,
Norbert
-
- Sales & Support
- Posts: 1083
- Joined: Fri 20. Sep 2019, 13:31
Re: PassThru and multiple channels
Hello,
This would only be an issue if that channel would already be in use in e.G PCAN-View.
Which version of the Passthru-API are you currently using?
BR
Marvin
This would only be an issue if that channel would already be in use in e.G PCAN-View.
Which version of the Passthru-API are you currently using?
BR
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
Re: PassThru and multiple channels
Most recent from the download area. I'm pretty sure, it is not used by another application.
I can change the order of the commands, but it is always the first one that works and the second one that fails. It does not matter, which channel type is first. So I don't think it has to do with an already used channel.
I tested with PCAN-USB and PCAN_USB-FD interfaces.
Only solution to this is to use two PCAN interfaces, one for the first channel and another one for the second. That works, but this is a pretty expensive workaround
Thanks and regards,
Norbert
I can change the order of the commands, but it is always the first one that works and the second one that fails. It does not matter, which channel type is first. So I don't think it has to do with an already used channel.
I tested with PCAN-USB and PCAN_USB-FD interfaces.
Only solution to this is to use two PCAN interfaces, one for the first channel and another one for the second. That works, but this is a pretty expensive workaround

Thanks and regards,
Norbert
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: PassThru and multiple channels
Hello,
The comment you mention in changelog is "Added J2535-2 multiple channels support".
It actually corresponds to J2535-2 option with PassThruOpen where you can open a specific channel instead of the default one.
Here is an example:
If you want to do protocols ISO15765 and CAN on the same Passthru channel, you need to:
1. call PassThruConnect with protocol ISO15765,
2. enable parameter CAN_MIXED_FORMAT with PassThruIoctl.
The comment you mention in changelog is "Added J2535-2 multiple channels support".
It actually corresponds to J2535-2 option with PassThruOpen where you can open a specific channel instead of the default one.
Here is an example:
Code: Select all
// Open the device
// Note : write simply "result = PassThruOpen(NULL, &deviceId);" to open the configured (default) device
// Note : to use a particular channel, just write for example "confDevice = 0x41;"
// where 0x41...0x48 represent the PCI channels 1 to 8, and 0x51...0x58 represent the USB channels 1 to 8
confDevice = 0x51;
printf("Configured device 0x%X\n", confDevice);
sprintf_s(deviceString, sizeof(deviceString), "J2534-2:PEAK 0x%X", confDevice);
result = PassThruOpen(deviceString, &deviceId);
1. call PassThruConnect with protocol ISO15765,
2. enable parameter CAN_MIXED_FORMAT with PassThruIoctl.
Best regards,
Fabrice
Fabrice
Re: PassThru and multiple channels
Thanks a lot, I will try soon and report!
Best regards, Norbert
Best regards, Norbert
Re: PassThru and multiple channels
Sorry to say, but same result. These are the commands (ripped from a larger source):
Or is there no need for the secont PassThruConnect?
Best regards, Norbert
Code: Select all
lRet = PeakPassThruOpen("J2534-2:PEAK 0x51", &gDeviceID_CAN); // Fine, lRet = 0
:
lRet = PeakPassThruConnect(gDeviceID_CAN, ISO15765, Flags, BaudRate, &gChannelID_CAN); // Fine, lRet = 0
:
// Activate two channels via one device
SCONFIG_LIST list;
CONFIG config;
config.Parameter = CAN_MIXED_FORMAT;
config.Value = CAN_MIXED_FORMAT_ON;
list.NumOfParams = 1;
list.ConfigPtr = &config;
lRet = PassThruIoctl(gChannelID_CAN, SET_CONFIG, &list, NULL); // Fine, lRet = 0
lRet = PassThruConnect(gDeviceID_CAN, CAN, Flags, BaudRate, &gChannelID_CAN); // NOT FINE, lRet = 0x14, ERR_CHANNEL_IN_USE
Best regards, Norbert
Re: PassThru and multiple channels
Guess I got it. No need for the second PassThruConnect. Checked it in the production environment and it seems to work. Please correct me, if I'm wrong regarding the second PassThruConnect.
Nevertheless, THANKS A LOT
Norbert
Nevertheless, THANKS A LOT
Norbert
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: PassThru and multiple channels
Indeed the second call to PassThruConnect(..CAN..) is not needed.
Best regards,
Fabrice
Fabrice
Re: PassThru and multiple channels
Sorry for bothering you again. We did some more tests today and faced a new problem:
How to tell the device, if it has to send a command as ISO 15765 or as unformatted CAN frame?
Now it sends each command as unformatted CAN frame. So, how to activate the framing again / on runtime? Tried ISO15765_FRAME_PAD as TxFlag, but didn't work.
Regards, Norbert
How to tell the device, if it has to send a command as ISO 15765 or as unformatted CAN frame?
Now it sends each command as unformatted CAN frame. So, how to activate the framing again / on runtime? Tried ISO15765_FRAME_PAD as TxFlag, but didn't work.
Regards, Norbert
Re: PassThru and multiple channels
It's getting more complicated :-/
There definitely is a difference when using two different devices (one for can and one for ISO15765 or one device in mixed mode.
My last message is wrong, we analysed the signal and it is fine. Its a complete ISO message sent by the PCAN USB. But our application is not able to filter the response of the diagnostic command. It uses PassThruStartMsgFilter and PassThruStopMsgFilter for that. I guess these commands also behave different in CAN and in ISO mode.
Sorry for all the chaos, but we have no access to the original application, so we had to implement a PassThru Wrapper. Works really great with two devices, but in mixed mode we cannot figure out the problems.
Best regards, Norbert
There definitely is a difference when using two different devices (one for can and one for ISO15765 or one device in mixed mode.
My last message is wrong, we analysed the signal and it is fine. Its a complete ISO message sent by the PCAN USB. But our application is not able to filter the response of the diagnostic command. It uses PassThruStartMsgFilter and PassThruStopMsgFilter for that. I guess these commands also behave different in CAN and in ISO mode.
Sorry for all the chaos, but we have no access to the original application, so we had to implement a PassThru Wrapper. Works really great with two devices, but in mixed mode we cannot figure out the problems.
Best regards, Norbert