The function establishes communication according to the specified protocol. The adapter supports two independent diagnostic lines. Each protocol is associated with its own line. Line 1 is connected to pins 6 and 14 of the OBD connector and only
ISO15768 and CAN protocols can be connected to it. Line 2 is switched, and other protocols can be connected to it. The lines are independent, simultaneous operation of two protocols is allowed. For example, ISO15765 and ISO14230 or ISO15765
and ISO15765_PS. The PS prefix means that the protocol can be switched to the terminals of the OBD connector.
Protocols ISO15765 and CAN as well as ISO15765_PS and CAN_PS can work on the same physical line at the same time. This means
that you can initialize up to 4 protocols in one adapter at a time. The set speeds for each protocol pair should be the same. For example, ISO15765 and CAN with a speed of 500 Kbit on 6 and 14 pins of the OBD connector and ISO15765_PS and
CAN_PS with a speed of 125 Kbit on 3 and 11 pins.
long PassThruConnect(unsigned long DeviceID, unsigned long ProtocolID, unsigned long Flags, unsigned long BaudRate, unsigned long *pChannelID)
Definition | output | Description |
---|---|---|
J1850VPW | 2 VPW | Defined by SAE J1850 and SAE J2178 Can work simultaneously with CAN and ISO15765, Not compatible with dial-up protocols. |
J1850PWM | 2, 10 PWM | Defined by SAE J1850 It can work simultaneously with CAN and ISO15765. Not compatible with dial-up protocols. |
ISO9141 | 7K,15L Line | Defined by ISO 9141 and SAE J1979 Can work simultaneously with CAN and ISO15765. Not compatible with dial-up protocols. |
ISO14230 | 7K,15L Line | |
CAN | 6H,14L CAN | Not processed CAN stream. It can simultaneously work with all protocols. |
ISO15765 | 6H,14L CAN | Defined by ISO 15765-4 and ISO 14229-1 UDS It can simultaneously work with all protocols. |
SCI_A_ENGINE | Not supported | |
SCI_A_TRANS | Not supported | |
SCI_B_ENGINE | Not supported | |
SCI_B_TRANS | Not supported | |
J1850VPW_PS | Switched VPW | Defined by SAE J1850 and SAE J2178 Can work simultaneously with CAN and ISO15765. Not compatible with dial-up protocols. |
J1850PWM_PS | Switched PWM | Defined by SAE J1850 standard. Can work simultaneously with CAN and ISO15765, Not compatible with dial-up protocols. |
ISO9141_PS | Switched K L Line | Defined by ISO 9141 and SAE J1979 Can work simultaneously with CAN and ISO15765. Not compatible with dial-up protocols. |
ISO14230_PS | Switched K L Line | Defined by ISO 9141 and SAE J1979 Can work simultaneously with CAN and ISO15765. Not compatible with dial-up protocols. |
CAN_PS | Switched CAN | Not processed CAN stream. It can simultaneously work with all protocols. |
ISO15765_PS | Switched CAN | |
J2610_PS | Switched | |
SW_ISO15765_PS | 1 CAN | |
SW_CAN_PS | 1 CAN | |
GM_UART_PS | Switched K Line |
Name of the constant | bit | Description |
---|---|---|
ISO9141_K_LINE | 12 | Use L lines to initialize protocols. 0 = Used L-line and K-line for initialization 1 = Used only K-line for initialization |
CAN_ID_BOTH | 11 | Reception of both types of CAN identifiers for CAN and ISO 15765 protocols (see also bit 8) 0 = An 11 or 29 bit identifier is used as defined by bit 8 1 = 11 and 29 bit identifiers are accepted by the adapter. The setting of bit 8 is ignored. |
ISO9141_NO_CHECKSUM | 3 | Checking the checksum of a packet for ISO9141 and ISO14230 0 = The adapter generates and verifies the checksum as defined by ISO 9141-2 and ISO 14230-2. 1 = The adapter does not generate and does not verify the checksum. |
CAN_29BIT_ID | 8 | CAN identifier type for CAN and ISO 15765 protocols 0 = Packets with 11 bit identifiers are accepted. 1 = Packets with 29 bit identifiers are accepted. |
Definition | Description |
---|---|
STATUS_NOERROR | Function completed successfully |
ERR_DEVICE_NOT_CONNECTED | No connection to adapter. Possible reasons: The adapter is turned off, there is no network, or the IP address is not set correctly. |
ERR_INVALID_DEVICE_ID | Set a non-existent adapter ID DeviceID |
ERR_NOT_SUPPORTED | SCI protocols on 04/04/16 are not yet supported by the adapter. This error also occurs if incompatible protocols are specified. For example, VPW and PWM are set simultaneously. |
ERR_INVALID_PROTOCOL_ID | A non-existent ProtocolID is specified. |
ERR_NULL_PARAMETER | The pDeviceID pointer is not specified. |
ERR_INVALID_FLAGS | A flag does not exist |
ERR_INVALID_BAUDRATE | Wrong exchange rate set |
ERR_CHANNEL_IN_USE | The channel is already in use. Defined by the J2534 standard.
Actually this error code will never appear. Since when calling the PassThruConnect command again, the PassThruDisconnect command will be automatically called and the channel will be reopened.
|
ERR_FAILED | Defined by the J2534 standard. In the adapter, it is not used for this function. |
#include "j2534_lib.hpp"
unsigned long DeviceID;
long Ret;
unsigned long ChannelID;
unsigned long Flags = ISO9141_K_LINE_ONLY;
Ret = PassThruConnect(DeviceID, ISO14230, Flags, 10400, &ChannelID);
if (Ret != STATUS_NOERROR)
{ // Error handling
}